From 1e823712b2101c0fbbff4f3e0abcfc7fab2303eb Mon Sep 17 00:00:00 2001 From: Jeffrey A Law Date: Sat, 20 Feb 1999 14:13:36 +0000 Subject: [PATCH] tree.c (equal_functions): New function. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 1999-01-25 Martin von L�wis * tree.c (equal_functions): New function. (ovl_member): Call it. From-SVN: r25338 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/tree.c | 19 +++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7be1a540751d..49d5611bae91 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +Sat Feb 20 15:08:42 1999 Jeffrey A Law (law@cygnus.com) + + 1999-01-25 Martin von Löwis + * tree.c (equal_functions): New function. + (ovl_member): Call it. + Sat Feb 6 17:00:48 1999 Jeffrey A Law (law@cygnus.com) * typeck2.c: Update email addresses. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index dce01cb6724f..7c7768fdefc7 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -47,6 +47,7 @@ static tree list_hash_lookup PROTO((int, int, int, int, tree, tree, static void propagate_binfo_offsets PROTO((tree, tree)); static void unshare_base_binfos PROTO((tree)); static int avoid_overlap PROTO((tree, tree)); +static int equal_functions PROTO((tree, tree)); #define CEIL(x,y) (((x) + (y) - 1) / (y)) @@ -1423,6 +1424,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 @@ -1433,9 +1448,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; } -- 2.47.2