aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-02-10 08:30:25 +0000
committerRichard Stallman <rms@gnu.org>1993-02-10 08:30:25 +0000
commit1f7586c12459b847b2999d61c1f726aab37bf2ef (patch)
treeb0a99e0400a89ecc64537df7cea7f9431ca9e87b /gcc
parentc0ce409adaecd6b37185996701358be3380a8c35 (diff)
downloadgcc-1f7586c12459b847b2999d61c1f726aab37bf2ef.zip
gcc-1f7586c12459b847b2999d61c1f726aab37bf2ef.tar.gz
gcc-1f7586c12459b847b2999d61c1f726aab37bf2ef.tar.bz2
(duplicate_decls): Silently accept harmless mismatch
in type of 1st arg of builtin function. From-SVN: r3455
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-decl.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index da21fe8..de680e0 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -1317,6 +1317,28 @@ duplicate_decls (newdecl, olddecl)
if (types_match)
TREE_TYPE (olddecl) = newtype;
}
+ /* Accept harmless mismatch in first argument type also.
+ This is for ffs. */
+ if (TYPE_ARG_TYPES (TREE_TYPE (newdecl)) != 0
+ && TYPE_ARG_TYPES (TREE_TYPE (olddecl)) != 0
+ && TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (newdecl))) != 0
+ && TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (olddecl))) != 0
+ && (TYPE_MODE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (newdecl))))
+ ==
+ TYPE_MODE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (olddecl))))))
+ {
+ /* Function types may be shared, so we can't just modify
+ the return type of olddecl's function type. */
+ tree newtype
+ = build_function_type (TREE_TYPE (TREE_TYPE (olddecl)),
+ tree_cons (NULL_TREE,
+ TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (newdecl))),
+ TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (olddecl)))));
+
+ types_match = comptypes (TREE_TYPE (newdecl), newtype);
+ if (types_match)
+ TREE_TYPE (olddecl) = newtype;
+ }
}
if (!types_match)
{