This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: (C++) Patch for local using-decls
- To: egcs-patches at cygnus dot com
- Subject: Re: (C++) Patch for local using-decls
- From: Jason Merrill <jason at cygnus dot com>
- Date: 26 Jan 1999 02:34:51 -0800
- References: <199901260850.AAA26538@yorick.cygnus.com>
OK, that patch broke templates. Take 2:
1999-01-26 Jason Merrill <jason@yorick.cygnus.com>
* 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.
Index: cp-tree.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/cp-tree.h,v
retrieving revision 1.190
diff -c -p -r1.190 cp-tree.h
*** cp-tree.h 1999/01/21 21:16:17 1.190
--- cp-tree.h 1999/01/26 10:33:21
*************** extern void revert_static_member_fn
*** 2822,2828 ****
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_class_binding PROTO((tree, tree));
extern tree check_default_argument PROTO((tree, tree));
extern tree push_overloaded_decl PROTO((tree, int));
--- 2822,2828 ----
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, 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));
Index: decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.303
diff -c -p -r1.303 decl.c
*** decl.c 1999/01/26 00:50:27 1.303
--- decl.c 1999/01/26 10:33:22
*************** add_binding (id, decl)
*** 1117,1128 ****
}
}
! /* Bind DECL to ID in the current_binding_level. */
void
! push_local_binding (id, decl)
tree id;
tree decl;
{
tree d = decl;
--- 1117,1131 ----
}
}
! /* 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, flags)
tree id;
tree decl;
+ int flags;
{
tree d = decl;
*************** push_local_binding (id, decl)
*** 1133,1140 ****
/* Create a new binding. */
push_binding (id, d, current_binding_level);
! if (TREE_CODE (decl) == OVERLOAD
! || (DECL_P (decl) && DECL_NAMESPACE_SCOPE_P (decl)))
/* 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. */
--- 1136,1142 ----
/* Create a new binding. */
push_binding (id, d, current_binding_level);
! 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. */
*************** poplevel (keep, reverse, functionbody)
*** 1425,1436 ****
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);
else
my_friendly_abort (0);
}
--- 1427,1439 ----
else
{
/* Remove the binding. */
! 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);
}
*************** pushdecl (x)
*** 3798,3804 ****
if (need_new_binding)
{
! push_local_binding (name, x);
/* 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. */
--- 3801,3807 ----
if (need_new_binding)
{
! 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. */
*************** push_overloaded_decl (decl, flags)
*** 4296,4302 ****
}
/* Install the new binding. */
! push_local_binding (name, new_binding);
}
return decl;
--- 4299,4305 ----
}
/* Install the new binding. */
! push_local_binding (name, new_binding, flags);
}
return decl;
Index: decl2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl2.c,v
retrieving revision 1.175
diff -c -p -r1.175 decl2.c
*** decl2.c 1999/01/24 00:59:21 1.175
--- decl2.c 1999/01/26 10:33:22
*************** do_local_using_decl (decl)
*** 4900,4906 ****
PUSH_LOCAL | PUSH_USING);
}
else
! push_local_binding (name, newval);
}
if (newtype)
set_identifier_type_value (name, newtype);
--- 4900,4906 ----
PUSH_LOCAL | PUSH_USING);
}
else
! push_local_binding (name, newval, PUSH_USING);
}
if (newtype)
set_identifier_type_value (name, newtype);