Vector Help

Reference Manual for PC-lint® Plus

21 Frequently Asked Questions

21.1 How do I keep PC-lint Plus from processing header files?

Header files contain declarations and definitions that are critical to the understanding of the program that uses them. PC-lint Plus needs to be able to properly parse your header files in order to produce accurate analysis. If you are receiving error messages from headers (as opposed to warnings or infos), this represents a configuration issue that must be addressed. If you are receiving warnings or infos from library headers when utilizing a coding guidelines configuration file (e.g. MISRA), see Suppressing MISRA/AUTOSAR/CERT C/CWE messages from library/system headers .

21.2 When do I need to use imposter?

The provided imposter program is only used during the generation of a project configuration. For projects with a small number of source files that are not compiled with different compiler options, it is often sufficient for a project configuration to simply consist of the names of the modules that PC-lint Plus should analyze. For projects with many modules or modules that are compiled with different options, it is usually easier to automatically generate a project configuration by extracting information from the build process. If your build system supports the generation of a JSON compilation database, you can use pclp_config to generate a project configuration using this database , without the need for imposter. Otherwise, you can build your project using the imposter program as a replacement for your compiler, the result of which will be a YAML-formatted log containing compiler invocations which can then be used by pclp_config to generate a project configuration.

21.3 How should imposter be compiled?

The imposter program is distributed as a single C source file and can be compiled with any C compiler. As the imposter program is run as a drop-in replacement for your compiler during the build process, it should be compiled as an executable that will run in your host environment. For example, if you are building for an embedded device on Windows, you should compile imposter as a Windows executable, not an executable for your target device.

21.4 What can I do to improve analysis speed?

The performance profile of PC-lint Plus will depend on a variety of factors including the characteristics of the project being analyzed, the options used, and the hardware available. By default, PC-lint Plus analyzes modules one at a time. If the machine running PC-lint Plus has multiple processor cores, the -max_threads option can be used to improve performance by analyzing multiple modules at a time, e.g. -max_threads=8 will allow PC-lint Plus to analyze up to 8 modules at a time which will result in significantly faster analysis if the machine has 8 or more processing cores. Some projects may also benefit from the use of precompiled headers .

21.5 PC-lint Plus has crashed, what do I do next?

The most common cause of a crash of PC-lint Plus is memory exhaustion which can be exacerbated by the use of -max_threads option which increases memory consumption. When using the -max_threads option, crashes from memory exhaustion may be inconsistent. To determine if the crash is memory related to memory exhaustion, a memory profiler can be used to determine how much memory was being used by PC-lint Plus at the point of the crash. If the -max_threads option is set to a large value, lowering this value may mitigate the crash. If PC-lint Plus is running on a machine employing antivirus software, you may want to try running PC-lint Plus with the antivirus software temporarily disabled as some antivirus software has the potential to interfere with the operation of PC-lint Plus.

If memory exhaustion has been ruled out as a possible culprit, you should contact Vector Informatik GmbH support for further guidance. In most cases, a reproducible test case will be needed. You should also run with the PC-lint Plus debug binary and provide any internal error information produced before the crash if applicable.

21.6 Why isn’t my option working?

There are several possible reasons a suppression (or other option) may not work as expected including:

21.7 How can I temporarily disable suppressions of one or more messages?

The ++efreeze option will cause any following suppression options to be ignored. When used by itself, this option will affect all messages, one or more message numbers may be specified as an argument to this option to limit the behavior to the specified messages. The +efreeze option is similar but can be later reverted using the -efreeze option allowing for the effect to be limited to particular files or code regions. See the description of these options for more information.

21.8 How can I customize existing messages or add new messages?

Existing messages may be customized by adding text to the message when it is emitted using the -append option. This option is used extensively in the coding guideline configuration files (e.g. au-misra3.lnt) to include references to the related coding guidelines when issuing messages.

New checks and messages may be created using the Queries feature. Significant use of this feature is employed in the au-barr.lnt file to create messages to support the BARR-C:2018 guidelines. This configuration file is included in the lnt directory of the PC-lint Plus distribution package.

21.9 How can I change the message category associated with a message?

The message category associated with every message ("error", "warning", etc.) cannot be changed. If the goal is to convey a heightened sense of severity for specific messages, -append option may be used to cause custom text to be appended to the message when it is issued. If the goal is to elicit a build failure by causing PC-lint Plus to terminate with a non-zero exit code when particular messages have been issued, the -zero_err option can be used. See the description of this option for more information. If the goal is to cause the output to conform to the format expected by an IDE integration (which may recognize errors and warnings but have no concept of elective notes), see the -format_category option.

21.10 How can I generate XML/HTML output?

The env-xml.lnt and env-html.lnt files included in the lnt directory of the PC-lint Plus distribution package can be used to emit XML or HTML output. These files may be modified to customize the output for your specific needs.

21.11 Can PC-lint Plus generate custom reports?

Aside from the summary report provided by the -summary option, stack usage reports , and thread analysis reporting , PC-lint Plus does not produce reports. The output of PC-lint Plus is very customizable (see Message Presentation ) in order to facilitate the use of custom scripts that can generate reports during a post-processing step.

21.12 Where can I find msg.txt / msg.json?

The msg.txt and msg.json files containing a list of all supported PC-lint Plus messages in plain text or JSON format are no longer included in the distribution package. These files may be dynamically generated by PC-lint Plus by invoking it as:

   pclp -dump_messages[file=msg.txt]

or:

   pclp -dump_messages[file=msg.json,format=json]

See the description of the -dump_messages option for other supported formats and relevant information.

21.13 How can I apply options only to C files but not C++ files (or vice versa)?

Use the -header option, as in:

   -header(lint.h)

and then within the specified header (lint.h in this example) add the following:

    #ifdef __cplusplus 
       //lint <cpp-options> 
    #else 
       //lint <c-options> 
    #endif

where <cpp-options> and <c-options> correspond to the options to be processed for C++ and C modules, respectively. The -header option causes the specified file to be automatically included at the beginning of every analyzed module. The __cplusplus macro is defined by PC-lint Plus at the beginning of every C++ module and can be used to conditionally include source code, including lint comments, based on the current language mode.

21.14 Can PC-lint Plus recursively scan sub directories for the source code?

No, but you can obtain a list of files from a command prompt. For example:

   dir /s/b *.cpp > project.lnt

will recursively scan the current directory for C++ source files on Windows and:

   find . -name '*.cpp' > project.lnt

will accomplish the same on Linux or macOS. You can then use project.lnt as an argument to PC-lint Plus. You confirm that all those files are in the same project.

21.15 Can function semantics be applied using attribute
syntax?

PC-lint Plus will add semantics to a function declaration that uses GCC attribute syntax. For example:

int f() __attribute__((pure)); 
int g() { 
   f(); 
}

The GCC attribute syntax will be recognized and automatically converted to a pure semantic -sem(f, pure) as long as the fca flag is active (which it is by default). See the fca flag documentation for the available semantic conversions. As a result, messages 522 and 523 are issued for function f().