diff options
author | Richard Stallman <rms@gnu.org> | 1993-02-10 08:30:25 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1993-02-10 08:30:25 +0000 |
commit | 1f7586c12459b847b2999d61c1f726aab37bf2ef (patch) | |
tree | b0a99e0400a89ecc64537df7cea7f9431ca9e87b /gcc | |
parent | c0ce409adaecd6b37185996701358be3380a8c35 (diff) | |
download | gcc-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.c | 22 |
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) { |