I was confused by the description of -Wbad-function-cast. It talks about function calls, but the malloc example looked more like a declaration, and IIRC it's not valid to redeclare functions from the standard C library with the wrong return type (or at the very least we shouldn't encourage doing so in an example). After checking the implementation to see what the option actually does, I decided it would be better not to name any particular function here.

Checked in under the obvious fix rule.

-Sandra

2015-01-12  Sandra Loosemore  <san...@codesourcery.com>

        gcc/
        * doc/invoke.texi ([-Wbad-function-cast]): Rewrite to avoid confusing
        example.
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi	(revision 219488)
+++ gcc/doc/invoke.texi	(working copy)
@@ -4625,8 +4625,9 @@ example, warn if an unsigned variable is
 @item -Wbad-function-cast @r{(C and Objective-C only)}
 @opindex Wbad-function-cast
 @opindex Wno-bad-function-cast
-Warn whenever a function call is cast to a non-matching type.
-For example, warn if @code{int malloc()} is cast to @code{anything *}.
+Warn when a function call is cast to a non-matching type.
+For example, warn if a call to a function returning an integer type 
+is cast to a pointer type.
 
 @item -Wc90-c99-compat @r{(C and Objective-C only)}
 @opindex Wc90-c99-compat

Reply via email to