"catch ()" misdiagnosed

Alexandre Petit-Bianco apbianco@cygnus.com
Tue Nov 23 10:59:00 GMT 1999


Olly Betts writes:

> Now "')' expected" is wrong since it's just found a closing bracket.

Indeed.

> And we shouldn't be getting an internal compiler error either,
> should we?

We shouldn't. Can you try to patch below?

./A

Tue Nov 23 10:55:18 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* parse.y (catch_clause_parameter:): Still set `$$' to NULL_TREE
 	in case of error.

Index: parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
retrieving revision 1.118
diff -u -p -r1.118 parse.y
--- parse.y     1999/11/09 20:30:57     1.118
+++ parse.y     1999/11/23 18:55:42
@@ -1732,11 +1732,14 @@ catch_clause_parameter:
                  EXPR_WFL_LINECOL ($$) = $1.location;
                }
 |      CATCH_TK error
-               {yyerror ("'(' expected"); RECOVER;}
+               {yyerror ("'(' expected"); RECOVER; $$ = NULL_TREE;}
 |      CATCH_TK OP_TK error 
-               {yyerror ("Missing term or ')' expected"); DRECOVER (2);}
+               {
+                 yyerror ("Missing term or ')' expected"); 
+                 RECOVER; $$ = NULL_TREE;
+               }
 |      CATCH_TK OP_TK error CP_TK /* That's for () */
-               {yyerror ("')' expected"); DRECOVER (1);}
+               {yyerror ("Missing term"); RECOVER; $$ = NULL_TREE;}
 ;
 
 finally:


More information about the Java mailing list