diff options
author | loewis <loewis@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-01-25 16:09:05 +0000 |
---|---|---|
committer | loewis <loewis@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-01-25 16:09:05 +0000 |
commit | d486ccb8bb636863293f2fde14eca92be382893d (patch) | |
tree | 21d2b9184eaecb07b2e8cdcc438b4d67ca34436c /gcc/cp | |
parent | e1bf8b855bf66593315e1c9fd925d997243663aa (diff) | |
download | gcc-d486ccb8bb636863293f2fde14eca92be382893d.tar.gz |
* tree.c (equal_functions): New function.
(ovl_member): Call it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24861 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/tree.c | 19 |
2 files changed, 22 insertions, 2 deletions
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 <loewis@informatik.hu-berlin.de> + + * tree.c (equal_functions): New function. + (ovl_member): Call it. + 1999-01-24 Jason Merrill <jason@yorick.cygnus.com> * 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; } |