lclint-interest message 34

Date: 14 Jun 95 17:07:45 EDT
From: "JR (John Rogers)" <72634.2402@compuserve.com>
To: Jon Freeman 
Cc: LCLint interest list 
Subject: 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)
Previous Message Next Message Archive Summary LCLint Home Page David Evans
University of Virginia, Computer Science
evans@cs.virginia.edu