Oracle® Solaris Studio 12.4: C User's Guide

Exit Print View

Updated: March 2015
 
 

4.6.3 lint Filters

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 deemed as not identifying real problems, for example, string functions, that, return values that are sometimes or always ignored. lint filters 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:

  • The -s option 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.

  • The -k option causes certain comments you have written in the source file to be printed in output. It can be useful both in documenting project decisions and specifying the post-processor’s behavior. In the latter instance, if the comment identifies an expected lint message and the reported message is the same, the message can be filtered out. To use -k, insert the NOTE(LINTED(msg))directive on the line preceding the code you want to comment, where msg refers to the comment to be printed when lint is invoked with -k.

    Refer to the list of directives in Table 4–9 for an explanation of what lint does when -k is not invoked for a file containing NOTE(LINTED(msg)).