Johan Bezem ist Mitglied bei
Archive for November, 2007
How to handle include paths in PC Lint
Include file processing can be a bit tricky. Here I present a few Q&A on processing include files, and specifying paths.
- My
INCLUDEenvironment variable is set for Microsoft compilers. If I Lint for <name your compiler here>, Microsoft includes are processed. What can I do?
A: Well, for one, you can delete the environment variable for the shell you use. You may redefine yourINCLUDEvariable to reflect your compiler. Both can be achieved in a batch file. - I cannot change the value of
INCLUDEon my system. Can I tell Lint to simply ignore it?
A: I haven’t found a way using options in Lint, so until someone tells me how it can be done, I’d say ‘no’. However, you can write a small batch file to emptyINCLUDEbefore calling Lint. That works even if your system’s include is forced to be set. - I defined my own include variable
MYINCLUDE, and used ‘-incvar‘ to activate it. Lint still usesINCLUDE, though. What can I do?
A: According to my tests, Lint gives priority to an existing and validINCLUDEvariable. If the files can be found usingINCLUDE, you are forced to delete or redefineINCLUDE. - I have written my own version of (example) ‘
stdio.h‘. Lint refuses to find that file. What can I do?
A: Lint processes ‘-i‘ options for specifying include paths in order. Chances are, that you compiler’s include path is specified before your application’s. Use the verbosity options ‘-voif‘ (large output!) to see what order is presented to Lint, and change it, or use ‘--i‘ (double dashes!) to indicate the compiler’s include path. See the ‘readme.txt‘ for the current patch level for details. - I used ‘
--i‘ to indicate my compiler’s include path, but now Lint is finding Microsoft’s include files again. What can I do?
A: According to my tests, a present and validINCLUDEvariable is taking precedence over ‘--i‘ paths. You’ll have to delete or redefine theINCLUDEvariable. - I need to see what files Lint is using exactly, which ‘
-i‘/’--i‘ options it is processing and in which order. What can I do?
A: It will produce an enormous amount of output, but ‘-voif‘ (in addition to your normal options, preferably as one of the first options on the command line) will provide the information you need.
For all options presented here, look in the manual, or see the ‘readme.txt‘ as presented on the support pages of Gimpel’s website.
An interesting book, possibly also for Lint users
I just read about this book on CM Crossroads: “Secure Programming with Static Analysis”, by Brian Chess and Jacob West. I haven’t read or even bought/borrowed the book. However, the description they give (granted, it’s an advertisement) makes me curious. I’ll ponder this a bit, and maybe order the book.
If you’re into secure programming (and I guess many of us are, one way or another), at least take a look. I’ll report back if and when I buy and/or read the book. Reader comments always welcome (others too :-).
Undocumented PC Lint options
I’ve been searching Gimpel’s forum several times already. Some options have been added since version 8.00a, but these are not yet documented (nor supported, mind you!). But occasionally, I still need these. Now, for all my readers, without support, without any official shine, just as-is. I’ve included links to the best (IMHO) definitions in Gimpel’s forum I could find. Additions and corrections always welcome.
+fsg – map namespace to global namespace, documented in 9.0
++d<name> – define and survive even #undef; documented in 9.0
+restore_end – Place each single source in its own sandbox (Version 8.00u only)
+restore_at_end – As before, version 8.00v ff; the documentation for Lint 9.0 describes -restore_at_end, the software seems to accept both variants.
––esym(...) – seems identical to –esym, not documented but still accepted by version 9.0
–ecall(...) – turn of warning at each function call; documented in 9.0
-deprecate(objectType, objectName, warningString) – declare several object types to be deprecated; supported are “function“, “macro“, and “variable” (thanks, Don!); documented in 9.0
+xml(<string>) – make Lint format its output as XML. Follow the link to the sample configuration to see how it’s done; documented in 9.0
How to wield PC Lint
This entry is more for testing my blog, but at the same time my first tip for those looking for PC Lint support. Only that this tip is already published on my regular website.
I wrote a few pages on “How to Wield PC-Lint“, for setting up and deploying Lint, and making sense of the truckload of messages an initial deployment will present. Have look at the PDF, and use it to your advantage.
If Robert Pirsig is listening in…
I enjoyed your book enormously. I was young then, 1985, and it opened my eyes. I had read several computer-related papers on ‘Quality’, containing a reference to such a curious title. Thanks a lot for writing it, it still influences, in tiny bits and pieces, my professional life.
And for those eavesdropping: Go read “Zen and the Art of Motorcycle Maintenance – An Inquiry Into Values” to see what I’m talking about, and where the title for my blog came from.
Deutsch
English
Nederlands