"cppcheck test.c --enable=information" returns..
Checking test.c ...
test.c:0:0: information: This file is not analyzed. Cppcheck failed to extract a valid configuration. Use -v for more details. [noValidConfiguration]
Adding -v..
test.c:0:0: information: This file is not analyzed. Cppcheck failed to extract a valid configuration. The tested configurations have these preprocessor errors:
'' : [test.c:2] #error Forced error
OPTION_TWO : [test.c:2] #error Forced error [noValidConfiguration]
Interestingly, there's a number of minor changes to this snip that make the issue go away, such as no parentheses on line 1, changing line 1 to #if (OPTION_ONE==1), removing the #error, removing the #ifdef check.
Since "--enable=information" is so noisy, we typically turn this off, but because of this we did not notice that Cppcheck was not analyzing the entire file. It was just blind luck we saw this at all, and when we did analyze the rest of this 4000 line file, we found an issue. Could not analyzing a file could be considered more of a fatal error than just informational?
Last edit: Jonathon 2022-02-28
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Saw some older threads about this topic, but no resolution. Hopefully new thread is okay. Here's the smallest snip I could come up with..
Test.c
"cppcheck test.c" returns nothing.
"cppcheck test.c --enable=information" returns..
Checking test.c ...
test.c:0:0: information: This file is not analyzed. Cppcheck failed to extract a valid configuration. Use -v for more details. [noValidConfiguration]
Adding -v..
test.c:0:0: information: This file is not analyzed. Cppcheck failed to extract a valid configuration. The tested configurations have these preprocessor errors:
'' : [test.c:2] #error Forced error
OPTION_TWO : [test.c:2] #error Forced error [noValidConfiguration]
Interestingly, there's a number of minor changes to this snip that make the issue go away, such as no parentheses on line 1, changing line 1 to #if (OPTION_ONE==1), removing the #error, removing the #ifdef check.
Since "--enable=information" is so noisy, we typically turn this off, but because of this we did not notice that Cppcheck was not analyzing the entire file. It was just blind luck we saw this at all, and when we did analyze the rest of this 4000 line file, we found an issue. Could not analyzing a file could be considered more of a fatal error than just informational?
Last edit: Jonathon 2022-02-28