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: [gcjh] Fix PR 16474


This patch fixes PR 16474. With bytecode emitted by some non-gcj compilers, gcjh could emit a non-static final field as a C++ "const" field with an initializer, which is not legal C++. This patch fixes gcjh to only emit initializers for "static final" fields.

OK to commit?

Bryce


2004-07-11  Bryce McKinlay  <mckinlay@redhat.com>

	PR java/16474
	gjavah.c (print_field_info): Emit constant only if field is static.

Index: gjavah.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/gjavah.c,v
retrieving revision 1.116
diff -u -r1.116 gjavah.c
--- gjavah.c	3 Jun 2004 18:48:28 -0000	1.116
+++ gjavah.c	11 Jul 2004 18:13:40 -0000
@@ -719,11 +719,10 @@
 
   fputs ("  ", out);
   if ((flags & ACC_STATIC))
-    fputs ("static ", out);
-
-  if ((flags & ACC_FINAL))
     {
-      if (current_field_value > 0)
+      fputs ("static ", out);
+
+      if ((flags & ACC_FINAL) && current_field_value > 0)
 	{
 	  char buffer[25];
 	  int done = 1;

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