From: Richard Stallman Date: Wed, 10 Feb 1993 08:30:25 +0000 (+0000) Subject: (duplicate_decls): Silently accept harmless mismatch X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1f7586c12459b847b2999d61c1f726aab37bf2ef;p=gcc.git (duplicate_decls): Silently accept harmless mismatch in type of 1st arg of builtin function. From-SVN: r3455 --- diff --git a/gcc/c-decl.c b/gcc/c-decl.c index da21fe8e309..de680e03c64 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1313,6 +1313,28 @@ duplicate_decls (newdecl, olddecl) = build_function_type (newreturntype, TYPE_ARG_TYPES (TREE_TYPE (olddecl))); + types_match = comptypes (TREE_TYPE (newdecl), newtype); + 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;