From: Andrew Pinski Date: Mon, 10 May 2004 15:08:07 +0000 (+0000) Subject: parse.y (check_pkg_class_access): Add new argument and use it when cl is NULL to... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7cef5027e19c7e27d9ffc448fc8a775667a8df32;p=gcc.git parse.y (check_pkg_class_access): Add new argument and use it when cl is NULL to call lookup_cl on it. 2004-05-10 Andrew Pinski * parse.y (check_pkg_class_access): Add new argument and use it when cl is NULL to call lookup_cl on it. (parser_check_super_interface): Do not call lookup_cl. Pass this_decl to check_pkg_class_access and NULL instead of lookup_cl. (parser_check_super): Update for change in check_pkg_class_access. (do_resolve_class): Likewise. (process_imports): Likewise. (find_in_imports_on_demand): Likewise. (resolve_qualified_expression_name): Likewise. From-SVN: r81668 --- diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 13f3540192b..683fa60662e 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,17 @@ +2004-05-10 Andrew Pinski + + * parse.y (check_pkg_class_access): Add new argument + and use it when cl is NULL to call lookup_cl on it. + (parser_check_super_interface): Do not call lookup_cl. + Pass this_decl to check_pkg_class_access and NULL + instead of lookup_cl. + (parser_check_super): Update for change in + check_pkg_class_access. + (do_resolve_class): Likewise. + (process_imports): Likewise. + (find_in_imports_on_demand): Likewise. + (resolve_qualified_expression_name): Likewise. + 2004-05-06 Ranjit Mathew Fixes PR java/9685, PR java/15073 diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 20b874e8abf..0649dbe6de1 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -107,7 +107,7 @@ static void read_import_dir (tree); static int find_in_imports_on_demand (tree, tree); static void find_in_imports (tree, tree); static void check_inner_class_access (tree, tree, tree); -static int check_pkg_class_access (tree, tree, bool); +static int check_pkg_class_access (tree, tree, bool, tree); static void register_package (tree); static tree resolve_package (tree, tree *, tree *); static tree resolve_class (tree, tree, tree, tree); @@ -5079,7 +5079,7 @@ parser_check_super_interface (tree super_decl, tree this_decl, tree this_wfl) access rules (6.6.1). */ if (! INNER_CLASS_P (super_type) && check_pkg_class_access (DECL_NAME (super_decl), - lookup_cl (this_decl), true)) + NULL_TREE, true, this_decl)) return 1; SOURCE_FRONTEND_DEBUG (("Completing interface %s with %s", @@ -5117,7 +5117,7 @@ parser_check_super (tree super_decl, tree this_decl, tree wfl) /* Check top-level class scope. Inner classes are subject to member access rules (6.6.1). */ if (! INNER_CLASS_P (super_type) - && (check_pkg_class_access (DECL_NAME (super_decl), wfl, true))) + && (check_pkg_class_access (DECL_NAME (super_decl), wfl, true, NULL_TREE))) return 1; SOURCE_FRONTEND_DEBUG (("Completing class %s with %s", @@ -5857,7 +5857,7 @@ do_resolve_class (tree enclosing, tree class_type, tree decl, tree cl) by the caller. */ if (cl) { - if (check_pkg_class_access (TYPE_NAME (class_type), cl, true)) + if (check_pkg_class_access (TYPE_NAME (class_type), cl, true, NULL_TREE)) return NULL_TREE; } @@ -6817,7 +6817,7 @@ process_imports (void) QUALIFIED_P (to_be_found) = 1; load_class (to_be_found, 0); error_found = - check_pkg_class_access (to_be_found, TREE_PURPOSE (import), true); + check_pkg_class_access (to_be_found, TREE_PURPOSE (import), true, NULL_TREE); /* We found it, we can bail out */ if (IDENTIFIER_CLASS_VALUE (to_be_found)) @@ -7061,7 +7061,7 @@ find_in_imports_on_demand (tree enclosing_type, tree class_type) } if (decl && ! INNER_CLASS_P (TREE_TYPE (decl))) access_check = check_pkg_class_access (node, TREE_PURPOSE (import), - false); + false, NULL_TREE); else /* 6.6.1: Inner classes are subject to member access rules. */ access_check = 0; @@ -7247,10 +7247,11 @@ check_inner_class_access (tree decl, tree enclosing_decl, tree cl) /* Accessibility check for top-level classes. If CLASS_NAME is in a foreign package, it must be PUBLIC. Return 0 if no access violations were found, 1 otherwise. If VERBOSE is true and an error - was found, it is reported and accounted for. */ + was found, it is reported and accounted for. If CL is NULL then + look it up with THIS_DECL. */ static int -check_pkg_class_access (tree class_name, tree cl, bool verbose) +check_pkg_class_access (tree class_name, tree cl, bool verbose, tree this_decl) { tree type; @@ -7275,7 +7276,8 @@ check_pkg_class_access (tree class_name, tree cl, bool verbose) if (verbose) parse_error_context - (cl, "Can't access %s `%s'. Only public classes and interfaces in other packages can be accessed", + (cl == NULL ? lookup_cl (this_decl): cl, + "Can't access %s `%s'. Only public classes and interfaces in other packages can be accessed", (CLASS_INTERFACE (TYPE_NAME (type)) ? "interface" : "class"), IDENTIFIER_POINTER (class_name)); return 1; @@ -9836,7 +9838,7 @@ resolve_qualified_expression_name (tree wfl, tree *found_decl, tree list; *where_found = decl; - check_pkg_class_access (DECL_NAME (decl), qual_wfl, true); + check_pkg_class_access (DECL_NAME (decl), qual_wfl, true, NULL); /* We want to be absolutely sure that the class is laid out. We're going to search something inside it. */ @@ -9888,7 +9890,7 @@ resolve_qualified_expression_name (tree wfl, tree *found_decl, return 1; } - check_pkg_class_access (DECL_NAME (decl), qual_wfl, true); + check_pkg_class_access (DECL_NAME (decl), qual_wfl, true, NULL); check_deprecation (qual_wfl, decl);