The Project file dialog contains 4 tabs:
It is recommended to import a project file.
What paths to check.
Cppcheck automatically checks the code with different preprocessor configurations.
#ifdef A code1 #endif #ifdef B code2 #endif
Cppcheck will automatically perform analysis both when A is defined and B is defined. So any bugs in both code1 and code2 will be detected.
If you want to configure that A will always be defined in Cppcheck analysis you can do that here.
Defines are separated by semicolon. So you can for instance write:
A;B=3;C
Cppcheck automatically checks the code with different preprocessor configurations.
#ifdef A code1 #endif #ifdef B code2 #endif
Cppcheck will automatically perform analysis both when A is defined and B is defined. So any bugs in both code1 and code2 will be detected.
If you want to configure that A is never defined in Cppcheck analysis you can do that here.
Undefines are separated by semicolon. So you can for instance write:
A;C
Specify include paths.
Cppcheck uses the Platform setting to determine size of short/int/long/pointer/etc.
Check the libraries that you use in the Libraries listbox.
This is a work-folder that Cppcheck uses. Each Cppcheck project should have a separate build dir. It is used for:
It is in general recommended to use Cppcheck parser. However you can choose to use Clang parser; Clang will be executed with a command line flag that tells it to dump its AST and Cppcheck will read that AST and convert it into a corresponding Cppcheck AST and use that.
Configure what kind of analysis you want.
The Normal analysis is recommended for most use cases. Especially if you use Cppcheck in CI.
The Bug hunting can be used if you really want to find a bug in your code and can invest time looking at bad results and providing extra configuration.
You can turn off checking of headers. That could be interesting if Cppcheck is very slow. But normally, you should check the code in headers.
It is possible to check the code in unused templates. However the Cppcheck AST will be incomplete/wrong. The recommendation is that you do not check unused templates to avoid wrong warnings. The templates will be checked properly when you do use them.
Max CTU depth: How deep should the whole program analysis be. The risk with a "too high" value is that Cppcheck will be slow.
Max recursion in template instantiation: Max recursion when Cppcheck instantiates templates. The risk with a "too high" value is that Cppcheck will be slow and can require much memory.
The root path for warnings. Cppcheck will strip away this part of the path from warnings. For instance if there is a warning in
../myproject/foo/bar/file.cppand the root path is
../myproject/foothen the path for the warning will be
bar/file.cpp.
Tags allow you to manually categorize warnings.
Excluded source files will not be analyzed by Cppcheck.
List of suppressions. These warnings will not be shown.
Y2038
32-bit timers that count number of seconds since 1970 will
overflow in year 2038. Check that the code does not use such timers.
Thread safety
Check that the code is thread safe
MISRA
Ensure that the MISRA coding standard is followed. Please
note you need to have a textfile with the misra rule texts to get proper
warning messages. Cppcheck is not legally allowed to distribute the misra
rule texts.
Clang-tidy
Run Clang-tidy