Cppcheck is a static analysis tool for C/C++ code.




Debian Stretch

Supported Languages

C C++

Official Documentation


YAML Configuration


  • input:

    Patterns to include in execution and reports.

  • ignore:

    Patterns to exclude from execution and reports.

  • auto-fix:


  • config-file:


  • machine:

    • cpu:

      Amount of CPU. The default machine has 0.75 CPU with 2880 MiB RAM.

      Inspecode automatically specifies -j option to Cppcheck according to this value. For example, -j 1 is specified by default (for 0.75 CPU), -j 2 is specified for 1.1 CPU.

  • options:

    Below is the list of options that are supported:

    ```text --addon=

                     Execute addon. i.e. --addon=cert. If options must be
                     provided a json configuration is needed, see the manual
                     for additional information about that.

    --clang Import Clang AST --config-exclude=

                     Path (prefix) to be excluded from configuration
                     checking. Preprocessor configurations defined in
                     headers (but not sources) matching the prefix will not
                     be considered for evaluation.


                     A file that contains a list of config-excludes

    -D Define preprocessor symbol. Unless --max-configs or

                     --force is used, Cppcheck will only check the given
                     configuration when -D is used.
                     Example: '-DDEBUG=1 -D__cplusplus'.

    -U Undefine preprocessor symbol. Use -U to explicitly

                     hide certain #ifdef <ID> code paths from checking.
                     Example: '-UDEBUG'

    --enable= Enable additional checks. The available ids are:

                      * all
                              Enable all checks. It is recommended to only
                              use --enable=all when the whole program is
                              scanned, because this enables unusedFunction.
                      * warning
                              Enable warning messages
                      * style
                              Enable all coding style checks. All messages
                              with the severities 'style', 'performance' and
                              'portability' are enabled.
                      * performance
                              Enable performance messages
                      * portability
                              Enable portability messages
                      * information
                              Enable information messages
                      * unusedFunction
                              Check for unused functions. It is recommend
                              to only enable this when the whole program is
                      * missingInclude
                              Warn if there are missing includes. For
                              detailed information, use '--check-config'.
                     Several ids can be given if you separate them with
                     commas. See also --std

    --file-filter= Analyze only those files matching the given filter str

                     Example: --file-filter=*bar.cpp analyzes only files
                              that end with bar.cpp.

    --file-list= Specify the files to check in a text file. Add one

                     filename per line. When file is '-,' the file list will
                     be read from standard input.

    -f, --force Force checking of all configurations in files. If used

                     together with '--max-configs=', the last option is the
                     one that is effective.


    Give path to search for include files. Give several -I

                     parameters to give several paths. First given path is
                     searched for contained header files first. If paths are
                     relative to source files, this is not needed.


                     Specify directory paths to search for included header
                     files in a text file. Add one include path per line.
                     First given path is searched for contained header
                     files first. If paths are relative to source files,
                     this is not needed.


                     Force inclusion of a file before the checked file.


    Give a source file or source file directory to exclude

                     from the check. This applies only to source files so
                     header files included by source files are not matched.
                     Directory name is matched to all parts of the path.

    --inconclusive Allow that Cppcheck reports even though the analysis is

                     There are false positives with this option. Each result
                     must be carefully investigated before you know if it is
                     good or bad.

    --inline-suppr Enable inline suppressions. Use them by placing one or

                     more comments, like: '// cppcheck-suppress warningId'
                     on the lines before the warning to suppress.

    --library= Load file that contains information about types

                     and functions. With such information Cppcheck
                     understands your code better and therefore you
                     get better results. The std.cfg file that is
                     distributed with Cppcheck is loaded automatically.
                     For more information about library files, read the

    --max-ctu-depth=N Max depth in whole program analysis. The default value

                     is 2. A larger value will mean more errors can be found
                     but also means the analysis will be slower.


                     Maximum number of configurations to check in a file
                     before skipping it. Default is '12'. If used together
                     with '--force', the last option is the one that is

    --platform=, --platform=

                     Specifies platform specific types and sizes. The
                     available builtin platforms are:
                      * unix32
                             32 bit unix variant
                      * unix64
                             64 bit unix variant
                      * win32A
                             32 bit Windows ASCII character encoding
                      * win32W
                             32 bit Windows UNICODE character encoding
                      * win64
                             64 bit Windows
                      * avr8
                             8 bit AVR microcontrollers
                      * native
                             Type sizes of host system are assumed, but no
                             further assumptions.
                      * unspecified
                             Unknown type sizes

    --std= Set standard.

                     The available options are:
                      * c89
                             C code is C89 compatible
                      * c99
                             C code is C99 compatible
                      * c11
                             C code is C11 compatible (default)
                      * c++03
                             C++ code is C++03 compatible
                      * c++11
                             C++ code is C++11 compatible
                      * c++14
                             C++ code is C++14 compatible
                      * c++17
                             C++ code is C++17 compatible
                      * c++20
                             C++ code is C++20 compatible (default)

    --suppress= Suppress warnings that match . The format of

                     <spec> is:
                   [error id]:[filename]:[line]
                   The [filename] and [line] are optional. If [error id]
                   is a wildcard '*', all error ids match.

--suppressions-list= Suppress warnings listed in the file. Each suppression is in the same format as above. --suppress-xml= Suppress warnings listed in a xml file. XML file should follow the manual.pdf format specified in section. 6.4 XML suppressions .

<!-- -->

- [`thresholds:`](../configuration/tool.html#field-thresholds)

  - [`num-issues:`](../configuration/tool.html#field-thresholds)

    In addition to general severity levels, the following tool specific severity levels can be specified:

    - `information` (equivalent to general severity level `info`)
    - `style` (equivalent to general severity level `info`)
    - `performance` (equivalent to general severity level `info`)
    - `portability` (equivalent to general severity level `info`)

- [`incremental:`](../configuration/tool.html#field-incremental)


  > **Note:**
  The incremental analysis is disabled if any kinds of configuration files are changed.
  The files recognized as configuration files are as follows:
  - File list files:
    - Files specified to `--file-list` option

- [`experimental:`](../configuration/tool.html#field-experimental)

  No tool specific experimental options are available.

### YAML Examples

- With default options:

      cppcheck: default
  • With custom machine:

            cpu: 1.5 # 1.5 CPU, 5760 MiB RAM
  • With custom options:

            --enable: all

results matching ""

    No results matching ""