[LLVMdev] -Wx backing out a previous -Wno-error=x
Alexander Best
arundel at FreeBSD.ORG
Mon Nov 28 14:14:05 PST 2011
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.
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