This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Java/parse.y: Type clashes on the default action


In a rule such as

        foo: bar {} baz;

you implicitly say

        foo: bar {} baz { $$ = $1; };

Hence foo and bar must have the same type.  It was not the case for
the rules below.  I have also slightly adjusted the style of the
surrounding actions so that they have the same style.

Index: ChangeLog
from  Akim Demaille  <akim@epita.fr>

	* parse.y (class_declaration, interface_declaration): Make sure
	all their rules have an action, in order to avoid meaningless `$$
	= $1' and their type clashes.

Index: parse.y
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.386
diff -u -u -r1.386 parse.y
--- parse.y 11 Jun 2002 17:31:11 -0000 1.386
+++ parse.y 12 Jun 2002 10:06:37 -0000
@@ -579,7 +579,7 @@
 			anonymous_class_creation trap_overflow_corner_case
 %type    <node>         return_statement break_statement continue_statement
 
-%type    <operator>     ASSIGN_TK      MULT_ASSIGN_TK  DIV_ASSIGN_TK  
+%type    <operator>     ASSIGN_TK      MULT_ASSIGN_TK  DIV_ASSIGN_TK
 %type    <operator>     REM_ASSIGN_TK  PLUS_ASSIGN_TK  MINUS_ASSIGN_TK
 %type    <operator>     LS_ASSIGN_TK   SRS_ASSIGN_TK   ZRS_ASSIGN_TK
 %type    <operator>     AND_ASSIGN_TK  XOR_ASSIGN_TK   OR_ASSIGN_TK
@@ -846,20 +846,22 @@
 	modifiers CLASS_TK identifier super interfaces
 		{ create_class ($1, $3, $4, $5); }
 	class_body
+		{;}
 |	CLASS_TK identifier super interfaces
 		{ create_class (0, $2, $3, $4); }
 	class_body
+		{;}
 |	modifiers CLASS_TK error
-		{yyerror ("Missing class name"); RECOVER;}
+		{ yyerror ("Missing class name"); RECOVER; }
 |	CLASS_TK error
-		{yyerror ("Missing class name"); RECOVER;}
+		{ yyerror ("Missing class name"); RECOVER; }
 |       CLASS_TK identifier error
 		{
 		  if (!ctxp->class_err) yyerror ("'{' expected");
 		  DRECOVER(class1);
 		}
 |       modifiers CLASS_TK identifier error
-		{if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER;}
+		{ if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER; }
 ;
 
 super:
@@ -1279,19 +1281,23 @@
 	INTERFACE_TK identifier
 		{ create_interface (0, $2, NULL_TREE); }
 	interface_body
+		{ ; }
 |	modifiers INTERFACE_TK identifier
 		{ create_interface ($1, $3, NULL_TREE); }
 	interface_body
+		{ ; }
 |	INTERFACE_TK identifier extends_interfaces
 		{ create_interface (0, $2, $3);	}
 	interface_body
+		{ ; }
 |	modifiers INTERFACE_TK identifier extends_interfaces
 		{ create_interface ($1, $3, $4); }
 	interface_body
+		{ ; }
 |	INTERFACE_TK identifier error
-		{yyerror ("'{' expected"); RECOVER;}
+		{ yyerror ("'{' expected"); RECOVER; }
 |	modifiers INTERFACE_TK identifier error
-		{yyerror ("'{' expected"); RECOVER;}
+		{ yyerror ("'{' expected"); RECOVER; }
 ;
 
 extends_interfaces:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]