When I have defined both -U, -D and --force arguments it looks like cppcheck still performs some og the combinations of defines that are undefined with the -U argument.
How does these 3 arguments interact ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Configurations tested:
cppcheck test.c => "", "A", "A;B" => all bugs are found
cppcheck -DA test.c => "A" => The first bug is found
cppcheck -UA test.c => "" => The last bug is found
cppcheck --force -DA test.c => "A", "A;B" => The two first bugs are found
It seams to work. I had created the .cppcheck project file by hand and it had an error in the <undefine> tag, which explains why I went through all combinations with the undefined flags.</undefine>
and with different define/undefine's set I get the expected behavior.
For the documentation the key point must be: All flags set with define/-D and undefine/-U will be fixed, all other flags will be tried in combinations when the --force argument is specified.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For the documentation the key point must be: All flags set with define/-D and undefine/-U will be fixed, all other flags will be tried in combinations when the --force argument is specified.
Yes that is a good point thanks 👍
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When I have defined both -U, -D and --force arguments it looks like cppcheck still performs some og the combinations of defines that are undefined with the -U argument.
How does these 3 arguments interact ?
Example code with three bugs (when x,y,z is assigned).
Configurations tested:
cppcheck test.c => "", "A", "A;B" => all bugs are found
cppcheck -DA test.c => "A" => The first bug is found
cppcheck -UA test.c => "" => The last bug is found
cppcheck --force -DA test.c => "A", "A;B" => The two first bugs are found
I guess we should clarify the manual somehow. http://cppcheck.sourceforge.net/manual.html#preprocessor-settings
Do you have some pointer about how we could clarify it.
Last edit: Daniel Marjamäki 2021-02-06
It seams to work. I had created the .cppcheck project file by hand and it had an error in the <undefine> tag, which explains why I went through all combinations with the undefined flags.</undefine>
and with different define/undefine's set I get the expected behavior.
For the documentation the key point must be: All flags set with define/-D and undefine/-U will be fixed, all other flags will be tried in combinations when the --force argument is specified.
Yes that is a good point thanks 👍