OSDN Git Service

2004-10-05 Andrew Haley <aph@redhat.com>
authoraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Oct 2004 14:55:39 +0000 (14:55 +0000)
committeraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Oct 2004 14:55:39 +0000 (14:55 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88556 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 265f593..5426a7f 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 74f45de..32b9d5c 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))