|
|
A lint filter is a project-specific post-processor that typically uses an awk script or similar program to read the output of lint and discard messages that your project has decided do not identify real problems -- string functions, for instance, returning values that are sometimes or always ignored. It enables you to generate customized diagnostic reports when lint options and directives do not provide sufficient control over output.
Two options to lint are particularly useful in developing a filter. Invoking lint with -s causes compound diagnostics to be converted into simple, one-line messages issued for each occurrence of the problem diagnosed. The easily parsed message format is suitable for analysis by an awk script.
Invoking lint with -k causes certain comments you have written in the source
file to be printed in output, and can be useful both in
documenting project decisions and specifying
the post-processor's behavior.
In the latter instance, if the comment
identified an expected lint message,
and the reported message was the same,
the message might be filtered out.
To use -k, insert on the line preceding
the code you want to comment the
/ LINTED [
msg] /
directive,
where msg refers to the comment to be printed
when lint is invoked with -k.
(Refer to the list of directives below for what lint does when
-k is not invoked for a file containing
/ LINTED [
msg] /
.)