diff options
author | Chris Lattner <sabre@nondot.org> | 2008-03-13 06:32:11 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-03-13 06:32:11 +0000 |
commit | 043a0b50a2a7a29c78a1ffb774f6fca8baf464a0 (patch) | |
tree | 11c10f4df023c5ce33632ad7916c25f086de2cb7 | |
parent | 691a38b740562119ea8b2e25c3e04599971e708f (diff) |
handle __extension__ properly at block scope.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48332 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Parse/ParseStmt.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Parse/ParseStmt.cpp b/Parse/ParseStmt.cpp index dab484211e..f9800219ed 100644 --- a/Parse/ParseStmt.cpp +++ b/Parse/ParseStmt.cpp @@ -431,19 +431,25 @@ Parser::StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) { 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; |