diff options
author | Bryce McKinlay <mckinlay@redhat.com> | 2005-03-17 15:54:20 +0000 |
---|---|---|
committer | Bryce McKinlay <bryce@gcc.gnu.org> | 2005-03-17 15:54:20 +0000 |
commit | 3af57c7014744020c768338e74431d1d409ca381 (patch) | |
tree | e2a412dbb1e86a66aba1a30769a3661f7e2f86ff /gcc/java | |
parent | 5463c726ebbd69bf08fa0d8d98e1f31781c1eaa7 (diff) | |
download | gcc-3af57c7014744020c768338e74431d1d409ca381.zip gcc-3af57c7014744020c768338e74431d1d409ca381.tar.gz gcc-3af57c7014744020c768338e74431d1d409ca381.tar.bz2 |
re PR java/20502 (gcj failure if .jar contains same .class twice)
2005-03-17 Bryce McKinlay <mckinlay@redhat.com>
PR java/20502
* jcf-parse.c (duplicate_class_warning): New function.
(java_parse_file): Call duplicate_class_warning if
CLASS_FROM_CURRENTLY_COMPILED_P is already set.
(parse_zip_file_entries): Likewise. Also set
CLASS_FROM_CURRENTLY_COMPILED_P.
From-SVN: r96617
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/java/jcf-parse.c | 47 |
2 files changed, 39 insertions, 17 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 38edfef..cd374a2 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,12 @@ +2005-03-17 Bryce McKinlay <mckinlay@redhat.com> + + PR java/20502 + * jcf-parse.c (duplicate_class_warning): New function. + (java_parse_file): Call duplicate_class_warning if + CLASS_FROM_CURRENTLY_COMPILED_P is already set. + (parse_zip_file_entries): Likewise. Also set + CLASS_FROM_CURRENTLY_COMPILED_P. + 2005-03-16 Andrew Haley <aph@redhat.com> * expr.c (expand_java_arrayload): Don't generate a diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index 3a4c780..2af480d 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -823,6 +823,20 @@ load_inner_classes (tree cur_class) } static void +duplicate_class_warning (const char *filename) +{ + location_t warn_loc; +#ifdef USE_MAPPED_LOCATION + linemap_add (&line_table, LC_RENAME, 0, filename, 0); + warn_loc = linemap_line_start (&line_table, 0, 1); +#else + warn_loc.file = filename; + warn_loc.line = 0; +#endif + warning ("%Hduplicate class will only be compiled once", &warn_loc); +} + +static void parse_class_file (void) { tree method; @@ -1124,19 +1138,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED) /* Exclude file that we see twice on the command line. */ if (IS_A_COMMAND_LINE_FILENAME_P (node)) - { - location_t warn_loc; -#ifdef USE_MAPPED_LOCATION - linemap_add (&line_table, LC_RENAME, 0, - IDENTIFIER_POINTER (node), 0); - warn_loc = linemap_line_start (&line_table, 0, 1); -#else - warn_loc.file = IDENTIFIER_POINTER (node); - warn_loc.line = 0; -#endif - warning ("%Hsource file seen twice on command line and " - "will be compiled only once", &warn_loc); - } + duplicate_class_warning (IDENTIFIER_POINTER (node)); else { tree file_decl = build_decl (TRANSLATION_UNIT_DECL, node, NULL); @@ -1214,6 +1216,12 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED) jcf_parse (current_jcf); DECL_SOURCE_LOCATION (node) = file_start_location; TYPE_JCF (current_class) = current_jcf; + if (CLASS_FROM_CURRENTLY_COMPILED_P (current_class)) + { + /* We've already compiled this class. */ + duplicate_class_warning (filename); + continue; + } CLASS_FROM_CURRENTLY_COMPILED_P (current_class) = 1; TREE_TYPE (node) = current_class; } @@ -1236,10 +1244,6 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED) linemap_add (&line_table, LC_LEAVE, false, NULL, 0); #endif parse_zip_file_entries (); - /* - for (each entry) - CLASS_FROM_CURRENTLY_COMPILED_P (current_class) = 1; - */ } else { @@ -1383,6 +1387,15 @@ parse_zip_file_entries (void) current_jcf = TYPE_JCF (class); output_class = current_class = class; + if (CLASS_FROM_CURRENTLY_COMPILED_P (current_class)) + { + /* We've already compiled this class. */ + duplicate_class_warning (current_jcf->filename); + break; + } + + CLASS_FROM_CURRENTLY_COMPILED_P (current_class) = 1; + if (TYPE_DUMMY (class)) { /* This is a dummy class, and now we're compiling it |