[cfe-commits] r43437 - /cfe/trunk/Parse/ParseDecl.cpp
Chris Lattner
sabre at nondot.org
Sun Oct 28 21:42:54 PDT 2007
Author: lattner
Date: Sun Oct 28 23:42:53 2007
New Revision: 43437
URL: http://llvm.org/viewvc/llvm-project?rev=43437&view=rev
Log:
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.
Modified:
cfe/trunk/Parse/ParseDecl.cpp
Modified: cfe/trunk/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/ParseDecl.cpp?rev=43437&r1=43436&r2=43437&view=diff
==============================================================================
--- cfe/trunk/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/Parse/ParseDecl.cpp Sun Oct 28 23:42:53 2007
@@ -630,11 +630,13 @@
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 @@
// 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 @@
// 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 @@
if (Tok.is(tok::kw___attribute))
DeclaratorInfo.AddAttributes(ParseAttributes());
}
- return;
}
/// ParseStructUnionBody
More information about the cfe-commits
mailing list