printf() checking for custom functions
David Daney
ddaney@avtrex.com
Wed Sep 26 08:14:00 GMT 2007
Randall Hopper wrote:
> -Wformat causes printf() args to be checked based on the format:
>
> int printf(const char *format, ...);
>
> How do ask gcc to apply this same checking to user-defined functions?
>
> int myDebug(const char *format, ...);
>
> Apps often implement their own version of printf() for debugs, warnings,
> etc. with output switchable between console, log files, both, etc. It
> would be very useful to have gcc perform similar sanity checks for their
> arg lists.
>
Look at:
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#Function-Attributes
Scroll down to the part about the 'format' attribute.
David Daney
More information about the Gcc-help
mailing list