[LLVMdev] -Wx backing out a previous -Wno-error=x

Alexander Best arundel at FreeBSD.ORG
Mon Nov 28 14:56:09 PST 2011


On Mon Nov 28 11, Alexander Best wrote:
> hi there,
> 
> i ran into a situation, which seemed non-intuitive to me. so i wanted to ask,
> whether this behavior is intentional, and/or maintained due to gcc
> compatibility, or non-intentional.

i've performed some tests with gcc and it seems gcc will *not* back out any
-Wno-error=X flags, if a -WX flag was later specified. so clang doesn't follow
gcc semantics in this case.

cheers.
alex

> 
> compiling xxx.c with an explicit
> 
> int n;
> ...
> n = n;
> ...
> 
> via
> 
> 'clang -Wno-error=self-assign -Werror xxx.c -o xxx'
> 
> i get the following warning:
> 
> "
> tower.c:5:7: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
>     n = n;
>     ~ ^ ~
> 1 warning generated.
> "
> 
> ... so far so good. however adding an extra "-Wself-assign" or "-Wall" as the
> last flag, will turn the previous warning into an error. so it seems those
> warnings do in fact revert the "-Wno-error=self-assign":
> 
> 'clang -Wno-error=self-assign -Werror -Wall xxx.c -o xxx'
> 
> gives the following error:
> 
> "
> tower.c:5:7: error: explicitly assigning a variable of type 'int' to itself [-Werror,-Wself-assign]
>     n = n;
>     ~ ^ ~
> 1 error generated.
> "
> 
> is this proper behaviour?
> 
> cheers.
> alex



More information about the llvm-dev mailing list