re PR java/10491 (gcjh should make enclosing class a "friend" of inner classes)
authorTom Tromey <tromey@redhat.com>
Sat, 3 May 2003 02:29:26 +0000 (02:29 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Sat, 3 May 2003 02:29:26 +0000 (02:29 +0000)
PR java/10491:
* gjavah.c (HANDLE_INNERCLASSES_ATTRIBUTE): New macro.
(handle_inner_classes): New function.

From-SVN: r66416

gcc/java/ChangeLog
gcc/java/gjavah.c

index 02e5075be53d06be31398adfdef5fc5a2caf6555..5fa16b50538838147a94ef3b6b89081ed55a03d6 100644 (file)
@@ -1,3 +1,9 @@
+2003-05-02  Tom Tromey  <tromey@redhat.com>
+
+       PR java/10491:
+       * gjavah.c (HANDLE_INNERCLASSES_ATTRIBUTE): New macro.
+       (handle_inner_classes): New function.
+
 2003-05-01  Tom Tromey  <tromey@redhat.com>
 
        PR java/10459:
index 24c3933a05d07345598c7a70a579fbd2a61a36e4..80cccd12a98fe25274c8203ca5a3e2cacb2ad396 100644 (file)
@@ -160,6 +160,8 @@ static void jni_print_float (FILE *, jfloat);
 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 @@ static int decompiled = 0;
   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
@@ -1674,6 +1678,34 @@ super_class_name (JCF *derived_jcf, int *len)
   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");
+       }
+    }
+}
+
 \f
 
 /* We keep track of all the `#include's we generate, so we can avoid