diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 2 | ||||
-rw-r--r-- | gcc/cp/decl.c | 27 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 2 | ||||
-rw-r--r-- | gcc/cp/tree.c | 2 |
5 files changed, 26 insertions, 15 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8015d38..edffd63 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,13 @@ 1999-01-26 Jason Merrill <jason@yorick.cygnus.com> + * tree.c (equal_functions): Fix name in prototype. + + * decl.c (push_local_binding): Add FLAGS argument. + (pushdecl, push_overloaded_decl): Pass it. + * decl2.c (do_local_using_decl): Likewise. + * cp-tree.h: Adjust prototype. + * decl.c (poplevel): Fix logic. + * decl.c (push_local_binding): Also wrap used decls in a TREE_LIST. (poplevel): Handle that. Fix logic for removing TREE_LISTs. (cat_namespace_levels): Don't loop forever. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index e26a910..534fadc 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -2822,7 +2822,7 @@ extern void revert_static_member_fn PROTO((tree*, tree*, tree*)); extern void cat_namespace_levels PROTO((void)); extern void fixup_anonymous_union PROTO((tree)); extern int check_static_variable_definition PROTO((tree, tree)); -extern void push_local_binding PROTO((tree, tree)); +extern void push_local_binding PROTO((tree, tree, int)); extern void push_class_binding PROTO((tree, tree)); extern tree check_default_argument PROTO((tree, tree)); extern tree push_overloaded_decl PROTO((tree, int)); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e3ed116..4011581 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1117,12 +1117,15 @@ add_binding (id, decl) } } -/* Bind DECL to ID in the current_binding_level. */ +/* Bind DECL to ID in the current_binding_level. + If PUSH_USING is set in FLAGS, we know that DECL doesn't really belong + to this binding level, that it got here through a using-declaration. */ void -push_local_binding (id, decl) +push_local_binding (id, decl, flags) tree id; tree decl; + int flags; { tree d = decl; @@ -1133,8 +1136,7 @@ push_local_binding (id, decl) /* Create a new binding. */ push_binding (id, d, current_binding_level); - if (TREE_CODE (decl) == OVERLOAD - || (DECL_P (decl) && DECL_NAMESPACE_SCOPE_P (decl))) + if (TREE_CODE (decl) == OVERLOAD || (flags & PUSH_USING)) /* We must put the OVERLOAD into a TREE_LIST since the TREE_CHAIN of an OVERLOAD is already used. Similarly for decls that got here through a using-declaration. */ @@ -1425,12 +1427,13 @@ poplevel (keep, reverse, functionbody) else { /* Remove the binding. */ - if (TREE_CODE (link) == TREE_LIST) - link = TREE_VALUE (link); - if (TREE_CODE_CLASS (TREE_CODE (link)) == 'd') - pop_binding (DECL_NAME (link), link); - else if (TREE_CODE (link) == OVERLOAD) - pop_binding (DECL_NAME (OVL_FUNCTION (link)), link); + decl = link; + if (TREE_CODE (decl) == TREE_LIST) + decl = TREE_VALUE (decl); + if (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd') + pop_binding (DECL_NAME (decl), decl); + else if (TREE_CODE (decl) == OVERLOAD) + pop_binding (DECL_NAME (OVL_FUNCTION (decl)), decl); else my_friendly_abort (0); } @@ -3798,7 +3801,7 @@ pushdecl (x) if (need_new_binding) { - push_local_binding (name, x); + push_local_binding (name, x, 0); /* Because push_local_binding will hook X on to the current_binding_level's name list, we don't want to do that again below. */ @@ -4296,7 +4299,7 @@ push_overloaded_decl (decl, flags) } /* Install the new binding. */ - push_local_binding (name, new_binding); + push_local_binding (name, new_binding, flags); } return decl; diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 867cf96..5c1cb4c 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -4900,7 +4900,7 @@ do_local_using_decl (decl) PUSH_LOCAL | PUSH_USING); } else - push_local_binding (name, newval); + push_local_binding (name, newval, PUSH_USING); } if (newtype) set_identifier_type_value (name, newtype); diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index d318d1b..3e5048f 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -41,7 +41,7 @@ static tree list_hash_lookup PROTO((int, int, int, int, tree, tree, static void propagate_binfo_offsets PROTO((tree, tree)); static int avoid_overlap PROTO((tree, tree)); static int lvalue_p_1 PROTO((tree, int)); -static int equal_function PROTO((tree, tree)); +static int equal_functions PROTO((tree, tree)); #define CEIL(x,y) (((x) + (y) - 1) / (y)) |