[llvm-bugs] [Bug 25436] New: clang -Wunknown-pragmas shouldn't warn about a '#pragma GCC diagnostic' it doesn't know
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Nov 6 13:48:15 PST 2015
https://llvm.org/bugs/show_bug.cgi?id=25436
Bug ID: 25436
Summary: clang -Wunknown-pragmas shouldn't warn about a
'#pragma GCC diagnostic' it doesn't know
Product: new-bugs
Version: trunk
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: sean at rogue-research.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
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?
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151106/a2d6e0c4/attachment.html>
More information about the llvm-bugs
mailing list