(duplicate_decls): Silently accept harmless mismatch
authorRichard Stallman <rms@gnu.org>
Wed, 10 Feb 1993 08:30:25 +0000 (08:30 +0000)
committerRichard Stallman <rms@gnu.org>
Wed, 10 Feb 1993 08:30:25 +0000 (08:30 +0000)
in type of 1st arg of builtin function.

From-SVN: r3455

gcc/c-decl.c

index da21fe8e3094d3c83a9e335d3664edb547196f97..de680e03c6464e86adfbfff03823b2b46040cafa 100644 (file)
@@ -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;