From 796bb3734a77e914b31b48811eebe0523f334f9c Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Fri, 24 Jun 1994 16:17:42 -0400 Subject: [PATCH] (build_c_cast): Issue a warning for non-matching cast from a function call (like malloc without proto). From-SVN: r7562 --- gcc/c-typeck.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 659a3e375a0a..80c236f36262 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) -- 2.47.2