[cfe-commits] r39633 - 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:28 PDT 2007


Author: clattner
Date: Wed Jul 11 11:46:28 2007
New Revision: 39633

URL: http://llvm.org/viewvc/llvm-project?rev=39633&view=rev
Log:
Accept horrible code like this:

2005-10-18-VariableSizedElementCrash.c:5:41: warning: expected ';' at end of declaration list
  struct bar {foo f1; int f2:3; int f3:4} *p = (struct bar *) pi;
                                        ^

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=39633&r1=39632&r2=39633&view=diff

==============================================================================
--- cfe/cfe/trunk/Parse/ParseDecl.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseDecl.cpp Wed Jul 11 11:46:28 2007
@@ -700,6 +700,9 @@
     
     if (Tok.getKind() == tok::semi) {
       ConsumeToken();
+    } else if (Tok.getKind() == tok::r_brace) {
+      Diag(Tok.getLocation(), diag::ext_expected_semi_decl_list);
+      break;
     } else {
       Diag(Tok, diag::err_expected_semi_decl_list);
       // Skip to end of block or statement

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=39633&r1=39632&r2=39633&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def Wed Jul 11 11:46:28 2007
@@ -332,6 +332,8 @@
      "expected '>'")
 DIAG(err_expected_semi_decl_list, ERROR,
      "expected ';' at end of declaration list")
+DIAG(ext_expected_semi_decl_list, EXTENSION,
+     "expected ';' at end of declaration list")
 DIAG(err_expected_fn_body, ERROR,
      "expected function body after function declarator")
 DIAG(err_expected_after_declarator, ERROR,





More information about the cfe-commits mailing list