[cfe-commits] r39632 - in /cfe/cfe/trunk: Parse/ParseDecl.cpp include/clang/Basic/DiagnosticKinds.def
clattner at cs.uiuc.edu
clattner at cs.uiuc.edu
Wed Jul 11 09:46:27 PDT 2007
Author: clattner
Date: Wed Jul 11 11:46:27 2007
New Revision: 39632
URL: http://llvm.org/viewvc/llvm-project?rev=39632&view=rev
Log:
Add support for a little extension. ISO C does not allow extra ;'s in structs,
e.g.:
struct A {
;
int X;;
const;
};
Modified:
cfe/cfe/trunk/Parse/ParseDecl.cpp
cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def
Modified: cfe/cfe/trunk/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseDecl.cpp?rev=39632&r1=39631&r2=39632&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/ParseDecl.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseDecl.cpp Wed Jul 11 11:46:27 2007
@@ -633,6 +633,12 @@
Tok.getKind() != tok::eof) {
// Each iteration of this loop reads one struct-declaration.
+ if (Tok.getKind() == tok::semi) {
+ Diag(Tok, diag::ext_extra_struct_semi);
+ ConsumeToken();
+ continue;
+ }
+
// Parse the common specifier-qualifiers-list piece.
DeclSpec DS;
SourceLocation SpecQualLoc = Tok.getLocation();
Modified: cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=39632&r1=39631&r2=39632&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def Wed Jul 11 11:46:27 2007
@@ -265,6 +265,8 @@
"ISO C forbids an empty source file")
DIAG(ext_top_level_semi, EXTENSION,
"ISO C does not allow extra ';' outside of a function")
+DIAG(ext_extra_struct_semi, EXTENSION,
+ "ISO C does not allow extra ';' inside a struct or union")
DIAG(ext_duplicate_declspec, EXTENSION,
"duplicate '%0' declaration specifier")
DIAG(ext_plain_complex, EXTENSION,
More information about the cfe-commits
mailing list