Vector Help

Reference Manual for PC-lint® Plus

2 Installation and Configuration

2.1 System Requirements

2.1.1 Supported Operating Systems

2.1.2 Supported File Encodings

Source code files and configuration files processed by PC-lint Plus must employ one of the following encodings:

It is not necessary for all files to use the same encoding, e.g. some files may be encoded as UTF-8 while others are encoded as UTF-16. Files not encoded using one of the above encodings should be converted to UTF-8 before being supplied to PC-lint Plus. There are many tools that can perform such conversion including iconv for Linux and macOS and win-iconv for Windows.

2.1.3 Hardware Requirements

Minimum Requirements

Recommended Requirements

2.1.4 Antivirus Software

Some antivirus software packages employ intrusive mechanisms, such as remote code injection, during their operation. The use of such intrusive mechanisms has the potential to impact the behavior of PC-lint Plus leading to unexpected results. If you experience issues such sluggish performance, application crashes, or inconsistent behavior while using PC-lint Plus in conjuction with such software, you can try running PC-lint Plus with the antivirus software temporarily disabled, with an exception for the PC-lint Plus executable registered with the antivirus software, or on a machine where the antivirus software is not running to help determine if the antivirus software is responsible for the observed behavior.

2.2 Installation

PC-lint Plus is distributed as a binary executable and may be installed by copying this file to the desired directory. PC-lint Plus does not require any other installation steps in order to use the product.

If you wish to run PC-lint Plus without specifying the full path of the binary, you will need to either place the PC-lint Plus executable in one of the directories included in your PATH environment variable or add the installed directory to your path.

2.2.1 Setting the PATH environment variable on Windows

1.
Open a command or run prompt such as by pressing ‘R’ while holding the Windows key.
2.
Type sysdm.cpl into the run prompt and press Enter.
3.
Select the “Advanced” tab in the dialog window.
4.
Click “Environment Variables”.
5.
In the “System Variables” section, locate the PATH (or Path) variable and select “Edit...”.
(a)
Windows 10: select “New” and type (or “Browse...” for) the directory containing the PC-lint Plus executable.
(b)
Previous versions of Windows: add the directory containing the PC-lint Plus executable to the semicolon-delimited list.
6.
Click “OK” on this and the remaining dialog windows.

Verify the change by running echo %PATH% from a newly opened command prompt window.

Note: You may need to have administrative privileges to alter system settings.

Note: This change will not affect already open windows.

2.2.2 Setting the PATH environment variable on Linux

1.
Open ˜/.profile with your preferred editor
2.
Add the line PATH=$PATH:pc-lint-plus-dir where pc-lint-plus-dir is the full path of the directory where the PC-lint Plus executable is located.
3.
Save and quit.

Verify the change by running echo $PATH from a newly opened terminal window. 

Note: This change will not affect already open terminal windows.

2.2.3 Setting the PATH environment variable on macOS

1.
Open a terminal such as by pressing the space bar while holding the command key (to open Spotlight) and entering “Terminal
2.
Run the command sudo nano /etc/paths
3.
At the bottom of the file, add the directory containing the PC-lint Plus binary
4.
Press Ctrl-X to quit and press ‘Y’ to save when prompted.

Verify the change by running echo $PATH from a newly opened terminal window.

Note: This change will not affect already open terminal windows.

2.3 Configuring with pclp_config

2.3.1 Overview

PC-lint Plus ships with an automated configuration tool named pclp_config.py, which can be found in the config/ directory of the PC-lint Plus distribution. This Python script simplifies the process of configuring PC-lint Plus for your compiler and project.

Note: pclp_config is implemented in Python which requires that the Python interpreter as well as the regex and pyyaml modules to be installed. Installing these dependencies is a simple process described below.

Note that when using pclp_config.py to generate a compiler configuration, information about the version, size options, predefined macros, and built-in include directories may not be extractable when invoked in an environment with a non-English locale. If you encounter a warning about pclp_config.py not being able to extract this information when using a non-English locale, please contact support.

Installing python The pclp_config program requires Python 2.7 or higher (3.5 or higher is recommended). This section will walk you through the simple process of installing Python per operating system.

Installing required modules The pclp_config program uses two modules that are not part of the standard python distribution: regex and pyyaml. The easiest way to install python modules is with the pip module. These modules can be installed from the command line as follows:

Recent versions of Python (2.7.9 and up) already contain pip. If pip is not installed, you can install it using:

2.3.2 Introduction and Walkthrough of Automated Configuration with pclp_config

In this section we will work with a simple project and generate the configurations necessary for PC-lint Plus to process it. The general process is the same for projects of all shapes and sizes. Note that this demonstration is done while using Linux as an operating system, with tools and compilers commonly available on that platform.

Our sample project consists of a single source file, hello.c, that contains:

#include <stdio.h> 
 
int main(void) { 
   printf("Hello, %s\n", SUBJECT); 
   return 0; 
}

and a Makefile that describes how the project should be built:

CC = gcc 
CFLAGS = -DSUBJECT="\"World"\" 
 
hello.o: hello.c 
      $(CC) $(CFLAGS) -c hello.c -o hello.o 
hello: hello.o 
 
clean: 
   rm hello.o hello

The project is built by running the make utility to compile the program based on the instructions provided in the make file. In our case we would build by running make hello; running make clean will remove object files and executables.

Attempting to lint hello.c without any configuration at all (e.g. pclp hello.c) produces the following error:

hello.c  1  error 322: unable to open include file 'stdio.h' 
#include <stdio.h> 
       ^

The issue is that while your compiler knows where to find your system header files, such as "stdio.h", PC-lint Plus does not. This information, as well as other details about your compiler such as fundamental type sizes and predefined macros, needs to be configured before PC-lint Plus can properly analyze your source code. The process of compiling the necessary information for a particular compiler is referred to as a compiler configuration.

Section 2.4 Configuring manually discusses the process of manually extracting the various pieces of information to create a compiler configuration from scratch but in most cases the process can be automated by using pclp_config, which is what we will do here.

For this example, our compiler is gcc. The first thing we need is the full path of the gcc executable. If we do not know this, we can run the command whereis gcc or which gcc from a command prompt on Linux or macOS and where gcc from a command prompt on Windows.

Once we have the location of the compiler, we are ready to generate a compiler configuration using pclp_config.py, using the following command:

python pclp_config.py 
   --compiler=gcc 
   --compiler-bin=/usr/bin/gcc 
   --config-output-lnt-file=co-gcc.lnt 
   --config-output-header-file=co-gcc.h 
   --generate-compiler-config

pclp_config options start with and arguments are provided to options by separating them with an equal sign (=). The first argument tells pclp_config the compiler family we are targeting (gcc); the –list-compilers option can be used to show all supported compiler families. The second option specifies the full path of the compiler (/usr/bin/gcc), which pclp_config will use to extract the necessary information and build a compiler configuration. The next two options instruct pclp_config where to store the configuration (co-gcc.lnt) and header file (co-gcc.h) it will generate. The names are up to you but the standard convention is co-COMPILER.lnt and co-COMPILER.h. The last option tells pclp_config to generate a compiler configuration (as opposed to a project configuration, discussed later).

Note: In this walkthrough we assume that the compilers.yaml file, the compiler database used by pclp_config located in the config/ directory of the PC-lint Plus distribution, resides in the same directory that pclp_config is invoked from. If this is not the case, you will need to add the option –compiler-database=/path/to/compilers.yaml to each pclp_config command.

Note: If you receive an error about ’utf8’ such as "UnicodeDecodeError: ’utf8’ codec can’t decode" when running pclp_config from the Windows command line, you may need to change the code page of that session to UTF-8 using the command chcp 65001 before running pclp_config.

Note: If your compiler or development process contains a "developer prompt" or a script that needs to be run to load appropriate compiler paths or other settings when working from the command line, the commands discussed in this section should be executed from such a prompt after any such start-up scripts have run.

Running this command results in a customized co-gcc.lnt file that will look something like this:

/* Compiler configuration for gcc 4.8.4. 
  Using the options: 
  Generated on 2017-05-15 12:53:06 with pclp_config version 1.0.0. 
 */ 
 
 ... 
 
// Size Options 
-si4 -sl8 -sll8 -ss2 -sw4 -sp8 -sf4 -sd8 -sld16 
// Include Options 
-i"/usr/lib/gcc/x86_64-linux-gnu/4.8/include" 
-i"/usr/local/include" 
-i"/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed" 
-i"/usr/include/x86_64-linux-gnu" 
-i"/usr/include" 
... 
+libh(co-gcc.h) 
-header(co-gcc.h)

and a co-gcc.h file that contains macro definitions extracted from the compiler.

Now that we have a compiler configuration, we can add it to our lint command, before our source file (note that we do not reference co-gcc.h directly as a reference to this file, it is automatically included in the generated co-gcc.lnt file):

pclp co-gcc.lnt hello.c

While PC-lint Plus now finds the "stdio.h" header, we encounter a different error:

hello.c  4  error 40: undeclared identifier 'SUBJECT' 
   printf("Hello, %s\n", SUBJECT); 
                  ^

SUBJECT is a macro that is used, but not defined, in the source code. Since the macro is not a predefined compiler macro our compiler configuration does not have the definition either. Instead, SUBJECT is a project macro and demonstrates the need for a project configuration file.

