From: Martin v. Löwis Date: Mon, 25 Jan 1999 16:09:05 +0000 (+0000) Subject: tree.c (equal_functions): New function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=89ae2c8c42affa24d6630e80558841968eb8f2b9;p=gcc.git tree.c (equal_functions): New function. * tree.c (equal_functions): New function. (ovl_member): Call it. From-SVN: r24861 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 443c5de67e3..95e47671489 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +1999-01-25 Martin von Löwis + + * tree.c (equal_functions): New function. + (ovl_member): Call it. + 1999-01-24 Jason Merrill * cvt.c (cp_convert_to_pointer): Fix conversion of 0 to pmf. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 656cc52d036..d318d1be988 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -41,6 +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)); #define CEIL(x,y) (((x) + (y) - 1) / (y)) @@ -1395,6 +1396,20 @@ build_overload (decl, chain) return ovl_cons (decl, chain); } +/* Returns true iff functions are equivalent. Equivalent functions are + not identical only if one is a function-local extern function. + This assumes that function-locals don't have TREE_PERMANENT. */ + +static int +equal_functions (fn1, fn2) + tree fn1; + tree fn2; +{ + if (!TREE_PERMANENT (fn1) || !TREE_PERMANENT (fn2)) + return decls_match (fn1, fn2); + return fn1 == fn2; +} + /* True if fn is in ovl. */ int @@ -1405,9 +1420,9 @@ ovl_member (fn, ovl) if (ovl == NULL_TREE) return 0; if (TREE_CODE (ovl) != OVERLOAD) - return decls_match (ovl, fn); + return equal_functions (ovl, fn); for (; ovl; ovl = OVL_CHAIN (ovl)) - if (decls_match (OVL_FUNCTION (ovl), fn)) + if (equal_functions (OVL_FUNCTION (ovl), fn)) return 1; return 0; }