Then I noticed that depending how I invoked the addon the "violation" was detected or not. If I invoke it simply as cppcheck --addon=misra r2_5.c, the violation warning is spit out. If I use instead cppcheck --addon=misra.py r2_5.c, no warning is shown. Finally, if I use a separate JSON file like so cppcheck --addon=misra.json r2_5.c with the following misra.json file:
{
"script": "misra.py"
}
also, no warning. Here is the output of the three attempts:
Is this a bug or a "feature"? If there is no problem, is it something I'm missing on how to correctly invoke the addon? I'd like to use the json variant so that I can pass the --rule-texts option.
Finally, note that I compiled cppcheck by cloning it from github, checking out the 2.7 tag, and running the following commands:
#make -j$(nproc) FILESDIR=/usr/share/cppcheck
#sudo make install FILESDIR=/usr/share/cppcheck
Cheers
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I first noticed that the misra addon was not detecting a violation of rule 2.5 on such a simple file as:
Then I noticed that depending how I invoked the addon the "violation" was detected or not. If I invoke it simply as
cppcheck --addon=misra r2_5.c
, the violation warning is spit out. If I use insteadcppcheck --addon=misra.py r2_5.c
, no warning is shown. Finally, if I use a separate JSON file like socppcheck --addon=misra.json r2_5.c
with the following misra.json file:also, no warning. Here is the output of the three attempts:
Is this a bug or a "feature"? If there is no problem, is it something I'm missing on how to correctly invoke the addon? I'd like to use the json variant so that I can pass the
--rule-texts
option.Finally, note that I compiled cppcheck by cloning it from github, checking out the 2.7 tag, and running the following commands:
Cheers
I've submitted a PR which I believe fixes the issue: https://github.com/danmar/cppcheck/pull/3819
Last edit: José Martins 2022-02-10