diff options
author | Jason Merrill <jason@casey.cygnus.com> | 2000-02-18 22:42:07 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2000-02-18 17:42:07 -0500 |
commit | 1f51a99218e6eb4214e6a40e9937a7cc419f1e95 (patch) | |
tree | 684bc3c3537e59eeb5cfab653c80b41fd9a188bf /gcc/cp/semantics.c | |
parent | 6d1e16d74e7d55c8a0d38076850356f9e83951ab (diff) | |
download | gcc-1f51a99218e6eb4214e6a40e9937a7cc419f1e95.zip gcc-1f51a99218e6eb4214e6a40e9937a7cc419f1e95.tar.gz gcc-1f51a99218e6eb4214e6a40e9937a7cc419f1e95.tar.bz2 |
semantics.c (deferred_type_access_control): Walk the entire type_lookups list.
* semantics.c (deferred_type_access_control): Walk the entire
type_lookups list.
(save_type_access_control): Rename from
initial_deferred_type_access_control. Just remember the value.
(decl_type_access_control): New fn.
(begin_function_definition): Use deferred_type_access_control, after
we've started the function. Set type_lookups to error_mark_node.
* parse.y (frob_specs, fn.def1): Adjust.
(parse_decl0, parse_field, parse_field0, parse_bitfield): New fns.
(parse_end_decl, parse_bitfield0, parse_method): New fns.
(fn.def2, initdcl, initdcl0_innards, nomods_initdcl0): Use them.
(after_type_component_declarator0): Likewise.
(after_type_component_declarator): Likewise.
(notype_component_declarator): Likewise.
* cp-tree.h: Adjust.
* decl.c (redeclaration_error_message): Allow redeclaration of
namespace-scope decls.
From-SVN: r32059
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index cabe49a..a721362 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1695,10 +1695,10 @@ static tree current_type_lookups; /* Perform deferred access control for types used in the type of a declaration. */ -void +static void deferred_type_access_control () { - tree lookup = current_type_lookups; + tree lookup = type_lookups; if (lookup == error_mark_node) return; @@ -1707,46 +1707,56 @@ deferred_type_access_control () enforce_access (TREE_PURPOSE (lookup), TREE_VALUE (lookup)); } -/* Perform deferred access control for types used in the type of a - declaration. Called for the first declarator in a declaration. */ - void -initial_deferred_type_access_control (lookups) - tree lookups; +decl_type_access_control (decl) + tree decl; { - tree lookup = type_lookups; + tree save_fn; - /* First perform the checks for the current declarator; they will have - been added to type_lookups since typed_declspecs saved the copy that - we have been passed. */ - if (lookup != error_mark_node) - for (; lookup != lookups; lookup = TREE_CHAIN (lookup)) - enforce_access (TREE_PURPOSE (lookup), TREE_VALUE (lookup)); + if (type_lookups == error_mark_node) + return; + + save_fn = current_function_decl; + + if (decl && TREE_CODE (decl) == FUNCTION_DECL) + current_function_decl = decl; - current_type_lookups = lookups; - type_lookups = error_mark_node; deferred_type_access_control (); -} + + current_function_decl = save_fn; + + /* Now strip away the checks for the current declarator; they were + added to type_lookups after typed_declspecs saved the copy that + ended up in current_type_lookups. */ + type_lookups = current_type_lookups; +} + +void +save_type_access_control (lookups) + tree lookups; +{ + current_type_lookups = lookups; +} /* Begin a function definition declared with DECL_SPECS and DECLARATOR. Returns non-zero if the function-declaration is legal. */ int -begin_function_definition (decl_specs, lookups, declarator) +begin_function_definition (decl_specs, declarator) tree decl_specs; - tree lookups; tree declarator; { tree specs; tree attrs; - initial_deferred_type_access_control (lookups); - split_specs_attrs (decl_specs, &specs, &attrs); if (!start_function (specs, declarator, attrs, SF_DEFAULT)) return 0; - + + deferred_type_access_control (); + type_lookups = error_mark_node; + reinit_parse_for_function (); /* The things we're about to see are not directly qualified by any template headers we've seen thus far. */ |