[Prev][Next][Index]
Tagging printf-like functions
Hi Jon! Regarding your interest in tagging "printf-like" functions in your
code, I may be able to help.
Besides LCLint, there are PC-lint and Flexelint (both from Gimpel), both of
which allow checking of printf-like calls. (I recommend PC-lint highly.)
They give the argument number of the format string in the comment.
Using their scheme, I tag my function like this:
/*lint -printf(1,error) */
void
error(
const char *, /* printf-style format */
...); /* optional argument(s) */
I think PC-lint also looks for weird format strings, and there is a way to
turn off that warning too.
An equivalent comment (for newer UNIX versions of lint) is:
/*PRINTFLIKE1*/
PC-lint supports a number of aliases for UNIX lint comments. I suspect
they'll support this one too eventually.
Happy hacking!
--JR (John Rogers)