[vlc-devel] [PATCH] core: moved variable declaration to prevent compiler warning (gcc -Wclobbered)

Rémi Denis-Courmont remi at remlab.net
Wed May 11 17:11:00 CEST 2016

Le 2016-05-11 16:47, Filip Roséen a écrit :
> We do not care if "pause" is clobbered or not, but we do care about
> warnings from the compiler.

We do usually care if variables are clobbered. There are not so old 
examples of bugs in the VLC code base due to this. In this case, the 
variable cannot be clobered, for a very simple reason: the long jump is 
never actually performed.

> In order to supress the compiler diagnostic all we need to do is move
> "paused" to exists within the "invisible" scope introduced by
> pthread_cleanup_push (making gcc see that it will not be used
> during clean-up).

This trick might work in this specific code path with your specific 
compiler and libc versions and settings. But it won't work in other 
cases because in general long jump cloberred variables may need to be 
declared before the setjmp() call.

I fail to see a bug in VLC code here. This is an issue between GCC and 
glibc, and so we should not put ugly hacks in the VLC code base for it. 
If those warnings annoy you, turn them off.

Ideally, we would turn them off globally, but we would first have to 
get rid of all *direct* sigsetjmp/setjmp usage in VLC.

Rémi Denis-Courmont

More information about the vlc-devel mailing list