[cfe-commits] r141804 - in /cfe/trunk: lib/Basic/DiagnosticIDs.cpp test/Sema/implicit-int.c

Bob Wilson bob.wilson at apple.com
Wed Oct 12 12:55:31 PDT 2011


Author: bwilson
Date: Wed Oct 12 14:55:31 2011
New Revision: 141804

URL: http://llvm.org/viewvc/llvm-project?rev=141804&view=rev
Log:
Change __extension__ to disable only diagnostics controlled by -pedantic.

This changes clang to match GCC's behavior for __extension__, which temporarily
disables the -pedantic flag.  Warnings that are enabled without -pedantic
are not affected.  Besides the general goodness of matching GCC's precedent,
my motivation for this is that macros in the arm_neon.h header need to use
__extension__ to avoid pedantic complaints about their use of statement
expressions, yet we still want to warn about incompatible pointer arguments
for those macros.

Modified:
    cfe/trunk/lib/Basic/DiagnosticIDs.cpp
    cfe/trunk/test/Sema/implicit-int.c

Modified: cfe/trunk/lib/Basic/DiagnosticIDs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/DiagnosticIDs.cpp?rev=141804&r1=141803&r2=141804&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/DiagnosticIDs.cpp (original)
+++ cfe/trunk/lib/Basic/DiagnosticIDs.cpp Wed Oct 12 14:55:31 2011
@@ -550,9 +550,12 @@
       !MappingInfo.isUser())
     Result = DiagnosticIDs::Warning;
 
-  // Ignore any kind of extension diagnostics inside __extension__ blocks.
-  bool IsExtensionDiag = isBuiltinExtensionDiag(DiagID);
-  if (Diag.AllExtensionsSilenced && IsExtensionDiag)
+  // Ignore -pedantic diagnostics inside __extension__ blocks.
+  // (The diagnostics controlled by -pedantic are the extension diagnostics
+  // that are not enabled by default.)
+  bool EnabledByDefault;
+  bool IsExtensionDiag = isBuiltinExtensionDiag(DiagID, EnabledByDefault);
+  if (Diag.AllExtensionsSilenced && IsExtensionDiag && !EnabledByDefault)
     return DiagnosticIDs::Ignored;
 
   // For extension diagnostics that haven't been explicitly mapped, check if we

Modified: cfe/trunk/test/Sema/implicit-int.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/implicit-int.c?rev=141804&r1=141803&r2=141804&view=diff
==============================================================================
--- cfe/trunk/test/Sema/implicit-int.c (original)
+++ cfe/trunk/test/Sema/implicit-int.c Wed Oct 12 14:55:31 2011
@@ -24,9 +24,5 @@
 }
 
 struct foo {
- __extension__ __attribute__((packed)) x : 4;
+ __extension__ __attribute__((packed)) x : 4; // expected-warning {{type specifier missing, defaults to 'int'}}
 };
-
-
-
-





More information about the cfe-commits mailing list