[cfe-dev] Does `#pragma GCC diagnostic warning` intentionally win over -Werror?
Nico Weber via cfe-dev
cfe-dev at lists.llvm.org
Wed Jan 23 20:11:28 PST 2019
Consider:
$ cat test.cc
#pragma GCC diagnostic warning "-Wsign-compare"
bool f(int a, unsigned b) {
return a != b;
}
$ out/gn/bin/clang -c test.cc -Werror
test.cc:4:12: warning: comparison of integers of different signs: 'int' and
'unsigned int' [-Wsign-compare]
return a != b;
~ ^ ~
1 warning generated.
I found it surprising that this is emitted as a warning, not as an error.
If this is intentional, is there some other way to say "I want my compiler
warnings to always be errors"?
Thanks,
Nico
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190123/85a59672/attachment.html>
More information about the cfe-dev
mailing list