[cfe-commits] r41004 - in /cfe/trunk: Parse/Parser.cpp test/Parser/extension.c

Chris Lattner sabre at nondot.org
Fri Aug 10 13:57:02 PDT 2007


Author: lattner
Date: Fri Aug 10 15:57:02 2007
New Revision: 41004

URL: http://llvm.org/viewvc/llvm-project?rev=41004&view=rev
Log:
add support for a top-level __extension__ marker, implementing a todo.


Added:
    cfe/trunk/test/Parser/extension.c
Modified:
    cfe/trunk/Parse/Parser.cpp

Modified: cfe/trunk/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/Parser.cpp?rev=41004&r1=41003&r2=41004&view=diff

==============================================================================
--- cfe/trunk/Parse/Parser.cpp (original)
+++ cfe/trunk/Parse/Parser.cpp Fri Aug 10 15:57:02 2007
@@ -282,11 +282,11 @@
 
 /// ParseExternalDeclaration:
 ///       external-declaration: [C99 6.9]
-///         function-definition        [TODO]
-///         declaration                [TODO]
+///         function-definition
+///         declaration
 /// [EXT]   ';'
 /// [GNU]   asm-definition
-/// [GNU]   __extension__ external-declaration     [TODO]
+/// [GNU]   __extension__ external-declaration
 /// [OBJC]  objc-class-definition
 /// [OBJC]  objc-class-declaration
 /// [OBJC]  objc-alias-declaration
@@ -304,6 +304,13 @@
     ConsumeToken();
     // TODO: Invoke action for top-level semicolon.
     return 0;
+  case tok::kw___extension__: {
+    ConsumeToken();
+    // FIXME: Disable extension warnings.
+    DeclTy *RV = ParseExternalDeclaration();
+    // FIXME: Restore extension warnings.
+    return RV;
+  }
   case tok::kw_asm:
     ParseSimpleAsm();
     ExpectAndConsume(tok::semi, diag::err_expected_semi_after,

Added: cfe/trunk/test/Parser/extension.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/extension.c?rev=41004&view=auto

==============================================================================
--- cfe/trunk/test/Parser/extension.c (added)
+++ cfe/trunk/test/Parser/extension.c Fri Aug 10 15:57:02 2007
@@ -0,0 +1,9 @@
+// RUN: clang %s -fsyntax-only
+
+// Top level extension marker.
+
+__extension__ typedef struct
+{
+    long long int quot; 
+    long long int rem; 
+}lldiv_t; 





More information about the cfe-commits mailing list