When your build process builds your project, it often adds compiler options that introduce project-specific macros and include directories as well as other options that affect the behavior of the compiler. In our case, the build system is make and the Makefile contains a compiler option that defines this macro (CFLAGS =-DSUBJECT="\"World"\") when the project is built. PC-lint Plus needs this information as well.

Given a set of compiler invocations used to build a project, pclp_config can generate a project configuration by interpreting the compiler options present within the invocations and generating a corresponding project configuration file.
Note: Many build systems (including cmake, Ninja, Meson, and Qbs) support the generation of a JSON compilation database (compiler_commands.json). When using such a build system, the recommended way to generate a project configuration is by using this compilation database with pclp_config as described here . The remainder of this section describes the process of using the imposter program which is provided to assist in the generation of a project configuration when a compilation database is not available.

To obtain the compiler invocations, we need to employ a separate tool, the imposter. The imposter program, provided as imposter.c in the config/ directory of the PC-lint Plus distribution, is a stand-in for the compiler that logs the options it is called with to a file in a format that can be used by pclp_config to generate a project configuration.

After compiling imposter.c to imposter with a C compiler, you will need to modify your build process by telling it to execute the imposter instead of the compiler. Each build system has a different way of doing this, which often involves setting an environment variable or using a command-line option. See the documentation for your build system for details or the examples that appear later for details about how to do this on some of the more common build systems.

In the case of make, the location of the C compiler is typically stored in a variable called CC (CXX is used to store the location of the C++ compiler to use). The CC variable is defined at the top of our Makefile. We can either edit this line to point it to our imposter binary or override the CC variable on the command line using make -e CC=/path/to/imposter hello.

Before we run our modified build though, we need to tell the imposter program where to write its output (the default is stdout). Because imposter is a stand-in for the compiler, it needs to handle all the options that might be provided to it by the build process. For this reason, the imposter uses environment variables instead of options to affect its behavior. The IMPOSTER_LOG environment variable is used to tell imposter where to write invocation data. We could modify the Makefile to set this environment variable before invoking the imposter but we will set it on the command line so we do not have to modify the Makefile. On Linux or macOS this can be done with:

export IMPOSTER_LOG=hello.commands

and on Windows:

set IMPOSTER_LOG=hello.commands

Now we can run make:

make -e CC=/path/to/imposter hello    

The file, hello.commands, should now contain the compiler invocations in YAML format, looking something like this:

['-DSUBJECT="World"','-c','hello.c','-o','hello.o'] 
['hello.o','-o','hello']

We can now use pclp_config to convert this file into a project-specific configuration for PC-lint Plus:

python pclp_config.py 
   --compiler=gcc 
   --imposter-file=hello.commands 
   --config-output-lnt-file=hello.lnt 
   --generate-project-config

As before, we need to tell pclp_config what compiler we are using so that it knows how to interpret the options that were logged by the imposter program, which we do with the first option. The second option tells pclp_config where to find the logged invocations. The third option specifies where the project configuration should be written. Like the compiler configuration, this name is up to you but is typically named after the project. Finally, the last option specifies the type of configuration to generate. Running this command will create the necessary project configuration in hello.lnt, which will look like:

-env_push 
-dSUBJECT="World" 
"hello.c" 
-env_pop

This file contains everything that is needed to analyze the project, in this case the macro definition that was missing before and the name of the source files that constitute the project (just one in this case). The -env_push and -env_pop options that surround each source file prevent options, such as -d, from extending past the source files they should be applied to (see -env_push and env_pop for more information about these options).

We can now analyze the full project using our generated configuration files:

pclp co-gcc.lnt hello.lnt      

Note that the compiler configuration comes before the project configuration. Also note that we do not need to specify the project’s source file on the command line as any source files will be included in the project configuration.

Both the imposter program and the pclp_config script have a number of configurable options to handle various situations. For example, some projects might not get through the build process without source files being compiled in which case imposter needs to be configured to call the actual compiler after it logs the options it was called with. If you are targeting an architecture that is not your compiler’s default, you will need to provide the architecture options to pclp_config when building the compiler configuration. These details are documented in the 2.3.24 Imposter Options Reference and 2.3.23 pclp_config Options Reference sections.

2.3.3 Creating a compiler configuration for GCC or Clang

1.
Locate the compiler binary. On Linux or macOS this can be done with the command:
which gcc      

and on Windows with the command:

where gcc      

replacing gcc with the name of your compiler.

For STM32CubeIDE users, the location of the compiler can be obtained by following the below steps in the IDE:

(a)
Click on "Window" and then "Preferences".
(b)
In the left-hand pane, expand "C/C++", then expand "Build", and then click on "Build Variables".
(c)
The location of your compiler should be represented by either the gnu_tools_for_stm32_compiler_path or the gnu_arm_embedded_compiler_path variables. You should be able to view the Value of the appropriate variable in the list. If it shows up as "ECLIPSE DYNAMIC VARIABLE" you should be able to see the value being used by selecting the variable and clicking on "Edit".
(d)
Once you have located the directory, you can open it to find your gcc executable, e.g. arm-none-eabi-gcc.exe. You can then use the full path (including the directory and the executable file name) as the argument to –compiler-bin in the invocation of pclp_config.py provided below.
2.
Run the pclp_config.py script. For GCC use:
python pclp_config.py 
   --compiler=gcc 
   --compiler-bin=/path/to/compiler 
   --config-output-lnt-file=co-gcc.lnt 
   --config-output-header-file=co-gcc.h 
   --generate-compiler-config

For clang use:

python pclp_config.py 
   --compiler=clang 
   --compiler-bin=/path/to/compiler 
   --config-output-lnt-file=co-clang.lnt 
   --config-output-header-file=co-clang.h 
   --generate-compiler-config

If the compilers.yaml file (found in the config/ directory of the distribution) is not in the directory from which pclp_config.py is run, you will need to add the option:

--compiler-database=/path/to/compilers.yaml    

If you are creating a configuration for a hardware target that is not the compiler’s default, you will need to add the option:

--compiler-options="arch-option"      

where arch-option specifies the target architecture, e.g.:

--compiler-options="-m32"      

If you use a C or C++ standard language version that is not your compiler’s default, you will also want to add the appropriate -std options using –compiler-c-options and –compiler-cpp-options, e.g.:

--compiler-c-options="-std=c99" 
--compiler-cpp-options="-std=c++14"
3.
Review the generated .lnt and .h file for completeness.

The generated configuration will be suitable for both C and C++ source files, there is no need to separately configure using g++ or clang++.

2.3.4 Creating a compiler configuration for Microsoft C/C++ compilers

1.
Open a "Developer Command Prompt for Visual Studio".

In Windows 10:

  • Press the Windows key to open the Start menu and type "dev".

  • Select the appropriate "Developer Command Prompt" to launch.

In Windows 8.1:

  • Press the Windows key to open the Start screen.

  • Press CTRL + TAB to open the Apps List.

  • Press V to show available Visual Studio command prompt options.

  • Select the appropriate "Developer Command Prompt" to launch.

In Windows 8:

  • Press the Windows key to open the Start screen.

  • Press Z while holding the Windows key.

  • Select the "Apps view" icon at the bottom and press V to show the available Visual Studio command prompt options.

  • Select the appropriate "Developer Command Prompt" to launch.

In Windows 7:

  • Press the Windows key to open the Start menu, select "All Programs", and then expand "Microsoft Visual Studio".

  • Select "Visual Studio Command Prompt" from the menu or from the "Visual Studio Tools" menu to launch.

2.
Find the location of the cl.exe compiler:

From the Developer Command Prompt opened in step 1, run:

where cl      
3.
Run the pclp_config.py script:
python pclp_config.py 
   --compiler=vs2015 
   --compiler-bin=/path/to/compiler 
   --config-output-lnt-file=co-vs2015.lnt 
   --config-output-header-file=co-vs2015.h 
   --generate-compiler-config

replacing vs2015, in all three locations, as appropriate for the version of Visual Studio you are targeting and /path/to/compiler with the full path of the cl.exe binary located in step 2.

Note that vs2015, vs2017, etc. are for 32-bit targets, use vs2015_64, vs2017_64, etc. for 64-bit configurations. The –list-compilers option can be used to show all supported values for –compiler.

If the compilers.yaml file (found in the config/ directory of the distribution) is not in the directory from which pclp_config.py is run, you will need to add the option:

--compiler-database=/path/to/compilers.yaml

See 2.3.1.1 Installing Python for steps to install Python if necessary.

When creating a configuration for a project that has changed the “C++ Language Standard” setting, the following option must be added.

--compiler-cpp-options="/std:language-standard"

where language-standard specifies the language standard argument to the compiler option 1 corresponding to the language standard selection, e.g.:

--compiler-cpp-options="/std:c++17"

specifies C++17. The configuration tool makes a reasonable guess for the default language standards in use for the given Visual Studio version. However, if the command to generate a configuration omits language settings, and the assumed default differs from the value in use by the project, then the resulting incomplete configuration may lead to error directives and missing standard library types. 2

A similar option should be provided if C language files are being compiled and use a C language standard that is not the default. 3

--compiler-c-options="/std:c17"
4.
Review the generated .lnt and .h file for completeness.

Note: If a project is using the /std:clatest or /std:c++latest options, the equivalent PC-lint Plus -std= option will be set in the generated .lnt based on the latest supported version of Visual Studio. Since these options’ mappings changed between versions and individual releases of Visual Studio, some manual adjustment might be necessary in the generated .lnt file.

The generated configuration will be suitable for both C and C++ source files.

2.3.5 Creating a compiler configuration for IAR Embedded compilers

PC-lint Plus supports automated configuration for all IAR compiler families. To generate a compiler configuration for an IAR compiler using pclp_config, you will need to determine the value to use for the –compiler option. The table below lists the different compiler families and some of the corresponding chip-sets.



Value for

–compiler Option

Description



iar-430

IAR compiler for Texas Instruments MSP430 and MSP430X

iar-78k

IAR compiler for Renesas 78K0/78K0S and 78K0R

iar-8051

IAR compiler for the 8051 microcontroller family

iar-arm

IAR compiler for ARM Cores

iar-avr

IAR compiler for Atmel AVR

iar-avr32

IAR compiler for Atmel AVR32

iar-cf

IAR compiler for NXP/Freescale ColdFire

iar-cr16c

IAR compiler for National Semiconductor CR16C

iar-h8

IAR compiler for Renesas H8/300H and H8S

iar-hcs12

IAR compiler for NXP/Freescale HCS12

iar-m16c

IAR compiler for Renesas M16C/1X-3X, 5X-6X and R8C Series

iar-m32c

IAR compiler for M32C and M16C/8x Series

iar-maxq

IAR compiler for Dallas Semiconductor MAXQ

iar-r32c

IAR compiler for Renesas R32C/100 microcomputer

iar-rh850

IAR compiler for Renesas RH850

iar-rl78

IAR compiler for Renesas RL78

iar-rx

IAR compiler for Renesas RX

iar-s08

IAR compiler for NXP/Freescale S08

iar-sam8

IAR compiler for Samsung SAM8

iar-v850

IAR compiler for Renesas V850



You will also need the full path of the compiler which can be obtained from within the IAR Embedded Workbench by clicking "Help", "About", "Product Info", then clicking on the "Details" button which should bring up a dialog like the one shown below:

PIC

For example, the following command will create a configuration for the IAR ARM compiler, located in C:\iar\arm\iccarm.exe, with output files named co-iar-arm.lnt and co-iar-arm.h:

python pclp_config.py 
   --compiler=iar-arm 
   --compiler-bin=C:\iar\arm\iccarm.exe 
   --config-output-lnt-file=co-iar-arm.lnt 
   --config-output-header-file=co-iar-arm.h 
   --compiler-options="..." 
--generate-compiler-config

The –compiler-options option specifies the options passed to the IAR compiler when compiling your project, make sure to replace ... with the options used to compile your project. If you are generating a configuration for use with C++ source files, make sure to include the option –c++ with –compiler-cpp-options, e.g. –compiler-cpp-options="–c++".

If the compilers.yaml file (found in the config/ directory of the distribution) is not in the directory from which pclp_config.py is run, you will need to add the option:

--compiler-database=/path/to/compilers.yaml    

See 2.3.1.1 Installing Python for steps to install Python if necessary.

The generated configuration will be suitable for both C and C++ source files.

See 2.3.16 Integrating PC-lint Plus with IAR Embedded Workbench for instructions on integrating PC-lint Plus with the IAR IDE.

2.3.6 Creating a compiler configuration for Keil μVision ARMCC

1.
From the "Help" menu, select "About μVision".
2.
The dialog will list the "Toolchain Path" and the "Compiler". The full compiler path is the toolchain path followed by the compiler name. For example, "C:\Keil_v5\ARM\ARMCC\bin\armcc.exe".
3.
From the "Project" menu, select "Options [for target]".
4.
Select the "C/C++" tab.
5.
Compiler options are listed in the "Compiler control string" field, for example –c99 -c –cpu Cortex-M7 –fpu=SoftVFP.
6.
The compiler configuration for this example could be generated by running:
python pclp_config.py 
 --compiler=keil_armcc 
 --compiler-bin="C:\Keil_v5\ARM\ARMCC\bin\armcc.exe" 
 --config-output-lnt-file=co-keil_cc.lnt 
 --config-output-header-file=co-keil_cc.h 
 --compiler-c-options="--c99" 
 --compiler-options="-c --cpu Cortex-M7 --fpu=SoftVFP" 
 --generate-compiler-config

Note: If the configuration files are not placed in the project working directory the option –header-option-use-enclosing-directory can be added when running pclp_config so that the header file can be found in the same directory as the options file regardless of where the options file is used.

See 2.3.17 Integrating PC-lint Plus with Keil μVision for instructions on integrating PC-lint Plus with the Keil IDE.

2.3.7 Creating a compiler configuration for Keil μVision ARMCLANG

1.
From the "Help" menu, select "About μVision".
2.
The dialog will list the "Toolchain Path" and the "Compiler". The full compiler path is the toolchain path followed by the compiler name. For example, "C:\Keil_v5\ARM\ARMCLANG\bin\armclang.exe".
3.
From the "Project" menu, select "Options [for target]".
4.
Select the "C/C++" tab.
5.
Compiler options are listed in the "Compiler control string" field, for example -std=c99 -c –target=arm-arm-none-eabi -mcpu=cortex-m7.
6.
The compiler configuration for this example could be generated by running:
python pclp_config.py 
 --compiler=keil_armclang 
 --compiler-bin="C:\Keil_v5\ARM\ARMCLANG\bin\armclang.exe" 
 --config-output-lnt-file=co-keil_clang.lnt 
 --config-output-header-file=co-keil_clang.h 
 --compiler-c-options="-std=c99" 
 --compiler-options="-c --target=arm-arm-none-eabi -mcpu=cortex-m7" 
 --generate-compiler-config

Note: If the configuration files are not placed in the project working directory the option –header-option-use-enclosing-directory can be added when running pclp_config so that the header file can be found in the same directory as the options file regardless of where the options file is used.

See 2.3.17 Integrating PC-lint Plus with Keil μVision for instructions on integrating PC-lint Plus with the Keil IDE.

2.3.8 Creating a compiler configuration for Microchip MPLAB X XC8/XC16/XC32

1.
In the “Run” (or “Production”) menu, select “Clean and Build Main Project”
2.
In the output pane, look for a line like:
"C:\Program Files\Microchip\xc32\v1.40\bin\xc32-gcc.exe" -x c -mprocessor=32MX795F512L
Note that the -mcpu= option may appear instead of -mprocessor=. In this example, the compiler binary is C:\Program Files\Microchip\xc32\v1.40\bin\xc32-gcc.exe and the relevant compiler options are -x c (setting the language to C, as opposed to C++) and -mprocessor=32MX795F512L setting the target. Relevant compiler options should be passed to pclp_config.py using the –compiler-options option. The binary name identifies the compiler architecture (32-bit in this example).
3.
The configuration for this example would be generated with the command:
python pclp_config.py
  –compiler=microchip_xc32
  –compiler-bin="C:\Program Files\Microchip\xc32\v1.40\bin\xc32-gcc.exe"
  –config-output-lnt-file=co-xc.lnt
  –config-output-header-file=co-xc.h
  –compiler-options="-x c -mprocessor=32MX795F512L"
  –generate-compiler-config
to produce a compiler configuration.

Note: If the configuration files are not placed in the project working directory the option –header-option-use-enclosing-directory can be added when running pclp_config so that the header file can be found in the same directory as the options file regardless of where the options file is used.

See 2.3.18 Integrating PC-lint Plus with MPLAB X for instructions on integrating PC-lint Plus with the MPLAB X IDE.

2.3.9 Creating a compiler configuration for MetaWare ccac ARC V2 EM/V2 HS/V3 HS/etc.

1.
From a Command Prompt or terminal, run where ccac (Windows) or which ccac (Linux) to obtain the compiler path. If the compiler is not in your system path then you will need to find the full path of ccac. In a typical installation, it will be in located in ARC/MetaWare/arc/bin relative to the installation root.
2.
Open the MetaWare IDE. In the “Project” menu, select “Clean Project”.
3.
In the “Project” menu, select “Build Project”.
4.
In the “Console” pane, look for lines like:
Invoking: MetaWare ARC EM C/C++ Compiler
ccac -c -g -Hnocopyr -Hpurge -arcv2em -core1 -o "example.o" "../example.c"
Relevant compiler options should be passed to pclp_config.py using the –compiler-options option.

If you do not see an invocation of the ccac compiler, then your project may use mcc or gcc. For gcc, see 2.3.3 Creating a compiler configuration for GCC or Clang . Projects that require the unique extensions of the mcc compiler are not supported. A compiler database entry for the older mcc compiler is not provided as the unique language extensions in the mcc compiler that are not supported by the ccac compiler are not currently supported by PC-lint Plus. While the manual configuration steps documented in section 2.4 Configuring manually can be applied to the mcc compiler, the outcome will depend on the degree of reliance on major extensions. Information about MetaWare extensions supported only in the mcc compiler can be found in the “DesignWare MetaWare C/C++ Language Reference” in sections 2.3 (MetaWare Extensions) and 3 (Iterators in MetaWare C/C++).
5.
The configuration for this example would be generated with the command:
python pclp_config.py
  –compiler=metaware_ccac
  –compiler-bin=/home/example/ARC/MetaWare/arc/bin/ccac
  –config-output-lnt-file=co-mw.lnt
  –config-output-header-file=co-mw.h
  –compiler-options="-arcv2em -core1"
  –generate-compiler-config
to produce a compiler configuration.

Note: If the configuration files are not placed in the project working directory the option –header-option-use-enclosing-directory can be added when running pclp_config so that the header file can be found in the same directory as the options file regardless of where the options file is used.

See 2.3.19 Integrating PC-lint Plus with Eclipse-based IDEs for instructions on integrating PC-lint Plus with MetaWare IDE.

2.3.10 Creating a compiler configuration for Texas Instruments Code Composer Studio compilers

1.
Open the project in Code Composer Studio. In the “Project” menu, select “Clean...”.
2.
Uncheck both “Clean all projects” and “Start a build immediately”.
3.
Ensure that the correct project to clean is selected.
4.
Press “Clean”.
5.
In the “Project” menu, select “Build Project”.
6.
In the “Console” pane, look for an invocation of armcl, cl430, cl2000, or cl6x similar to:
"/ti/ccs0000/ccs/tools/compiler/compiler-family/cl430" –define=family -i"directory" –include_path="directory"
Relevant compiler options such as macro definitions and include options should be passed to pclp_config.py using the –compiler-options option.

If you instead find an invocation of gcc, see 2.3.3 Creating a compiler configuration for GCC or Clang .
7.
The configuration for this example would be generated with the command:
python pclp_config.py
  –compiler=ti_cl430
  –compiler-bin=/ti/ccs0000/ccs/tools/compiler/compiler-family/cl430
  –config-output-lnt-file=co-msp430.lnt
  –config-output-header-file=co-msp430.h
  –compiler-options=‘–define=family -i"directory" –include_path="directory"’
  –generate-compiler-config
to produce a compiler configuration.
  • Note: The configuration command includes a single-quoted string with inner double quotes. The Windows Command Prompt does not recognize single quotes, requiring that they are replaced with double quotes and each inner double quote escaped with a backslash. It is recommended on Windows to instead execute the command using the single quote support available in PowerShell.

Texas Instruments compilers available for use with pclp_config.py:



Value for –compiler

Description



ti_cl430

Texas Instruments cl430 for MSP430

ti_cl2000

Texas Instruments cl2000 for C2000

ti_cl6x

Texas Instruments cl6x for C6000

ti_armcl

Texas Instruments armcl for ARM



Note: cl6x vector extensions are not supported.

Note: If the configuration files are not placed in the project working directory the option –header-option-use-enclosing-directory can be added when running pclp_config so that the header file can be found in the same directory as the options file regardless of where the options file is used.

See 2.3.19 Integrating PC-lint Plus with Eclipse-based IDEs for instructions on integrating PC-lint Plus with Code Composer Studio.

2.3.11 Creating a compiler configuration for Green Hills Software compilers

PC-lint Plus supports automated configuration for all Green Hills Software (GHS) compiler families. To generate a compiler configuration for a GHS compiler using pclp_config, you will need to determine the full path of the compiler driver. One method to determine the path begins by getting the compiler driver’s directory using the GHS MULTI Launcher. Within the GHS MULTI Launcher, select "Help" and then "About MULTI Launcher..." which should bring up a dialog like the one shown below:

PIC

The value of the "Linked to Compiler in:" field indicates the directory where the compiler driver is located. You will need to examine this directory to determine the name of the compiler driver. The compiler driver typically is named cc followed by the processor family name. For instance, the ARM compiler is named ccarm (32-bit) or ccarm64 (64-bit). You can find the compiler name for a specific source file by selecting it in the MULTI Project Manager and consulting the Command pane.

The complete path of the compiler driver is provided to pclp_config as the vaue of the –compiler-bin option. For example, the following command will create a configuration for the GHS ARM 64-bit compiler driver with a full path of "c:\ghs\comp_202214\ccarm64.exe", with output files named co-ghs-arm64.lnt and co-ghs-arm64.h:

python pclp_config.py 
   --compiler=ghs 
   --compiler-bin=C:\ghs\comp_202214\ccarm64.exe 
   --config-output-lnt-file=co-ghs-arm64.lnt 
   --config-output-header-file=co-ghs-arm64.h 
   --generate-compiler-config

If the compilers.yaml file (found in the config directory of the distribution) is not in the directory from which pclp_config.py is run, you will need to add the option:

--compiler-database=/path/to/compilers.yaml    

The generated configuration will be suitable for both C and C++ source files.

2.3.12 Creating a compiler configuration for SEGGER compilers

NOTE: This tutorial is intended for projects that make use of gcc or SEGGER as their compiler. Other compilers that may be used for a SEGGER project are not currently supported.

1.
Open the desired Solution by opening the "File" menu, then selecting "Open Solution".
2.
If a Project Explorer panel is not already open, select the "View" menu.
3.
Under the "Project" header, select "Project Explorer".
4.
Right click on the desired Project and select "Export Build".
5.
This will open a .txt file in the editor containing the filepath of the compiler executable.
6.
Identify the line that is responsible for compiling the "main" file in your project. It should begin with a file path like: "C:\Program Files\SEGGER\SEGGER Embedded Studio for ARM 7.32\gcc\arm-none-eabi\bin\cc1". The text after the final separator in the path should be one of: cc1, cc1plus, or segger-cc. These are also the names that should be passed to the –compiler= option.

Compiler options that affect the parsing step of the compiler, such as macro definitions and include options, should be passed to pclp_config.py by using the –compiler-options option.

7.
If creating a configuration for segger-cc:
(a)
The -cc1 option must be included and should be first in the list of options passed to –compiler-options.
(b)
The -triple option must also be included in the list passed to –compiler-options.
8.
The compiler configuration for this example can be generated by running the following command:
python pclp_config.py 
 --compiler=cc1 
 --compiler-bin="C:\Program Files\SEGGER\SEGGER Embedded 
   Studio for ARM 7.32\gcc\arm-none-eabi\bin\cc1" 
 --compiler-options="..." 
 --config-output-lnt-file=co-segger-cc1.lnt 
 --config-output-header-file=co-segger-cc1.h 
 --generate-compiler-config

See 2.3.21 Integrating PC-lint Plus with SEGGER IDE for instructions on integrating PC-lint Plus with the SEGGER IDE.

2.3.13 Creating a project configuration with a JSON compilation database

The simplest and easiest way to generate a project configuration is by using the JSON compilation database created by your build system (typically named compile_commands.json). The same pclp_config utility used to generate your compiler configuration can generate a complete project configuration from this file using the following command:

python pclp_config.py 
   --compiler=gcc 
   --compilation-db=compile_commands.json 
   --config-output-lnt-file=project.lnt 
   --generate-project-config

replacing gcc with the compiler-family of your compiler and compile_commands.json with the name of your compilation database. The project may then be analyzed by running PC-lint Plus with the arguments compiler.lnt project.lnt where compiler.lnt is your compiler configuration.

If your existing build process does not already produce a compilation database, you can instruct it to do so using the instructions below depending on your build system. If your build system is not capable of producing a compilation database, you can either use a third-party tool such as Bear to generate one or use the provided imposter program as described in the following two sections to achieve a similar result.

Generating a compilation database with cmake

When using Ninja or a Makefile generator, cmake can produce a compilation database by using the option -DCMAKE_EXPORT_COMPILE_COMMANDS=ON when building.

Generating a compilation database with iarbuild

Recent versions of iarbuild can generate a compilation database using the -jsondb option, e.g.:

    iarbuild project.ewp -jsondb config -output compile_commands.json

Where project.ewp is the IAR Embedded Workbench project file and config is the name of the build configuration (Release, Debug, etc).

Generating a compilation database with Meson

Meson automatically generates compile_commands.json.

Generating a compilation database with Ninja

Ninja can generate a compilation database using the command:

    ninja -t compdb > compile_commands.json

since version 1.10. For versions of Ninja between 1.2 and 1.9, a rule name is required, e.g.:

    ninja -t compdb rule1 [rule2...] > compile_commands.json

Generating a compilation database with Qbs

The Qbs build system can generate a compilation database with the command:

    qbs generate –generator clangdb

Generating a compilation database with SCons

Since version 4.0, SCons can generate a compilation database using the instructions provided here.

2.3.14 Creating a project configuration with make or cmake

1.
Open a command prompt and locate the compiler used in your build process with the which or where command as shown in step #1 of 2.3.3 Creating a compiler configuration for GCC or Clang .
2.
Set the IMPOSTER_LOG environment variable to the full path of the file that will hold compiler invocations. On most shells this command will look like:
 export IMPOSTER_LOG=/path/to/imposter-log    

 The file name is not important. If the file already exists, it should be truncated before continuing as imposter.exe appends entries to this file without truncating it.

3.
From a clean build directory, run your build process using the compiled imposter program as the compiler. This is generally accomplished by overriding the CC or CXX make variables. For make, this can be done with the command:
make -e CC=/path/to/imposter ...      

You may also be able to set the CC or CXX environment variables on the command line before running the build process:

export CC=/path/to/imposter          

You may need to build the project from scratch in a new directory for make/cmake to use the new setting.

Note: If your project fails to properly build using imposter as the compiler you may need to have imposter run the compiler during the build process. This can be accomplished by running the following command and then running the build process:

export IMPOSTER_COMPILER=/path/to/compiler    

Note: If your project contains C and C++ modules and uses a different compiler for each, using IMPOSTER_COMPILER will not be sufficient since this solution supports only one compiler. In this case, you will need to set IMPOSTER_COMPILER_ARG1 (to any value), such as with the command:

export IMPOSTER_COMPILER_ARG1  

And set the CC and CXX variables like so:

export CC="/path/to/imposter /path/to/c-compiler" 
export CXX="/path/to/imposter /path/to/c++-compiler"  

Setting IMPOSTER_COMPILER_ARG1 will cause imposter to use the first argument it is called with as the compiler to invoke, which allows multiple compilers to be supported in a single build. Note that IMPOSTER_COMPILER must not be set for this to work.

Note: When using CMake it is often necessary to use imposter as the compiler during the project generation step. If the CMake configuration process causes test files to be compiled to assess compiler features you will need to clear IMPOSTER_LOG before running the build process to avoid including them in your project configuration.

4.
Run pclp_config to generate a project configuration using the compiler invocations logged by imposter:
python pclp_config.py 
   --compiler=gcc 
   --imposter-file=/path/to/imposter-log 
   --config-output-lnt-file=project.lnt 
   --generate-project-config

Replacing gcc with the appropriate compiler name, /path/to/imposter-log with the same value that IMPOSTER_LOG was set to above and project.lnt with the desired value.

PC-lint Plus can now analyze your project by running lint compiler.lnt project.lnt.

2.3.15 Creating a project configuration with MSBuild on Windows

Note: It is assumed that you have compiled the imposter.c file provided in the config/ directory of the PC-lint Plus distribution to an executable called imposter.exe.

1.
Follow steps #1 and #2 from Creating a compiler configuration for Microsoft C/cpp compilers to open a Developer Command Prompt and locate the cl.exe binary.
2.
Locate the Visual Studio project or solution file for your project. Solution files have a .sln extension.
3.
In the Developer Command Prompt, set the IMPOSTER_LOG environment variable to the full path where compiler invocations should be logged:
set IMPOSTER_LOG=/path/to/imposter-log  

The file name is not important. If the file already exists, it should be truncated before continuing as imposter.exe appends entries to this file without truncating it.

4.
Run msbuild on your project file using imposter.exe as the compiler by executing the following commands in the same Developer Command Prompt:
msbuild project.sln /t:clean 
msbuild project.sln /p:CLToolExe=imposter.exe /p:CLToolPath=C:\path\to\imposter

Note that the name without a path is provided to the /p:CLToolExe option and the path, without the file name, is provided to the /p:CLToolPath option.

Note: If your project fails to properly build using imposter.exe as the compiler you may need to have imposter.exe run the compiler during the build process. This can be accomplished by running the following command and then running the two above commands in the same Developer Command Prompt:

set IMPOSTER_COMPILER=/path/to/cl.exe  
5.
Run pclp_config.py to process the output of the imposter log and generate a project configuration:
python pclp_config.py 
   --compiler=vs2015 
   --imposter-file=/path/to/imposter-log 
   --config-output-lnt-file=project.lnt 
   --generate-project-config

Replacing vs2015 with the appropriate compiler name, /path/to/imposter-log with the same value that IMPOSTER_LOG was set to above and project.lnt with the desired value.

PC-lint Plus can now analyze your project by running lint compiler.lnt project.lnt.

2.3.16 Integrating PC-lint Plus with IAR Embedded Workbench

By integrating PC-lint Plus with IAR Workbench, you can run PC-lint Plus from within the IDE and click on the locations given in the message text to navigate to the provided location. To integrate PC-lint Plus with IAR Workbench, you will need the env-iar.lnt file (found in the lnt directory in the PC-lint Plus distribution); this setup assumes you have copied the file to the same directory as your IAR compiler configuration files. See 2.3.5 Creating a compiler configuration for IAR Embedded compilers for instructions on creating a compiler configuration for your IAR compiler. The following steps will configure IAR Workbench to run PC-lint Plus:

1.
In the Tools menus, select "Configure Tools".
2.
In the configuration dialog box that opens up, click "New".
3.
For "Menu Text" enter "Analyze Current File with PC-lint Plus", you might want to add text to indicate the chipset if you will be configuring PC-lint Plus for multiple IAR compilers.
4.
For "Command", enter the location of the PC-lint Plus binary.
5.
For "Argument", enter the following:

-u -iconfig-loc env-iar.lnt iar-lint-config $FILE_PATH$

replacing config-loc with the full path of the directory containing your configuration files and iar-lint-config with the name of your compiler configuration file, e.g. co-iar-arm.lnt.

Note: If config-loc contains spaces, you will need to include quotes around the argument, e.g.:

"-iC:\location with spaces\lint"

6.
Check the box "Redirect to Output Window".
7.
Select "Always" from the "Tool Available" dropdown.
8.
Click on "OK".

The result should look something like:

PIC

To run PC-lint Plus from within IAR Workbench on the current file, select the newly added entry from the Tools menu:

PIC

To run PC-lint on the full project, follow the above instructions to create a new Tool but for "Menu Text" use "Analyze Project with PC-lint Plus" and for the Argument, replace $FILE_PATH$ with $PROJ_DIR$\*.c.

If you have a project-specific configuration file, you can add this at the end of the command line in step #4. If the configuration file contains the list of source files that PC-lint Plus should process, remove the $FILE_PATH$/$PROJ_DIR$.c portion from the "Argument" in step #5.

Note: The env-iar.lnt file is provided with PC-lint Plus and contains special control characters necessary for proper formatting in IAR Workbench to make locations referenced in messages "clickable". Making modifications to this file may break this formatting.

Assigning a keyboard shortcut to easily run PC-lint Plus:

1.
In the Tools menus, select "Options".
2.
From the left side bar select "Key Bindings".
3.
From the "Menu" drop down select "Tools".
4.
Scroll down to locate "Analyze Current File with PC-lint Plus" or the name you choose from the previous section.
5.
Click on the name and the click on the empty section of "press shortcut key".
6.
You can now click the keys to associate with running PC-lint Plus e.g. "Ctrl + Shift + P".
7.
Click on "Set" and then "OK".

Now you can run PC-lint Plus on a file by pressing the keyboard shortcut assigned.

Adding PC-lint Plus to the "Toolbar":

1.
Click on "Toolbar Options" found here.

PIC

2.
Hover over "Add or Remove Button" and then click on "Customize".
3.
From the "Categories" choose "Tools"
4.
On the right-hand side locate "Analyze Current File with PC-lint Plus" or the name you choose from the previous section.
5.
Drag and drop the name of the external tool to the "Toolbar".

The result should look something like:

PIC

2.3.17 Integrating PC-lint Plus with Keil μVision

To set up PC-lint Plus within Keil μVision:

1.
In the "Tools" menu, select "Set-up PC-Lint..."
2.
An error message will likely appear informing you that μVision could not automatically locate the PC-lint Plus executable. This can be ignored as it will be selected in the next step.
3.
In the "Lint Executable" field, browse for your PC-lint Plus executable.
4.
Uncheck the "Add Compiler Config" checkbox as the configuration files included with μVision were intended for older PC-lint products.
5.
In the "Config File" field, browse for the compiler configuration you generated in the previous section.
6.
In the "Include Project Information" group, all of the items that are not disabled can be checked.
7.
In both the "C" and "C++" tabs, set "Rules" to "<not used>" and ensure the other fields within the tab are empty.
8.
Press "OK" to dismiss the dialog.

To run PC-lint Plus within Keil μVision:

2.3.18 Integrating PC-lint Plus with MPLAB X

PC-lint Plus can be used from within MPLAB X using a plugin provided by Microchip. To install the plugin:

1.
In the "Tools" menu, select "Plugins"
2.
From the "Available Plugins" tab, check the "Install" checkbox next to "PCLint"
3.
Click the "Install" button

To configure the plugin:

1.
In the "Tools" menu, select "Options"
2.
Select the "Embedded" Tab in the top row, then the "PClint" tab
3.
In the "Location" field, browse for your PC-lint Plus executable
4.
In the "Options" field, select "UserOptionFile"
5.
In the "User Option File" field, browse for the compiler configuration you generated in the previous section.
6.
In the "Standards" field, select "NOSTANDARD"
7.
Press "OK" to dismiss the dialog

To run PC-lint Plus within MPLAB X using the configured plugin:

Note: This plugin was developed by a third party for an older PC-lint product. Some features of the plugin, such as the coding standard menu, use outdated configuration files. If you intend to use a MISRA standard with MPLAB X, use the latest version of the configuration file included with PC-lint Plus. Coding standard configuration files can be added to the configuration file specifed in the "Options" dialog to use them with the plugin.

2.3.19 Integrating PC-lint Plus with Eclipse-based IDEs

The following instructions describe how to integrate PC-lint Plus with Eclipse-based IDEs including (but not limited to) Code Composer Studio, STM32CubeIDE, S32 Design Studio, etc. This integration would highlight messages in the Console view, show parsed output in the Problems pane, and allow navigation to the message’s location by clicking on it. Please be aware that a compiler configuration is still necessary as outlined in the corresponding subsection.

Using the below content create the file eclipse.lnt. This file provides the necessary options for this integration and will be referenced at a later step.

eclipse.lnt:

   -"format=%f:%l: %t: %t %n: %m" // formatting options 
   -width=0                   // no line wrapping 
   +flm                      // lock format 
   +ffn                      // always emit absolute paths

Define a new error parser to recognize the output of PC-lint Plus:

1.
Open the IDE and from the menu bar select "Window", "Preferences".
2.
In the "Preferences" window select "C/C++", "Builds", "Settings".
  • Note: If the "C/C++" menu isn’t available then select the blue text labeled "Show advanced settings".

3.
Select "Add..." and, in the "Name" field, enter "PC-lint Plus".
4.
Select "PC-lint Plus" and select "Move Up" until PC-lint Plus is the first error parser.
5.
In the "Error Parser Options" panel select "Add..." three times.
6.
Fill in the columns of the generated three empty patterns with the following:
Severity  Pattern                                 File Line Description 
Error     (.*):(\d+):\s+(error):\s+(.*)                $1  $2    $4 
Warning   (.*):(\d+):\s+(warning):\s+(.*)              $1  $2    $4 
Info      (.*):(\d+):\s+(info|note|supplemental):\s+(.*)  $1  $2    $4
7.
Select "Apply and Close".

Adding PC-lint Plus as a build option:

1.
From the menu bar select "Project", "Properties", then "C/C++ Build" from the sidebar.
  • Note: If the "C/C++ Build" menu isn’t available then select the blue text labeled "Show advanced settings".

2.
Select "Manage Configurations..." and then "New..".
3.
In the "Name" field type in "PC-lint Plus" and for the "Description" type in "Analyze current file using PC-lint Plus".
4.
Under "Copy settings from" select "Existing configuration" and choose "Debug".
5.
Make sure that PC-lint Plus is selected and active in the "Configuration" drop-down menu.
6.
Under the "Builder Settings" tab uncheck "Use default build command" and add the full path to the PC-lint Plus executable to the "Build command" field.
7.
Uncheck "Generate Makefiles automatically".
8.
Under the "Behavior" tab select "Use custom build arguments" and leave the field empty.
  • Note: If the "Use custom build arguments" option isn’t available then uncheck "Enable parallel builds" and keep "Stop on build error" checked.

9.
Uncheck "Build on resource save (Auto build)" and "Clean".
10.
In the checked "Build (Incremental build)" add the path to eclipse.lnt with a space at the end followed by ${selected_resource_loc}.
  • Note: To analyze a project rather than a single file, add the following instead ${selected_resource_loc}/*.c*. The project directory containing the source files must be selected in the "Project Explorer" pane instead of a source file. This argument can be customized as needed if using a generated project configuration instead.

11.
In the sidebar under "C/C++ Build" select "Settings".
12.
Move to the "Error Parser" tab to enable "PC-lint Plus" and move it to the top using the "Move Up" button.
13.
Select "Apply and Close".

To run PC-lint Plus within the IDE:

1.
Select the source file that you would like to analyze from the "Project Explorer" pane.
2.
From the toolbar select the build icon and from the dropdown menu select "PC-lint Plus".

Note: If a variable expansion error occurs when running PC-lint Plus, ensure the target source file was last selected in the "Project Explorer" and retry.

Note: Depending on the IDE’s default settings, messages in the info category may be filtered out. To display info messages, adjust the filters in the "Problems" view.

2.3.20 Integrating PC-lint Plus with Visual Studio Code

The built-in Visual Studio Code “Tasks” feature can be used to integrate PC-lint Plus without using an extension. This can be used to provide the full output in the “Terminal” window and the issued messages in the “Problems” window with code underlining, e.g.:

PIC

The Visual Studio Code tasks.json file, settings.json file, and a PC-lint Plus configuration that can be used to integrate PC-lint Plus as a Task are provided below.

Note that you will still need a compiler and project configuration as described in the enclosing subsection.

vscode.lnt:

// See https://go.microsoft.com/fwlink/?LinkId=733558 
// for documentation on the tasks.json format 
 
// Options for Visual Studio Code compatibility 
-width=0                      // no line wrapping 
-h1                          // set the message height to 1 
-"format=%f:%l:%C: %t: %t %n: %m" // match compiler message format 
+ffn                         // always emit absolute paths

settings.json:

{ 
"pclp_exe": "C:\\path\\to\\pclp64.exe", 
"vscode_lnt": "C:\\path\\to\\vscode.lnt", 
"terminal.integrated.scrollback": 3000, 
"win_command": "| ForEach-Object { '{0}.{1}' -f ++$i, $_ -replace '\\.:', '.${file}:'}", 
"mac_command": "| nl -w1 -s. | sed 's#\\.:#.${file}:#g'", 
"linux_command": "| nl -w1 -s. | sed 's#\\.:#.${file}:#g'" 
}

tasks.json:

{ 
"version": "2.0.0", 
"tasks": [ 
   { "icon": {"color": "terminal.ansiWhite","id": "search"}, 
   "presentation": { 
      "reveal": "silent", 
      "revealProblems": "always", 
      "close": false, 
      "clear": true, 
      "panel": "dedicated", 
      "showReuseMessage": false 
   }, 
   "runOptions": {"reevaluateOnRerun": true}, 
   "label": "PC-lint Plus", 
   "type": "shell", 
   "detail": "Analyze current file with PC-lint Plus.", 
   "windows":{ 
      "command": "${config:pclp_exe} ${config:vscode_lnt} '${file}' ${config:win_command}", 
      "options": { "shell": { "executable": "powershell" } } 
   }, 
   "osx":{ 
      "command": "${config:pclp_exe} ${config:vscode_lnt} '${file}' ${config:mac_command}" 
   }, 
   "linux":{ 
      "command": "${config:pclp_exe} ${config:vscode_lnt} '${file}' ${config:linux_command}" 
   }, 
   "problemMatcher":{ 
      "owner": "C/C++", 
      "fileLocation": [ 
          "absolute" 
      ], 
      "severity": "info", 
      "source": "ID:", 
      "pattern": 
      { 
"regexp": "^(\\d+).(.*):(\\d+):(\\d+):\\s+(warning|error|info|note|supplemental):\\s+(.*)$", 
      "code": 1, 
      "file": 2, 
      "line": 3, 
      "column": 4, 
      "severity": 5, 
      "message": 6 
      } 
   } 
   } 
]}

To add the Task on a user level:

1.
Open the IDE.
2.
From the menu bar, select "File", "Preferences", "User Tasks".
  • Note: You might need to select "Others" if a dropdown menu appears.

3.
Copy the content of tasks.json mentioned previously and add it to the tasks.json file that is now open on the IDE.
  • Note: The previous content in the tasks.json can be removed since it shows an example unless you have defined additional tasks in which case PC-lint Plus can be added to the list.

4.
From the menu bar, select "File", "Save" to save the changes.
5.
From the menu bar, select "View", "Command Palette..."
6.
In the empty field, type in "Open User Settings (JSON)". Then select the option once found.
7.
Copy the lines from settings.json mentioned previously and add it to the settings.json file that is now open in the IDE.
  • Note: "C:pathtopclp64.exe" and "C:pathtolntvscode.lnt" should be replaced with the PC-lint Plus executable location and the location of the vscode.lnt mentioned above respectively.

8.
From the menu bar, select "File", "Save" to save the changes.

Note: This task can be added on a project level by creating a folder named .vscode in the project directory. Inside the .vscode folder, create two additional files named settings.json and tasks.json with their content being what is described previously.

To bind a keyboard shortcut to easily run the Task:

1.
From the menu bar, select "View", "Command Palette..."
2.
In the empty field, type in "Open Keyboard Shortcuts (JSON)". Then select the option once found.
3.
Add the following to the file:
[{ 
   "key": "ctrl+shift+alt+p", 
   "command": "workbench.action.tasks.runTask", 
   "args": "PC-lint Plus" 
}]

This will allow the Task to run by clicking "ctrl+shift+alt+p".

To test the Task, start by opening a test.c file and running the Task by using the keyboard shortcut. Alternatively the Task can run by following these steps:

1.
From the menu bar, select "View", "Command Palette..."
2.
In the empty field, type in "Tasks: Run task". Then click on the option once found.
3.
Select "PC-lint Plus".

To enhance the experience of using this task, the third-party extension Error Lens can be used to better highlight the location of issued messages and automatically display the text of the message.

2.3.21 Integrating PC-lint Plus with SEGGER IDE

Note: This tutorial is intended for SEGGER Embedded Studio Version 5.68 or newer.

By integrating PC-lint Plus with SEGGER IDE, you can run PC-lint Plus from within the IDE and click on the locations given in the message text to navigate to the provided location. See 2.3.12 Creating a compiler configuration for SEGGER compilers for instructions on creating a compiler configuration for your SEGGER compiler. The following steps will configure the SEGGER IDE to run PC-lint Plus:

1.
Select the "Tools" menu.
2.
Within the "Tools" menu, select "Options".
3.
Within "Options", select the "Building" tab.
4.
Scroll down to find "Global Macros", double click it.
5.
In the text box, define a new global macro called LintDir. This macro will expand to the absolute path of the directory containing the PC-lint Plus executable. If this path includes spaces, do not surround the path with quotes, this will be taken care of in a later step. The definition of the macro should adhere exactly to the following format: LintDir=path/to/lint/directory.
(a)
A definition of LintDir on Windows would look like:
LintDir=C:\Users\user\segger-projects\lint-dir
(b)
On Linux, this would look like:
LintDir=/home/user/segger-projects/lint-dir

Additionally, the .lnt and .h files generated in 2.3.12 should be placed in a folder called lnt which is subdirectory of the LintDir directory.

6.
Repeat the process of creating a global macro for each of the following. Ensure any file extensions (such as .exe or .lnt) are included in the RHS of the macro definition:
(a)
LintExecutable=<name of your PC-lint Plus executable>
i.
This macro should not include the path to the executable.
(b)
LintConfiguration=<name of your .lnt config file>
i.
Here, the .lnt config file would be one of: co-segger-cc1.lnt, co-segger-cc1plus.lnt, or co-segger-cc.lnt if you have adhered to the naming conventions for –config-output-lnt-file presented in 2.3.12 . However, these names can be custom. If you have used a custom name, LintConfiguration should expand to that name.
7.
Click "OK" to close the global macros menu.
8.
Click "OK" to close the options window.
9.
Next, open tools.xml by selecting "File", then "Open Studio Folder", then "External Tools Configuration". The file will open in the SEGGER editor.
10.
Copy and paste the following XML entry before the line in tools.xml that contains </tools>:
   <!-- PC-lint Plus - https://pclintplus.com/ --> 
   <item name="Tool.PClintPlus"> 
      <menu>&amp;PC-lint Plus</menu> 
      <text>PC-lint Plus</text> 
      <tip>Use PC-lint Plus to analyze the selected file or folder</tip> 
      <key>Ctrl+L, Ctrl+P</key> 
      <match>*.c;*.cpp</match> 
      <message>Analyzing</message> 
      <commands> 
      &quot;$(LintDir)/$(LintExecutable)&quot; -i&quot;$(LintDir)/lnt&quot; 
      &quot;$(LintDir)/lnt/$(LintConfiguration)&quot; &quot;$(DEFINES)&quot; 
      $(INCLUDES) -u -b +ffn -width(0,4) -h1 
      &quot;-format_category[info,Info]&quot; 
      &quot;-format_category[supplemental,note: supplemental]&quot; 
      &quot;-format=%f:%l:%C:\s%t:\s%m [-e%n]&quot; &quot;$(InputPath)&quot; 
      </commands> 
   </item>
11.
This XML entry assumes that your C source files have the extension .c and your C++ source files have the extension .cpp. If you are using different extensions, you will need to modify the match element.
12.
Ensure the entire commands section is on a single line with a space between each option.
13.
Finally, save tools.xml and restart SEGGER IDE.

To run PC-lint Plus on a single file, right click the desired source file, then select "PC-lint Plus".
To run PC-lint Plus on the entire project, right click the desired source directory, then select "PC-lint Plus".
Alternatively, Ctrl + L + P can be used to run PC-lint Plus. Ensure that you have the desired source file or source directory highlighted in the Project Explorer before using this hotkey.

2.3.22 Using the pclpvscfg.exe GUI utility to generate a compiler and project configuration for Microsoft Visual Studio

PC-lint Plus ships with a GUI utility to automate the steps involved in generating simple compiler and project configurations for Microsoft Visual Studio. It will generate a batch file that can then be executed to generate a compiler and project configuration. pclpvscfg.exe can be found in the config/ directory of the PC-lint Plus distribution. This utility also relies on vswhere.exe which is redistributed with permission from Microsoft. pclpvscfg.exe must be executed from the same directory as vswhere.exe and pclp_config.py must be in the same directory as compilers.yaml and imposter.c (as they are in the distribution).

Using pclpvscfg.exe:

1.
If your project or solution builds a 64-bit target, check the "64-bit build" checkbox.
2.
The main dialog lists detected Visual Studio installations. Double click a Visual Studio installation path from the list to continue. This must be the correct Visual Studio version for your project or solution.
3.
To use the generated batch file to create a configuration: from a command prompt, execute the saved batch file. Note that this batch file will clean and rebuild the selected project or solution. Cleaning a build will delete build files. If no errors occur when running the generated batch file, the configuration files will be ready for use in the locations chosen in pclpvscfg.exe.

Troubleshooting:

2.3.23 pclp_config Options Reference

pclp_config accepts a variety of options that can be used to fine-tune generated configurations and for troubleshooting purposes. The most common options used with pclp_config are described above, below is a complete list of options supported by pclp_config. Options that accept arguments can be specified as either –option=arg or –option arg.





Option

Description





–help

Show the help screen.

–compiler-database

Used to specify the location of the compiler database; compilers.yaml is the default.

–list-compilers

Dump a list of compilers supported by the compiler database along with a short description of each.

–compiler

Used to specify the name of a compiler or compiler family from the list of supported compilers.

–compiler-bin

Used to specify the full path of the compiler binary for operations that need access to the compiler (such as the –generate-compiler-config and –compiler-version operations).

–compiler-version

Runs the specified compiler and attempts to extract and display version information. Useful for troubleshooting. Emits ’None’ if extraction fails for any reason. Must be used with –compiler and –compiler-bin.

–generate-compiler-config

Instructs pclp_config to generate a compiler configuration for the specified compiler. Usually used with –compiler and –compiler-bin.

–generate-project-config

Instructs pclp_config to generate a project configuration. This would be done using compile commands logged from running the build process with the imposter program in place of the compiler or using a JSON compilation database. Used with the –compiler, –imposter-file or –compilation-db, and –config-output-lnt-file options.

–config-output-lnt-file

Specifies the name of the configuration file to write when generating compiler or project configurations.

–config-output-header-file

Specifies the name of the compiler configuration header file to generate.

–imposter-file

Specifies the name of the log file containing compile commands logged by the imposter process.

–compilation-db

Specifies the name of the JSON compilation database used to generate a project configuration.

–prefix-directory-options

Specifies additional compiler options for which the argument should be prefixed by the directory entry in a JSON compilation database if the argument is not an absolute path. By default, the options -I, /I, and @ receive this treatment.

–response-file-prefix

Specifies the string used to introduce the name of a response file within a JSON compilation database. The default value is ’@’, if your compiler uses a different option or prefix to specify a response file, e.g. -f, this option can be used recognize it.

–posix-command-parsing

Specifies that posix-like parsing behavior should be employed when processing response files, arguments embedded in the command field of a JSON compilation database, and in the application of the –shell-parse-compiler-options option. In particular, backslashes are treated as escape characters and quotes may be used to specify arguments containing spaces. This is the default behavior on Linux and macOS.

–no-posix-command-parsing

Specifies that non-posix-like parsing behavior should be employed when processing response files, arguments embedded in the command field of a JSON compilation database, and in the application of the –shell-parse-compiler-options option. In particular, backslashes and quotes are treated as literal characters. This is the default behavior on Windows.

–shell-parse-compiler-options

Specifies that shell-like parsing should be employed when processing arguments to –compiler-options, –compiler-c-options, and –compiler-cpp-options. The –posix-command-parsing and –no-posix-command-parsing options control whether this uses posix-like or non-posix-like parsing.

–source-pattern

A regular expression used to distinguish source modules from options in the compile commands log generated by the imposter process. The default value is .*\.(c|cpp)$ and matches any string that ends with .c or .cpp.

–module-include-pattern

A regular expression pattern used to specify which modules will be included in a generated project configuration. This option may be used multiple times to specify multiple patterns, a module that matches any of the provided patterns will be included unless it also matches a pattern specified by –module-exclude-pattern.

–module-exclude-pattern

A regular expression pattern used to specify modules that should be excluded from a project configuration. This option may be used multiple times to specify multiple patterns. A module matching any of the patterns provided by this option will be excluded from the generated project configuration.

–compiler-options

A space separated list of base compiler options. If you are targeting an architecture other than the compiler’s default, you should include the option that specifies the target architecture when generating a compiler configuration to ensure the correct values for size options in the generated configuration. Compiler options specified with this option are applied when the compiler is invoked in either C or C++ mode.

–compiler-c-options

Similar to –compiler-options but only used when invoking the compiler in C mode. Use for C-only language options such as setting the language version.

–compiler-cpp-options

Similar to –compiler-options but only used when invoking the compiler in C++ mode. Use for C++-only language options such as setting the language version.

–repl

Start a Read Eval Print Loop where compiler options are read from stdin and transformed PC-lint Plus options are printed to stdout. Requires –compiler. This is a debugging option.

–scavenge-files

Specifies the list of files to attempt to extract macro names from when performing macro scavenging.

–scavenge-dirs

Specifies the directories to recurse looking for files to extract macro information from when performing macro scavenging.

–scavenge-pattern

A regular expression specifying files that should be examined for macro information when using –scavenge-dirs.

–dont-filter-feature-test-macros

Instructs pclp_config to not filter C++ feature test macros in the generated compiler configuration header file. By default, feature test macros extracted from the compiler which would limited or removed to match the language support in PC-lint Plus.

–header-option-use-
enclosing-directory

Use the built-in %ENCLOSING_DIRECTORY% environment variable to provide an ‘absolute’ path for the compiler configuration -header option.

–debug-dont-show-compiler-errors

When an unexpected condition is encountered, do not show the associated compiler invocation command line, standard input, standard output, and standard error.

–debug-show-command

Show the compiler invocation command lines.

–debug-show-input

Show the compiler invocation standard input.

–debug-show-output

Show the compiler invocation standard output and error.

–debug-show-trace

Show the internal processing steps.

–debug-show-tempfile-cleanup

Show debugging messages regarding the cleanup of generated temporary files.

–debug-show-tempfile-derived

Show debugging messages regarding the tempfile_derived rules.

2.3.24 imposter Options Reference

As previously mentioned, the imposter program uses environment variables to control its behavior instead of traditional command line arguments. The most commonly used variables are IMPOSTER_LOG and IMPOSTER_COMPILER although the imposter supports a variety of other options for specific situations. A full list of options supported is provided below.





Environment Variable

Description





IMPOSTER_EXIT_SUCCESS

The value with which the imposter should exit when not invoking a compiler and when no error occurs. This should be the same value your compiler exits with when there is no compilation error or the value your build system expects for a successful compilation. If no success value is supplied, 0 is used.

IMPOSTER_EXIT_FAILURE

The exit code used when an error is encountered before invoking the compiler. This value is used if the log file cannot be written to, if we run out of memory, or if the compiler fails to invoke. If the compiler is successfully invoked, the imposter returns the value that the compiler returned. If no failure value is supplied, the default of 1 is used.

IMPOSTER_LOG

The name of the log file to which compiler commands should be written. If an absolute path is not provided, the path is relative the directory in which the imposter is invoked. If no value is provided, output is written to stdout.

IMPOSTER_COMPILER

The full path of the compiler to invoke after logging invocation information. If no value is provided, no compiler is invoked (unless IMPOSTER_COMPILER_ARG1 is set as described below) and the imposter exits with IMPOSTER_EXIT_SUCCESS on success.

IMPOSTER_COMPILER_ARG1

If this variable is set to any value (including an empty value) and IMPOSTER_COMPILER is NOT set, the compiler is expected to be provided as the first argument to the imposter program and will be executed with the remaining argument list. If this variable is set and there is no first argument, the imposter will exit with the failure exit code. This functionality is useful when the imposter needs to stand in for multiple compilers during the build process, such as both a C and C++ compiler.

IMPOSTER_AUTO_RSP_FILE

If this variable is set, the value is interpreted to be a response file that should be processed and logged to the beginning of the invocation.

IMPOSTER_NO_RSP_EXPAND

If an argument is received that starts with ’@’, this is treated as a response file and the argument is replaced with the parsed arguments contained within the response file (the name left after removing the ’@’). If the file cannot be opened, or IMPOSTER_NO_RSP_EXPAND is set, the entire argument is logged as is. Note that in all cases, if the compiler is invoked, it receives the unexpanded argument; the expansion is limited to the logging process.

IMPOSTER_PRE_2008_PARAMS

When parsing response files, the parameters it contains are processed using the Windows command line parameter parsing rules. There is a subtle and undocumented difference between the way handling of consecutive quotes was handled prior to 2008 and after 2008. By default, the post-2008 rules are employed. If this variable is set, the pre-2008 rules are instead employed.

IMPOSTER_INCLUDE_VARS

A semi-colon separated list of environment variables from which to extract header include information. If this variable is not set, the default list of: INCLUDE;CPATH;C_INCLUDE_PATH;CPLUS_INCLUDE_PATH is used. Each environment variable processed is expected to contain a list of paths, which are emitted as -I options in the log file. The delimiter used and how to change it are described below in IMPOSTER_INCLUDE_DELIM. Environment variables are processed in the order provided. Environment variables included in this list that are not set are ignored. Setting IMPOSTER_INCLUDE_VARS to an empty value will disable this processing.

IMPOSTER_INCLUDE_DELIM

The character(s) recognized as delimiters when parsing include directories specified from environment variables (such as those specified by IMPOSTER_INCLUDE_VARS). By default, this is ’;’ on Windows and ’:’ on other platforms. Setting this variable will override the default. Each character appearing in the value of this variable will be considered to be a delimiter. For example, setting this variable to ’|!:’ will cause any of these characters to separate directories appearing in the include variables.

IMPOSTER_MODULES_IN_WORKING_DIR

If this variable is set, the working directory will be preprended to each argument which appears to be the relative path of a module. Apparent options, absolute paths, or arguments lacking one of the extensions defined in IMPOSTER_MODULE_EXTENSIONS will be ignored.

IMPOSTER_MODULE_EXTENSIONS

If this variable is set, its value replaces the default module extension list: ".c;.C;.cpp;.CPP;.cc;.CC". The value is a case-sensitive list of extensions (including the dot) delimited by semicolons. It is used only to determine what constitutes a module for the purposes of prepending the working directory and will not otherwise affect the configuration process.

IMPOSTER_PATH_ARGUMENT_RELATIVE_TO
_WORKING_DIR_OPTION_INTRODUCERS

If this variable is set, any argument that initially matches one of the provided semicolon-delimited strings will have the working directory inserted after the option introducer if the remainder of the option does not appear to be an absolute path. If an option introducer from this list appears as a standalone compiler argument with no appended suffix to insert a working directory before, then the working directory will be inserted before the subsequent argument (if any) unless the next argument is an absolute path or an option. This is intended for options like a -I option where, in e.g. -Irelative/path the working directory needs to be inserted just after -I and in -I path/as/next/arg it needs to be added to the following argument. By contrast, a -Dmacro=value should not have the working directory inserted before the macro name.


2.4 Configuring manually

Note: PC-lint Plus ships with an automated configuration tool named pclp_config.py, which can be found in the config/ directory of the PC-lint Plus distribution. This Python script simplifies the process of configuring PC-lint Plus for your compiler and project. We recommend the use of pclp_config.py over manual configuration for all compilers supported by pclp_config.py. See section 2.3.2 to get started with pclp_config.py.

Step 1 - Configure Include Directories using the -i option

PC-lint Plus needs to know where the compiler looks for system headers, there are several ways to obtain this information depending on the capabilities of the compiler including:

Once the list of standard library search paths has been determined using one of the above methods, create a file named lint-includes.lnt containing this list with each directory prepended with -i , for example:

-i/usr/lib/gcc/x86_64-linux-gnu/4.8/include 
-i/usr/local/include 
-i/usr/include/x86_64-linux-gnu 
-i/usr/include

If you have directories that contain space characters, you will need to surround the path with double quote characters, e.g.:

-i"/location of usr/include"  

Header files found while searching directories specified by -i options are treated as library by default. If the option +libclass() is used or +libclass(angle) is used and the headers are included without using angle brackets, headers found in these directories will not be considered library. Corresponding +libdir options can be added to lint-includes.lnt to ensure that these directories are treated as library in such cases, e.g.:

+libdir(/usr/lib/gcc/x86_64-linux-gnu/4.8/include)

Step 2 - Extract Predefined Macros

PC-lint Plus needs to know about compiler-defined macros since these will be used by the implementation. Many compilers provide an option to dump such predefined macros to a file. This is by far the easiest way to extract the macros if your compiler supports it.




clang

clang -dM -E -xc /dev/null

clang++ -dM -E -xc++ /dev/null




GCC

gcc -dM -E -xc /dev/null

g++ -dM -E -xc++ /dev/null




IBM XL

xlc -qshowmacros -E /dev/null

xlc++ -qshowmacros -E /dev/null




Solaris Studio

cc -xdumpmacros -E /dev/null

CC -xdumpmacros -E /dev/null






Step 3 - Establish the sizes of the fundamental types

PC-lint Plus needs to know the size of the basic types (int, short, float, double, pointers, etc.). In this step we’ll create a file called size-options.lnt that contains the sizes of these types. To generate this file, compile and run the following C program using the same compiler and target options used to compile the code that PC-lint Plus will be processing.

#include <stdio.h> 
#include <wchar.h> 
int main(void) { 
   printf("-ss%zu  ",  sizeof(short)); 
   printf("-si%zu  ",  sizeof(int)); 
   printf("-sl%zu  ",  sizeof(long)); 
   printf("-sll%zu ",  sizeof(long long)); 
   printf("-sf%zu  ",  sizeof(float)); 
   printf("-sd%zu  ",  sizeof(double)); 
   printf("-sld%zu ",  sizeof(long double)); 
   printf("-sp%zu  ",  sizeof(void*)); 
   printf("-sw%zu\n",  sizeof(wchar_t)); 
}

Running this program will generate a line that looks something like this:

-ss2  -si4  -sl8  -sll8  -sf4  -sd8  -sld16  -sp8  -sw4

Copy and paste this line, or redirect the output of the program, to a file called size-options.lnt

If you are cross-compiling and cannot execute a binary compiled for the target to obtain this output then you can consult your compiler and target platform documentation for a table of type sizes. Alternatively, type sizes can be obtained through compiler error messages by defining arrays which are illegally of length zero in the presence of a particular type size, e.g. attempting to compile:

int si8[8 != sizeof(int)]; 
int si4[4 != sizeof(int)]; 
int si2[2 != sizeof(int)]; 
 
int ss8[8 != sizeof(short)]; 
int ss4[4 != sizeof(short)]; 
int ss2[2 != sizeof(short)]; 
 
int sl8[8 != sizeof(long)]; 
int sl4[4 != sizeof(long)]; 
int sl2[2 != sizeof(long)]; 
 
int sll8[8 != sizeof(long long)]; 
int sll4[4 != sizeof(long long)]; 
int sll2[2 != sizeof(long long)]; 
 
int sf8[8 != sizeof(float)]; 
int sf4[4 != sizeof(float)]; 
int sf2[2 != sizeof(float)]; 
 
int sd8[8 != sizeof(double)]; 
int sd4[4 != sizeof(double)]; 
int sd2[2 != sizeof(double)]; 
 
int sld8[8 != sizeof(long double)]; 
int sld4[4 != sizeof(long double)]; 
int sld2[2 != sizeof(long double)]; 
 
int sp8[8 != sizeof(void*)]; 
int sp4[4 != sizeof(void*)]; 
int sp2[2 != sizeof(void*)]; 
 
int sw8[8 != sizeof(L'a')]; 
int sw4[4 != sizeof(L'a')]; 
int sw2[2 != sizeof(L'a')];

should trigger a compiler error on one line out of each group of three lines. The name of each array that triggers an array of length zero error can be used as a size option after preprending it with a single dash.

Step 4 - Enable compiler-specific extensions

Most compilers implement a number of extensions to the C and C++ languages, such as GCC’s Case Ranges or Microsoft’s Assembly blocks. Embedded compilers often support additional language extensions. If these extensions are used by projects that will be processed by PC-lint Plus, they should be enabled in the configuration. Because there is a wide range of extensions supported by various compilers, we provide flexible compiler adaptation options. See section 4.12.1 Customization Facilities and section 4.11 Flag Options . Contact support if you run into issues configuring PC-lint Plus for your compiler.

Putting it all Together

If you have followed the steps outlined above to manually create a configuration for your compiler, you should now have the following:

Now it’s time to put it all together in one place. Create a file named std.lnt with the following contents:

lint-includes.lnt 
size-options.lnt 
+libh(lint_cmac.h) -header(lint_cmac.h) // and/or lint_cppmac.h as appropriate 
// <chosen compiler adaptation options for compiler extensions>