[multiple changes]
authorAndrew Haley <aph@redhat.com>
Tue, 5 Oct 2004 14:55:39 +0000 (14:55 +0000)
committerAndrew Haley <aph@gcc.gnu.org>
Tue, 5 Oct 2004 14:55:39 +0000 (14:55 +0000)
2004-10-05  Andrew Haley  <aph@redhat.com>

PR java/17779
* jcf-parse.c (parse_zip_file_entries): If a class has a
superclass and a TYPE_SIZE of zero, lay it out.

2004-09-30  Andrew Haley  <aph@redhat.com>

PR java/17733
* jcf-parse.c (compute_class_name): Rewrite.

From-SVN: r88556

gcc/java/ChangeLog
gcc/java/jcf-parse.c

index 265f5930557ad8acb186db81039342cb7dbafb5d..5426a7f8feab92d3a98734f0bd582ed5751709a0 100644 (file)
@@ -1,3 +1,14 @@
+2004-10-05  Andrew Haley  <aph@redhat.com>
+
+       PR java/17779
+       * jcf-parse.c (parse_zip_file_entries): If a class has a
+       superclass and a TYPE_SIZE of zero, lay it out.
+
+2004-09-30  Andrew Haley  <aph@redhat.com>
+
+       PR java/17733
+       * jcf-parse.c (compute_class_name): Rewrite.
+
 2004-10-01  Jan Hubicka  <jh@suse.cz>
 
        * java.c (java_expand_body): Update call of tree_rest_of_compilation.
index 74f45de7a0b5874b96f64356b1f4933636d231be..32b9d5c3ab915ba23cde264aa1b2b11adfb57a18 100644 (file)
@@ -1229,13 +1229,22 @@ compute_class_name (struct ZipDirectory *zdir)
 {
   char *class_name_in_zip_dir = ZIPDIR_FILENAME (zdir);
   char *class_name;
-  int j;
+  int i;
+  int filename_length;
+
+  while (strncmp (class_name_in_zip_dir, "./", 2) == 0)
+    class_name_in_zip_dir += 2;
+
+  filename_length = (strlen (class_name_in_zip_dir)
+                    - strlen (".class"));
+  class_name = ALLOC (filename_length + 1);
+  memcpy (class_name, class_name_in_zip_dir, filename_length);
+  class_name [filename_length] = '\0';
+
+  for (i = 0; i < filename_length; i++)
+    if (class_name[i] == '/')
+      class_name[i] = '.';
 
-  class_name = ALLOC (zdir->filename_length + 1 - 6);
-  strncpy (class_name, class_name_in_zip_dir, zdir->filename_length - 6);
-  class_name [zdir->filename_length - 6] = '\0';
-  for (j = 0; class_name[j]; ++j)
-    class_name[j] = class_name[j] == '/' ? '.' : class_name[j];
   return class_name;
 }
 
@@ -1289,6 +1298,19 @@ parse_zip_file_entries (void)
            current_jcf = TYPE_JCF (class);
            output_class = current_class = class;
 
+           /* This is for a corner case where we have a superclass
+              but no superclass fields.  
+
+              This can happen if we earlier failed to lay out this
+              class because its superclass was still in the process
+              of being laid out; this occurs when we have recursive
+              class dependencies via inner classes.  Setting
+              TYPE_SIZE to null here causes CLASS_LOADED_P to return
+              false, so layout_class() will be called again.  */
+           if (TYPE_SIZE (class) && CLASSTYPE_SUPER (class)
+               && integer_zerop (TYPE_SIZE (class)))
+             TYPE_SIZE (class) = NULL_TREE;
+
            if (! CLASS_LOADED_P (class))
              {
                if (! CLASS_PARSED_P (class))