summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
authorrmathew <rmathew@138bc75d-0d04-0410-961f-82ee72b054a4>2004-06-17 13:45:23 +0000
committerrmathew <rmathew@138bc75d-0d04-0410-961f-82ee72b054a4>2004-06-17 13:45:23 +0000
commitf1d4bfad011aea70822d967d4b6cfa4deab7bbbc (patch)
treee9e1192174fd464acc4c3c8b496859d2d296a690 /gcc
parent383bf9878a07b8fdc191b5adb4f00b7f458064af (diff)
downloadppe42-gcc-f1d4bfad011aea70822d967d4b6cfa4deab7bbbc.tar.gz
ppe42-gcc-f1d4bfad011aea70822d967d4b6cfa4deab7bbbc.zip
Fixes PR java/13948
* parse.y (java_layout_seen_class_methods): Ensure class is loaded before trying to lay out its methods. * jcf-parse.c (read_class): Track parsed files using canonical paths obtained via lrealpath from libiberty. (java_parse_file): Likewise. (parse_source_file_1): Rename formal parameter to reflect its modified purpose. Minor formatting fix. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83292 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/java/ChangeLog11
-rw-r--r--gcc/java/jcf-parse.c34
-rw-r--r--gcc/java/parse.y17
3 files changed, 48 insertions, 14 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index b1427523068..3c2b1a2cf18 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,14 @@
+2004-06-17 Ranjit Mathew <rmathew@hotmail.com>
+
+ Fixes PR java/13948
+ * parse.y (java_layout_seen_class_methods): Ensure class is loaded
+ before trying to lay out its methods.
+ * jcf-parse.c (read_class): Track parsed files using canonical paths
+ obtained via lrealpath from libiberty.
+ (java_parse_file): Likewise.
+ (parse_source_file_1): Rename formal parameter to reflect its
+ modified purpose. Minor formatting fix.
+
2004-06-15 Paolo Bonzini <bonzini@gnu.org>
* class.c (emit_register_classes): Make the function uninlinable,
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index a44e860a242..c948a1ab9da 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -494,27 +494,33 @@ read_class (tree name)
if (current_jcf->java_source)
{
const char *filename = current_jcf->filename;
- tree file;
+ tree given_file, real_file;
FILE *finput;
int generate;
java_parser_context_save_global ();
java_push_parser_context ();
- BUILD_FILENAME_IDENTIFIER_NODE (file, filename);
- generate = IS_A_COMMAND_LINE_FILENAME_P (file);
+
+ BUILD_FILENAME_IDENTIFIER_NODE (given_file, filename);
+ real_file = get_identifier (lrealpath (filename));
+
+ generate = IS_A_COMMAND_LINE_FILENAME_P (given_file);
if (wfl_operator == NULL_TREE)
wfl_operator = build_expr_wfl (NULL_TREE, NULL, 0, 0);
- EXPR_WFL_FILENAME_NODE (wfl_operator) = file;
+ EXPR_WFL_FILENAME_NODE (wfl_operator) = given_file;
input_filename = ggc_strdup (filename);
output_class = current_class = NULL_TREE;
current_function_decl = NULL_TREE;
- if (!HAS_BEEN_ALREADY_PARSED_P (file))
+
+ if (! HAS_BEEN_ALREADY_PARSED_P (real_file))
{
- if (!(finput = fopen (input_filename, "r")))
+ if (! (finput = fopen (input_filename, "r")))
fatal_error ("can't reopen %s: %m", input_filename);
- parse_source_file_1 (file, finput);
+
+ parse_source_file_1 (real_file, finput);
parse_source_file_2 ();
parse_source_file_3 ();
+
if (fclose (finput))
fatal_error ("can't close %s: %m", input_filename);
}
@@ -798,11 +804,12 @@ parse_class_file (void)
/* Parse a source file, as pointed by the current value of INPUT_FILENAME. */
static void
-parse_source_file_1 (tree file, FILE *finput)
+parse_source_file_1 (tree real_file, FILE *finput)
{
int save_error_count = java_error_count;
- /* Mark the file as parsed */
- HAS_BEEN_ALREADY_PARSED_P (file) = 1;
+
+ /* Mark the file as parsed. */
+ HAS_BEEN_ALREADY_PARSED_P (real_file) = 1;
jcf_dependency_add_file (input_filename, 0);
@@ -1015,9 +1022,11 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
unsigned char magic_string[4];
uint32 magic = 0;
tree name = TREE_VALUE (node);
+ tree real_file;
/* Skip already parsed files */
- if (HAS_BEEN_ALREADY_PARSED_P (name))
+ real_file = get_identifier (lrealpath (IDENTIFIER_POINTER (name)));
+ if (HAS_BEEN_ALREADY_PARSED_P (real_file))
continue;
/* Close previous descriptor, if any */
@@ -1075,7 +1084,8 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
JAVA_FILE_P (node) = 1;
java_push_parser_context ();
java_parser_context_save_global ();
- parse_source_file_1 (name, finput);
+
+ parse_source_file_1 (real_file, finput);
java_parser_context_restore_global ();
java_pop_parser_context (1);
}
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index 65bd09186ee..dd52a39359d 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -7574,7 +7574,10 @@ add_stmt_to_block (tree b, tree type, tree stmt)
return c;
}
-void java_layout_seen_class_methods (void)
+/* Lays out the methods for the classes seen so far. */
+
+void
+java_layout_seen_class_methods (void)
{
tree previous_list = all_class_list;
tree end = NULL_TREE;
@@ -7584,7 +7587,17 @@ void java_layout_seen_class_methods (void)
{
for (current = previous_list;
current != end; current = TREE_CHAIN (current))
- layout_class_methods (TREE_TYPE (TREE_VALUE (current)));
+ {
+ tree cls = TREE_TYPE (TREE_VALUE (current));
+
+ if (! CLASS_LOADED_P (cls))
+ load_class (cls, 0);
+
+ layout_class_methods (cls);
+ }
+
+ /* Note that new classes might have been added while laying out
+ methods, changing the value of all_class_list. */
if (previous_list != all_class_list)
{
OpenPOWER on IntegriCloud