From: Richard Kenner Date: Fri, 24 Jun 1994 20:17:42 +0000 (-0400) Subject: (build_c_cast): Issue a warning for non-matching cast from a function X-Git-Tag: misc/cutover-egcs-0~6381 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=796bb3734a77e914b31b48811eebe0523f334f9c;p=thirdparty%2Fgcc.git (build_c_cast): Issue a warning for non-matching cast from a function call (like malloc without proto). From-SVN: r7562 --- 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)