OSDN Git Service

(build_c_cast): Issue a warning for non-matching cast from a function
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 24 Jun 1994 20:17:42 +0000 (20:17 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 24 Jun 1994 20:17:42 +0000 (20:17 +0000)
call (like malloc without proto).

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@7562 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/c-typeck.c

index 659a3e3..80c236f 100644 (file)
@@ -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)