[cfe-commits] r48332 - /cfe/trunk/Parse/ParseStmt.cpp

Chris Lattner sabre at nondot.org
Wed Mar 12 23:32:11 PDT 2008


Author: lattner
Date: Thu Mar 13 01:32:11 2008
New Revision: 48332

URL: http://llvm.org/viewvc/llvm-project?rev=48332&view=rev
Log:
handle __extension__ properly at block scope.

Modified:
    cfe/trunk/Parse/ParseStmt.cpp

Modified: cfe/trunk/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/ParseStmt.cpp?rev=48332&r1=48331&r2=48332&view=diff

==============================================================================
--- cfe/trunk/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/Parse/ParseStmt.cpp Thu Mar 13 01:32:11 2008
@@ -431,19 +431,25 @@
       while (Tok.is(tok::kw___extension__))
         ConsumeToken();
       
+      // __extension__ silences extension warnings in the subexpression.
+      bool SavedExtWarn = Diags.getWarnOnExtensions();
+      Diags.setWarnOnExtensions(false);
+      
       // If this is the start of a declaration, parse it as such.
       if (isDeclarationSpecifier()) {
         // FIXME: Save the __extension__ on the decl as a node somehow.
-        // FIXME: disable extwarns.
         SourceLocation DeclStart = Tok.getLocation();
         DeclTy *Res = ParseDeclaration(Declarator::BlockContext);
         // FIXME: Pass in the right location for the end of the declstmt.
         R = Actions.ActOnDeclStmt(Res, DeclStart, DeclStart);
+        
+        Diags.setWarnOnExtensions(SavedExtWarn);
       } else {
         // Otherwise this was a unary __extension__ marker.  Parse the
         // subexpression and add the __extension__ unary op. 
-        // FIXME: disable extwarns.
         ExprResult Res = ParseCastExpression(false);
+        Diags.setWarnOnExtensions(SavedExtWarn);
+
         if (Res.isInvalid) {
           SkipUntil(tok::semi);
           continue;





More information about the cfe-commits mailing list