Reputation: 431
I have a file that can be summarized as shown below.
namespace MyNamespace {
#if defined(SOME_UNSET_CONDITION)
TEST_CASE("STR1", "[STR2]") {
}
TEST_CASE("STR3", "[STR4]") {
}
#endif
}
When calling Cppcheck v2.8 on the file, the following is the output:
$ cppcheck --std=c++14 -v tmp.cpp
Checking tmp.cpp ...
Defines:
Undefines:
Includes:
Platform:Native
Checking tmp.cpp: SOME_UNSET_CONDITION...
tmp.cpp:8:1: error: syntax error [syntaxError]
TEST_CASE("STR3", "[STR4]") {
^
The SOME_UNSENT_CONDITION
directive is not currently enabled in this project, though I'm not sure why cppcheck
would be complaining either way. Can anyone give me some insight here?
Upvotes: 1
Views: 628
Reputation: 141493
Can anyone give me some insight here?
From https://cppcheck.sourceforge.io/manual.pdf :
Automatic configuration of preprocessor defines
Cppcheck automatically test different combinations of preprocessor defines to achieve as high coverage in the analysis as possible.
By that it is meant that cppcheck checks every possible combination of all possible defines in your project.
If you intent to disable checking a specific combination, -USOME_UNSET_CONDITION
for cppcheck.
Upvotes: 3