[cfe-commits] r70283 - in /cfe/trunk: lib/Lex/Preprocessor.cpp test/SemaCXX/decl-expr-ambiguity.cpp

Eli Friedman eli.friedman at gmail.com
Mon Apr 27 20:59:16 PDT 2009


Author: efriedma
Date: Mon Apr 27 22:59:15 2009
New Revision: 70283

URL: http://llvm.org/viewvc/llvm-project?rev=70283&view=rev
Log:
Emit keyword extension warning in all modes, not just C99 mode.


Modified:
    cfe/trunk/lib/Lex/Preprocessor.cpp
    cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp

Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=70283&r1=70282&r2=70283&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Mon Apr 27 22:59:15 2009
@@ -471,6 +471,8 @@
 
   // If this is an extension token, diagnose its use.
   // We avoid diagnosing tokens that originate from macro definitions.
-  if (II.isExtensionToken() && Features.C99 && !DisableMacroExpansion)
+  // FIXME: This warning is disabled in cases where it shouldn't be,
+  // like "#define TY typeof", "TY(1) x".
+  if (II.isExtensionToken() && !DisableMacroExpansion)
     Diag(Identifier, diag::ext_token_used);
 }

Modified: cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp?rev=70283&r1=70282&r2=70283&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp (original)
+++ cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp Mon Apr 27 22:59:15 2009
@@ -15,7 +15,7 @@
   for (int(a)+1;;) {}
   a = sizeof(int()+1);
   a = sizeof(int(1));
-  typeof(int()+1) a2;
+  typeof(int()+1) a2; // expected-error {{extension used}}
   (int(1)); // expected-warning {{expression result unused}}
 
   // type-id
@@ -25,7 +25,7 @@
   int fd(T(a)); // expected-warning {{parentheses were disambiguated as a function declarator}}
   T(*d)(int(p)); // expected-warning {{parentheses were disambiguated as a function declarator}} expected-note {{previous definition is here}}
   T(d)[5]; // expected-error {{redefinition of 'd'}}
-  typeof(int[])(f) = { 1, 2 }; 
+  typeof(int[])(f) = { 1, 2 }; // expected-error {{extension used}}
   void(b)(int);
   int(d2) __attribute__(()); 
   if (int(a)=1) {}





More information about the cfe-commits mailing list