This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
(C++) patch to merge_functions
- To: egcs-patches at cygnus dot com
- Subject: (C++) patch to merge_functions
- From: Jason Merrill <jason at cygnus dot com>
- Date: Sat, 3 Oct 1998 22:47:53 -0700
Installed. This fixes g++.ns/using9.C.
1998-10-03 Jason Merrill <jason@yorick.cygnus.com>
* decl2.c (merge_functions): Remove duplicates.
Index: decl2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl2.c,v
retrieving revision 1.138
diff -c -p -r1.138 decl2.c
*** decl2.c 1998/10/03 15:46:48 1.138
--- decl2.c 1998/10/04 05:43:05
*************** add_using_namespace (user, used, indirec
*** 4118,4139 ****
add_using_namespace (TREE_PURPOSE (t), used, 1);
}
! /* Combines two sets of overloaded functions into an OVERLOAD chain.
! The first list becomes the tail of the result. */
static tree
merge_functions (s1, s2)
tree s1;
tree s2;
{
! if (TREE_CODE (s2) == OVERLOAD)
! while (s2)
! {
! s1 = build_overload (OVL_FUNCTION (s2), s1);
! s2 = OVL_CHAIN (s2);
! }
! else
! s1 = build_overload (s2, s1);
return s1;
}
--- 4127,4148 ----
add_using_namespace (TREE_PURPOSE (t), used, 1);
}
! /* Combines two sets of overloaded functions into an OVERLOAD chain, removing
! duplicates. The first list becomes the tail of the result.
+ The algorithm is O(n^2). */
+
static tree
merge_functions (s1, s2)
tree s1;
tree s2;
{
! for (; s2; s2 = OVL_NEXT (s2))
! {
! tree fn = OVL_CURRENT (s2);
! if (! ovl_member (fn, s1))
! s1 = build_overload (fn, s1);
! }
return s1;
}