Open seanm opened 8 years ago
mentioned in issue llvm/llvm-bugzilla-archive#50006
This is still happening with trunk, although now it blames the warning on -Wunknown-warning-option (at least in my case).
This is preventing us from compiling NumPY with -Wunknown-warning-option turned on, because of this line: https://github.com/numpy/numpy/blob/master/numpy/linalg/umath_linalg.c.src#L734
numpy/linalg/umath_linalg.c.src:744:32: error: unknown warning group '-Wmaybe-uninitialized', ignored [-Werror,-Wunknown-warning-option]
^
1 error generated.
Just a note to say issue still occurs with trunk 347180.
Interestingly, if one passes "-Wlarger-than=3000" to clang it doesn't complain that the flag is unknown (for gcc compatibility no doubt), so why inconsistently complain in the pragma case?
Extended Description
If clang r252202 encounters this:
pragma GCC diagnostic ignored "-Wlarger-than="
it warns:
test.c:1:32: warning: unknown warning group '-Wlarger-than=', ignored [-Wunknown-pragmas]
pragma GCC diagnostic ignored "-Wlarger-than="
GCC has a -Wlarger-than= warning, clang does not (itself bug #10623).
I realize I'm sorta asking for such warnings by specifying -Wunknown-pragmas, but I think this is a bit different. Ordinarily, I would guard complier/platform-specific pragmas with something like:
if GNUC
but that won't help because clang (incompletely) pretends to be GCC. (And -Wlarger-than= is in gcc 4.2, so adding version checks won't help.)
I guess the only workaround for portable code is something like:
if GNUC && !clang
Basically, I see little value in -Wunknown-pragmas warning that clang's GCC emulation is not 100%. Perhaps a special case for "#pragma GCC"? Or whitelist known GCC warning flags that clang doesn't support?