How can I suppress a message for a single file? -efile does not work.

The -efile option applies only to messages that are parameterized on a filename (e.g. messages 7, 305, 306, 307, 314, 404,405, 406, 537, 766).  This option will inhibit messages about a file, not within a file.  While there is no option to explicitly disable a message within a particular file, you can accomplish the same effect using one of the below solutions:
  1. Use the option -save -e# before the name of the file for which the option should be suppressed and the -restore option afterwards.  For example, if the list of files you provide to lint is 1.c 2.c 3.c and you want to disable message 701 within 2.c, you would use 1.c -save -e701 2.c -restore 3.c.
  2. You can place the options -save -e# in a lint comment at the top of the file you want the message disabled for and use the -restore option in a lint comment at the end.  For example:
    //lint -save -e701
    ...
    //lint -restore

    The -save and -restore options form a stack to allow nesting so neither solution will not interfere with any -save or -restore options that may already reside in your files.
Alternatively, you might want to consider using one of the other suppression options.  For example, if the message you wish to suppress is limited to one or several functions, you can employ the -efunc option, if the message you are trying to suppress is the result of a macro expansion, the -emacro option may be a better fit, etc.

Feedback and Knowledge Base