aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-06-24 16:17:42 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1994-06-24 16:17:42 -0400
commit796bb3734a77e914b31b48811eebe0523f334f9c (patch)
treee7a4e69fdc356ce5f59c555f1d9a072774b1d55b
parent5c8902bb1a4e99e69a1d9daeae1165bc7abcbf76 (diff)
downloadgcc-796bb3734a77e914b31b48811eebe0523f334f9c.zip
gcc-796bb3734a77e914b31b48811eebe0523f334f9c.tar.gz
gcc-796bb3734a77e914b31b48811eebe0523f334f9c.tar.bz2
(build_c_cast): Issue a warning for non-matching cast from a function
call (like malloc without proto). From-SVN: r7562
-rw-r--r--gcc/c-typeck.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 659a3e3..80c236f 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -3606,6 +3606,11 @@ build_c_cast (type, expr)
&& !TREE_CONSTANT (value))
warning ("cast from pointer to integer of different size");
+ if (warn_bad_function_cast
+ && TREE_CODE (value) == CALL_EXPR
+ && TREE_CODE (type) != TREE_CODE (otype))
+ warning ("cast does not match function type");
+
if (TREE_CODE (type) == POINTER_TYPE
&& TREE_CODE (otype) == INTEGER_TYPE
&& TYPE_PRECISION (type) != TYPE_PRECISION (otype)