Open llvmbot opened 9 years ago
If you use --save-temps, then you get the behavior you reported - perhaps that's what you're doing?
$ clang-tot --save-temps -Weverything -c tmp.c
tmp.c:2:99: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
void f () { if ((((__extension__ (((union { __typeof(0) __in; int __i; }) { .__in = (0) }).__i))) == 0xffff)) return; }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
tmp.c:2:99: note: remove extraneous parentheses around the comparison to silence this warning
void f () { if ((((__extension__ (((union { __typeof(0) __in; int __i; }) { .__in = (0) }).__i))) == 0xffff)) return; }
~ ^ ~
tmp.c:2:99: note: use '=' to turn this equality comparison into an assignment
void f () { if ((((__extension__ (((union { __typeof(0) __in; int __i; }) { .__in = (0) }).__i))) == 0xffff)) return; }
^~
=
tmp.c:2:6: warning: no previous prototype for function 'f' [-Wmissing-prototypes]
void f () { if ((((__extension__ (((union { __typeof(0) __in; int __i; }) { .__in = (0) }).__i))) == 0xffff)) return; }
^
2 warnings generated.
I believe --save-temps is only intended as a debugging aid & doesn't guarantee diagnostic consistency with the usual compile command line? But I'm not entirely sure. Perhaps we don't have an official stance on this...
This doesn't look like the output of clang (clang's diagnostics quote the original source, not the post-processed source). Did you run this through the preprocessor manually before giving it to clang?
Not sure how else you'd get that output...
(could you provide a standalone reproduction?)
I don't get a missing-prototype warning for the original source code you gave:
$ cat tmp.c
#include <sys/wait.h>
void f () { if (WIFCONTINUED(0)) return; }
$ clang-tot -Weverything -c tmp.c
tmp.c:2:6: warning: no previous prototype for function 'f' [-Wmissing-prototypes]
void f () { if (WIFCONTINUED(0)) return; }
^
1 warning generated.
Extended Description
It complains about extra parentheses around comparison, however no such thing exists in the source -- the warning concerns the expanded macros: