]> granicus.if.org Git - clang/commitdiff
Emit keyword extension warning in all modes, not just C99 mode.
authorEli Friedman <eli.friedman@gmail.com>
Tue, 28 Apr 2009 03:59:15 +0000 (03:59 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Tue, 28 Apr 2009 03:59:15 +0000 (03:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70283 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/Preprocessor.cpp
test/SemaCXX/decl-expr-ambiguity.cpp

index 07fab811370bdbf1034a2f809cf857078a663c9a..0a7d92eb83cfe068c9eaaafed609ffaccae9d129 100644 (file)
@@ -471,6 +471,8 @@ void Preprocessor::HandleIdentifier(Token &Identifier) {
 
   // 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);
 }
index 227834a26a4ff6db2341bd0bdc692d87af68b8da..a9275dcd1fd498ae593f9a95b8909f7f64c16085 100644 (file)
@@ -15,7 +15,7 @@ void f() {
   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 @@ void f() {
   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) {}