Patch: Parser fixes

Tom Tromey tromey@redhat.com
Tue Jan 21 18:27:00 GMT 2003


This patch fixes a couple parser bugs.

A method cannot be both `native' and `strictfp'.
Also, a method cannot be marked `transient' or `volatile'.

Tested on x86 Red Hat Linux 7.3.
Test suite update included.

Ok for trunk and branch?

Tom

Index: gcc/java/ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* parse.y (method_header): Native method can't be strictfp.
	No method can be transient or volatile.

Index: gcc/java/parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.405.2.2
diff -u -r1.405.2.2 parse.y
--- gcc/java/parse.y 14 Jan 2003 20:30:29 -0000 1.405.2.2
+++ gcc/java/parse.y 21 Jan 2003 17:24:45 -0000
@@ -1,6 +1,6 @@
 /* Source code parsing and tree node generation for the GNU compiler
    for the Java(TM) language.
-   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
    Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
 
 This file is part of GNU CC.
@@ -4581,6 +4581,18 @@
 	   IDENTIFIER_POINTER (DECL_NAME (GET_CPC ())),
 	   IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
     }
+
+  /* A native method can't be strictfp.  */
+  if ((flags & ACC_NATIVE) && (flags & ACC_STRICT))
+    parse_error_context (id, "native method `%s' can't be strictfp",
+			 IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
+  /* No such thing as a transient or volatile method.  */
+  if ((flags & ACC_TRANSIENT))
+    parse_error_context (id, "method `%s' can't be transient",
+			 IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
+  if ((flags & ACC_VOLATILE))
+    parse_error_context (id, "method `%s' can't be volatile",
+			 IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
 
   /* Things to be checked when declaring a constructor */
   if (!type)
Index: libjava/testsuite/ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* libjava.jacks/jacks.xfail: All 8.4.3 tests and 9.4-modifier-10
	now pass.

Index: libjava/testsuite/libjava.jacks/jacks.xfail
===================================================================
RCS file: /cvs/gcc/gcc/libjava/testsuite/libjava.jacks/jacks.xfail,v
retrieving revision 1.1.12.1
diff -u -r1.1.12.1 jacks.xfail
--- libjava/testsuite/libjava.jacks/jacks.xfail 19 Dec 2002 19:32:19 -0000 1.1.12.1
+++ libjava/testsuite/libjava.jacks/jacks.xfail 21 Jan 2003 17:24:46 -0000
@@ -258,10 +258,6 @@
 8.4.6.3-signature-10
 8.4.6.3-signature-12
 8.4.6.3-signature-15
-8.4.3-native-9
-8.4.3-native-10
-8.4.3-bad-1
-8.4.3-bad-2
 8.7-abrupt-1
 8.7-complete-1
 8.7-complete-3
@@ -592,7 +588,6 @@
 15.15.2-final-3
 15.15.1-final-2
 15.15.1-final-3
-9.4-modifier-10
 9.4.1-conflict-2
 9.3.1-init-1
 9.3.1-illegal-forward-1



More information about the Gcc-patches mailing list