diff options
author | Chris Lattner <sabre@nondot.org> | 2007-10-29 04:42:53 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-10-29 04:42:53 +0000 |
commit | cd4b83cb4b4d69dbfa35ef97fe8ab88c0f2698a9 (patch) | |
tree | d38fccc8f55bd24d6c471c3cf900376683628f6c /Parse/ParseDecl.cpp | |
parent | 3da2db468d9a694535d62e7b96a010ce95c26fb6 (diff) |
The callers of ParseStructDeclaration are not expecting it to
eat the terminating ;. Fix one place where it did, allowing this
to compile without error:
struct x {
int a;
union {
int b;
float c;
};
int d;
};
This reduces diagnostics on PR1750 from 33 to 27.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43437 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Parse/ParseDecl.cpp')
-rw-r--r-- | Parse/ParseDecl.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Parse/ParseDecl.cpp b/Parse/ParseDecl.cpp index 80ff5757e0..a525792ff8 100644 --- a/Parse/ParseDecl.cpp +++ b/Parse/ParseDecl.cpp @@ -630,11 +630,13 @@ void Parser::ParseStructUnionSpecifier(DeclSpec &DS) { Diag(StartLoc, diag::err_invalid_decl_spec_combination, PrevSpec); } -/// ParseStructDeclaration +/// ParseStructDeclaration - Parse a struct declaration without the terminating +/// semicolon. +/// /// struct-declaration: -/// specifier-qualifier-list struct-declarator-list ';' +/// specifier-qualifier-list struct-declarator-list /// [GNU] __extension__ struct-declaration -/// [GNU] specifier-qualifier-list ';' +/// [GNU] specifier-qualifier-list /// struct-declarator-list: /// struct-declarator /// struct-declarator-list ',' struct-declarator @@ -661,7 +663,6 @@ void Parser::ParseStructDeclaration(DeclTy *TagDecl, // If there are no declarators, issue a warning. if (Tok.is(tok::semi)) { Diag(SpecQualLoc, diag::w_no_declarators); - ConsumeToken(); return; } @@ -697,7 +698,7 @@ void Parser::ParseStructDeclaration(DeclTy *TagDecl, // If we don't have a comma, it is either the end of the list (a ';') // or an error, bail out. if (Tok.isNot(tok::comma)) - break; + return; // Consume the comma. ConsumeToken(); @@ -709,7 +710,6 @@ void Parser::ParseStructDeclaration(DeclTy *TagDecl, if (Tok.is(tok::kw___attribute)) DeclaratorInfo.AddAttributes(ParseAttributes()); } - return; } /// ParseStructUnionBody |