(initializer_constant_valid_p): Allow CONVERT_EXPR if its operand is ok.
authorRichard Stallman <rms@gnu.org>
Mon, 29 Jun 1992 04:26:19 +0000 (04:26 +0000)
committerRichard Stallman <rms@gnu.org>
Mon, 29 Jun 1992 04:26:19 +0000 (04:26 +0000)
(build_c_cast): For cast to union, make a CONSTRUCTOR.

From-SVN: r1331

gcc/c-decl.c

index 77c890c2f7ec8785883ce9239ab80daf570aad39..4db8fbd700787eb938d91b0723a616d177c6cb9c 100644 (file)
@@ -1227,6 +1227,23 @@ duplicate_decls (newdecl, olddecl)
          TREE_THIS_VOLATILE (newdecl) |= TREE_THIS_VOLATILE (olddecl);
        }
     }
+  /* Permit char *foo () to match void *foo (...) if not pedantic.  */
+  else if (!types_match
+          && TREE_CODE (olddecl) == FUNCTION_DECL
+          && TREE_CODE (newdecl) == FUNCTION_DECL
+          && TREE_CODE (TREE_TYPE (olddecl)) == POINTER_TYPE
+          && TREE_CODE (TREE_TYPE (newdecl)) == POINTER_TYPE
+          && ((TREE_TYPE (TREE_TYPE (newdecl)) == void_type_node
+               && TYPE_ARG_TYPES (TREE_TYPE (olddecl)) == 0
+               && TREE_TYPE (TREE_TYPE (olddecl)) == char_type_node)
+              ||
+              (TREE_TYPE (TREE_TYPE (newdecl)) == char_type_node
+               && TYPE_ARG_TYPES (TREE_TYPE (newdecl)) == 0
+               && TREE_TYPE (TREE_TYPE (olddecl)) == void_type_node)))
+    {
+      if (pedantic)
+       pedwarn_with_decl (newdecl, "conflicting types for `%s'");
+    }
   else if (!types_match
           /* Permit char *foo (int, ...); followed by char *foo ();
              if not pedantic.  */