aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-06-29 04:26:19 +0000
committerRichard Stallman <rms@gnu.org>1992-06-29 04:26:19 +0000
commita4219ac7406c41efb439fa8690b634291f7a9d53 (patch)
treeaea9455e16ba3df621ae61e3b6e94c2172a2c8ca /gcc
parentfc54f375900259ca0c837741911e72233188b555 (diff)
downloadgcc-a4219ac7406c41efb439fa8690b634291f7a9d53.zip
gcc-a4219ac7406c41efb439fa8690b634291f7a9d53.tar.gz
gcc-a4219ac7406c41efb439fa8690b634291f7a9d53.tar.bz2
(initializer_constant_valid_p): Allow CONVERT_EXPR if its operand is ok.
(build_c_cast): For cast to union, make a CONSTRUCTOR. From-SVN: r1331
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-decl.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 77c890c..4db8fbd 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -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. */