This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] gcj: Minor error detection patches.
- To: egcs-patches at egcs dot cygnus dot com
- Subject: [PATCH] gcj: Minor error detection patches.
- From: Alexandre Petit-Bianco <apbianco at cygnus dot com>
- Date: Mon, 1 Nov 1999 23:54:31 -0800
I just checked in this patch to improve error detections on two
situations that can be encountered while parsing Java source code.
./A
Mon Nov 1 23:42:00 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (method_header:): Issue error message for rule `type
error'.
(synchronized:): Error report when not using synchronized.
Index: parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
retrieving revision 1.116
diff -u -p -r1.116 parse.y
--- parse.y 1999/11/01 09:45:18 1.116
+++ parse.y 1999/11/02 07:49:04
@@ -890,7 +890,10 @@ method_header:
| modifiers VOID_TK method_declarator throws
{ $$ = method_header ($1, void_type_node, $3, $4); }
| type error
- {RECOVER;}
+ {
+ yyerror ("Invalid method declaration, method name required");
+ RECOVER;
+ }
| modifiers type error
{RECOVER;}
| VOID_TK error
@@ -1669,10 +1672,14 @@ synchronized_statement:
;
synchronized:
- MODIFIER_TK
+ modifiers
{
- if ((1 << $1) != ACC_SYNCHRONIZED)
- fatal ("synchronized was '%d' - yyparse", (1 << $1));
+ check_modifiers ("Illegal modifier `%s'. Only "
+ "`synchronized' was expected here",
+ $1, ACC_SYNCHRONIZED);
+ if ($1 != ACC_SYNCHRONIZED)
+ MODIFIER_WFL (SYNCHRONIZED_TK) =
+ build_wfl_node (NULL_TREE);
}
;