]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree.c (equal_functions): New function.
authorJeffrey A Law <law@cygnus.com>
Sat, 20 Feb 1999 14:13:36 +0000 (14:13 +0000)
committerJeff Law <law@gcc.gnu.org>
Sat, 20 Feb 1999 14:13:36 +0000 (07:13 -0700)
        1999-01-25  Martin von L�wis  <loewis@informatik.hu-berlin.de>
        * tree.c (equal_functions): New function.
        (ovl_member): Call it.

From-SVN: r25338

gcc/cp/ChangeLog
gcc/cp/tree.c

index 7be1a540751d859728ce7521d2ce31c448ecb2a1..49d5611bae9135a81209ad9c7f7fb73b81afe18f 100644 (file)
@@ -1,3 +1,9 @@
+Sat Feb 20 15:08:42 1999  Jeffrey A Law  (law@cygnus.com)
+
+       1999-01-25  Martin von Löwis  <loewis@informatik.hu-berlin.de>
+       * 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.
index dce01cb6724fe1bd80ca778604d08f6e617b1c90..7c7768fdefc74ca3a46aa1d2f57438586e71f932 100644 (file)
@@ -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;
 }