re PR objc/20574 (weird error message after a parse error)
authorAndrew Pinski <pinskia@physics.uc.edu>
Thu, 8 Sep 2005 13:09:49 +0000 (13:09 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Thu, 8 Sep 2005 13:09:49 +0000 (06:09 -0700)
2005-09-08  Andrew Pinski  <pinskia@physics.uc.edu>

        PR objc/20574
        PR objc/19324
        * c-parser.c (c_parser_objc_method_definition): If the next
        token is not "{", error out and don't start the function.

2005-09-08  Andrew Pinski  <pinskia@physics.uc.edu>

        PR objc/20574
        PR objc/19324
        * objc.dg/error-1.m: New test.

From-SVN: r104032

gcc/ChangeLog
gcc/c-parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/objc.dg/error-1.m [new file with mode: 0644]

index a360100785f669d07cefbbb5c15599e4b07f43b9..3edc2b3e873e48865d672417eb94e0a33c7bd9e5 100644 (file)
@@ -1,3 +1,10 @@
+2005-09-08  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR objc/20574
+       PR objc/19324
+       * c-parser.c (c_parser_objc_method_definition): If the next
+       token is not "{", error out and don't start the function.
+
 2005-09-08  Andrew Pinski  <pinskia@physics.uc.edu>
 
        * tree-vrp.c (extract_range_from_expr): Move the check for non
index 268fa908480fffba0e563eb44adb1982d8bc04c0..ce035694fd2dc3e1f14bd1cba844d648273e55d8 100644 (file)
@@ -5723,6 +5723,11 @@ c_parser_objc_method_definition (c_parser *parser)
       if (pedantic)
        pedwarn ("extra semicolon in method definition specified");
     }
+  if (!c_parser_next_token_is (parser, CPP_OPEN_BRACE))
+    {
+      c_parser_error (parser, "expected %<{%>");
+      return;
+    }
   objc_pq_context = 0;
   objc_start_method_definition (decl);
   add_stmt (c_parser_compound_statement (parser));
index c68a2aebd71931498f7856ed65f33beaad59bd61..e43b16c87c36e0aac36fc5654ca607a287e265a0 100644 (file)
@@ -1,3 +1,9 @@
+2005-09-08  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR objc/20574
+       PR objc/19324
+       * objc.dg/error-1.m: New test.
+
 2005-09-07  Richard Sandiford  <richard@codesourcery.com>
 
        PR fortran/23373
diff --git a/gcc/testsuite/objc.dg/error-1.m b/gcc/testsuite/objc.dg/error-1.m
new file mode 100644 (file)
index 0000000..86b9d7f
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-options "-w" } */
+/* { dg-do compile } */
+@implementation A
++B  
++C {} /* { dg-error "expected '\{' before '\\\+' token" } */
+@end