From 5789147ff0eacd8165a6835b51488502e27ebc93 Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Tue, 5 Oct 2004 14:55:39 +0000 Subject: [multiple changes] 2004-10-05 Andrew Haley 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 PR java/17733 * jcf-parse.c (compute_class_name): Rewrite. From-SVN: r88556 --- gcc/java/ChangeLog | 11 +++++++++++ gcc/java/jcf-parse.c | 34 ++++++++++++++++++++++++++++------ 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 265f593..5426a7f 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,14 @@ +2004-10-05 Andrew Haley + + 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 + + PR java/17733 + * jcf-parse.c (compute_class_name): Rewrite. + 2004-10-01 Jan Hubicka * java.c (java_expand_body): Update call of tree_rest_of_compilation. diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index 74f45de..32b9d5c 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -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)) -- cgit v1.1