From ed7f23690a8c1cf8295cf151719d7b07f7b68bce Mon Sep 17 00:00:00 2001 From: Bryce McKinlay Date: Sat, 26 Jun 2004 20:40:31 +0000 Subject: [PATCH] PR java/1207, java/16178 PR java/1207, java/16178 * jcf-parse.c (load_class): Return immediately if passed a type decl where CLASS_FROM_SOURCE_P is set. Remove FIXME. * parse.y (do_resolve_class): Remove checks for CLASS_FROM_SOURCE_P before calling load_class. (qualify_and_find): Likewise. (find_in_imports_on_demand): Likewise. (find_applicable_accessible_methods_list): Likewise. Co-Authored-By: Ranjit Mathew From-SVN: r83719 --- gcc/java/ChangeLog | 17 +++++++++++++++++ gcc/java/jcf-parse.c | 11 ++++++----- gcc/java/parse.y | 11 ++++------- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 63a23ebf799..9ed01a6fc15 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,20 @@ +2004-06-26 Bryce McKinlay + Ranjit Mathew + + PR java/1207, java/16178 + * jcf-parse.c (load_class): Return immediately if passed a type decl + where CLASS_FROM_SOURCE_P is set. Remove FIXME. + * parse.y (do_resolve_class): Remove checks for CLASS_FROM_SOURCE_P + before calling load_class. + (qualify_and_find): Likewise. + (find_in_imports_on_demand): Likewise. + (find_applicable_accessible_methods_list): Likewise. + +2004-06-24 Bryce McKinlay + + * parse.y (java_layout_seen_class_methods): Don't call load_class + on class defined by source parser. + 2004-06-23 Bryce McKinlay * parse.y (set_nested_class_simple_name_value): Removed. diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index c948a1ab9da..42c3df3fc32 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -562,10 +562,6 @@ read_class (tree name) /* Load CLASS_OR_NAME. CLASS_OR_NAME can be a mere identifier if called from the parser, otherwise it's a RECORD_TYPE node. If VERBOSE is 1, print error message on failure to load a class. */ - -/* Replace calls to load_class by having callers call read_class directly - - and then perhaps rename read_class to load_class. FIXME */ - void load_class (tree class_or_name, int verbose) { @@ -581,7 +577,12 @@ load_class (tree class_or_name, int verbose) name = TYPE_NAME (TREE_PURPOSE (class_or_name)); /* Or it's a type in the making */ else - name = DECL_NAME (TYPE_NAME (class_or_name)); + { + /* If the class is from source code, then it must already be loaded. */ + if (CLASS_FROM_SOURCE_P (class_or_name)) + return; + name = DECL_NAME (TYPE_NAME (class_or_name)); + } saved = name; while (1) diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 8cd4f008cf4..5b8a3039f68 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -5796,8 +5796,7 @@ do_resolve_class (tree enclosing, tree class_type, tree decl, tree cl) /* 2- And check for the type in the current compilation unit */ if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)))) { - if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) && - !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl))) + if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl))) load_class (TYPE_NAME (class_type), 0); return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); } @@ -5891,8 +5890,7 @@ qualify_and_find (tree class_type, tree package, tree name) load_class (new_qualified, 0); if ((new_class_decl = IDENTIFIER_CLASS_VALUE (new_qualified))) { - if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) && - !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl))) + if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl))) load_class (new_qualified, 0); TYPE_NAME (class_type) = new_qualified; return IDENTIFIER_CLASS_VALUE (new_qualified); @@ -7044,8 +7042,7 @@ find_in_imports_on_demand (tree enclosing_type, tree class_type) access_check = -1; /* If there is no DECL set for the class or if the class isn't loaded and not seen in source yet, then load */ - if (!decl || (!CLASS_LOADED_P (TREE_TYPE (decl)) - && !CLASS_FROM_SOURCE_P (TREE_TYPE (decl)))) + if (!decl || ! CLASS_LOADED_P (TREE_TYPE (decl))) { load_class (node, 0); decl = IDENTIFIER_CLASS_VALUE (node); @@ -11014,7 +11011,7 @@ find_applicable_accessible_methods_list (int lc, tree class, tree name, search_not_done++; *htab_find_slot (searched_classes, class, INSERT) = class; - if (!CLASS_LOADED_P (class) && !CLASS_FROM_SOURCE_P (class)) + if (!CLASS_LOADED_P (class)) { load_class (class, 1); safe_layout_class (class); -- 2.30.2