[Patch] Enable warning in the Objective-C front-end for casting between function types

Andrew Pinski pinskia@physics.uc.edu
Sun Aug 15 18:59:00 GMT 2004


Because now the Objective-C front-end no longer produces these trees I 
think
we can enable this warning/transformation to trap.

OK? Bootstrapped on powerpc-apple-darwin and i686-pc-linux with no 
regressions.

Thanks,
Andrew Pinski


ChangeLog:

	* c-typeck.c (build_function_call): Enable warning/trap for 
Objective-C.

Patch
Index: c-typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-typeck.c,v
retrieving revision 1.356
diff -u -p -r1.356 c-typeck.c
--- c-typeck.c  15 Aug 2004 15:44:56 -0000      1.356
+++ c-typeck.c  15 Aug 2004 18:11:45 -0000
@@ -1832,13 +1832,8 @@ build_function_call (tree function, tree
       If it is not, replace the call by a trap, wrapped up in a compound
       expression if necessary.  This has the nice side-effect to prevent
       the tree-inliner from generating invalid assignment trees which 
may
-     blow up in the RTL expander later.
-
-     ??? This doesn't work for Objective-C because objc_comptypes
-     refuses to compare function prototypes, yet the compiler appears
-     to build calls that are flagged as invalid by C's comptypes.  */
-  if (! c_dialect_objc ()
-      && TREE_CODE (function) == NOP_EXPR
+     blow up in the RTL expander later.  */
+  if (TREE_CODE (function) == NOP_EXPR
        && TREE_CODE (tem = TREE_OPERAND (function, 0)) == ADDR_EXPR
        && TREE_CODE (tem = TREE_OPERAND (tem, 0)) == FUNCTION_DECL
        && ! comptypes (fntype, TREE_TYPE (tem)))



More information about the Gcc-patches mailing list