This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Patch: FYI: PR java/10491


I'm checking this in on the trunk.

This fixes PR 10491.  In sum, we needed to generate a `friend'
declaration for inner classes.

Tom

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

	PR java/10491:
	* gjavah.c (HANDLE_INNERCLASSES_ATTRIBUTE): New macro.
	(handle_inner_classes): New function.

Index: gcc/java/gjavah.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/gjavah.c,v
retrieving revision 1.107
diff -u -r1.107 gjavah.c
--- gcc/java/gjavah.c 14 Apr 2003 04:42:21 -0000 1.107
+++ gcc/java/gjavah.c 3 May 2003 01:24:51 -0000
@@ -160,6 +160,8 @@
 static void jni_print_double (FILE *, jdouble);
 static void decompile_return_statement (FILE *, JCF *, int, int, int);
 
+static void handle_inner_classes (int);
+
 JCF_u2 current_field_name;
 JCF_u2 current_field_value;
 JCF_u2 current_field_signature;
@@ -241,6 +243,8 @@
   if (out && method_printed && !method_synthetic) 	\
     fputs (decompiled || stubs ? "\n" : ";\n", out);
 
+#define HANDLE_INNERCLASSES_ATTRIBUTE(COUNT) handle_inner_classes (COUNT)
+
 /* We're going to need {peek,skip}_attribute, enable their definition.   */
 #define NEED_PEEK_ATTRIBUTE
 #define NEED_SKIP_ATTRIBUTE
@@ -1672,6 +1676,34 @@
     *len = supername_length;
 
   return supername;
+}
+
+static void
+handle_inner_classes (int count)
+{
+  int i;
+
+  if (out && ! flag_jni && ! stubs && count > 0)
+    fprintf (out, "\n");
+
+  for (i = 0; i < count; ++i)
+    {
+      JCF_u2 inner_info_index = JCF_readu2 (current_jcf);
+
+      /* There are a few more values here, but we don't care about
+	 them.  The (void) cast is apparently the only way to avoid a
+	 warning here.  */
+      (void) JCF_readu2 (current_jcf);
+      (void) JCF_readu2 (current_jcf);
+      (void) JCF_readu2 (current_jcf);
+
+      if (out && ! flag_jni && ! stubs)
+	{
+	  print_mangled_classname (out, current_jcf, "  friend class ",
+				   inner_info_index);
+	  fprintf (out, ";\n");
+	}
+    }
 }
 
 


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