Aside from a few warnings, the build was succesful and I'm able to run cppcheck against a test C project
However, when I wanted to add in the MISRA-C 2012 checks things don't go quite as smoothly.
I'm calling cppcheck using the following commandline options from the root of my test C project, as per this topic.
It's not clear, from a cursorary look, what the magic number 12 is all about but it does appear that it's trying to run my misra-rules.txt file through an XML parser, which doesn't make much sense to me. I'm guessing I must be missing something obvious.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The Cppcheck parameter --rule-file has nothing to do with the Misra rule file.
The Misra rule texts file can not be specified as a Cppcheck parameter but as a Misra addon parameter.
For using the Addons via command line please see the chapter "Using Cppcheck addons" in the manual (http://cppcheck.sourceforge.net/manual.pdf). The Misra addon script is misra.py
The rule texts file can be specified as a parameter (IIRC it is --rule-texts) to this addon script.
See "Chapter 8. Misra" for more details.
Sadly there is no simpler way to run the addons at the moment.
I hope this helps. If the manual is not clear enough or you have further questions don't hesitate to ask.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately, I did not find Chapter 8 of the manual to be as helpful as it could be. It does explain nicely how to process the MISRA C pdf to generate a usable text file. It doesn't explain clearly how to run the misra plugin (or any other plug in for that matter)
* I didn't find it all that clear that the main cppcheck code was unable to trigger the addons.
Once I've got things working from my end I'll take a look at writing something for inclusion in the manual.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes Chapter 8 is not really complete. Maybe a reference to the chapter explaining how addons work should be added there so this important information would be easier to find.
I am also not sure if this "pdftotext" process is really necessary. I just marked the relevant text, copied it and pasted it into a text file. Maybe pdftotext avoids some encoding / decoding problems, not sure about this.
I am happy that i was able to help a bit and it would be great if you could improve the manual.
The "source" for the manual is now a MarkDown file so it should be easy to enhance it: https://github.com/danmar/cppcheck/blob/master/man/manual.md
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I built the tagged 1.87 release of cppcheck on a linux machine using the
Aside from a few warnings, the build was succesful and I'm able to run cppcheck against a test C project
However, when I wanted to add in the MISRA-C 2012 checks things don't go quite as smoothly.
I'm calling cppcheck using the following commandline options from the root of my test C project, as per this topic.
The only output I get from this is
My misra_rules.txt file looks something like:
From a Windows machine, using the GUI version of cppcheck, this same exact same file works as expected
I had a look at cmdlineparser.cpp, specifically:
It's not clear, from a cursorary look, what the magic number 12 is all about but it does appear that it's trying to run my misra-rules.txt file through an XML parser, which doesn't make much sense to me. I'm guessing I must be missing something obvious.
The Cppcheck parameter
--rule-file
has nothing to do with the Misra rule file.The Misra rule texts file can not be specified as a Cppcheck parameter but as a Misra addon parameter.
For using the Addons via command line please see the chapter "Using Cppcheck addons" in the manual (http://cppcheck.sourceforge.net/manual.pdf). The Misra addon script is
misra.py
The rule texts file can be specified as a parameter (IIRC it is
--rule-texts
) to this addon script.See "Chapter 8. Misra" for more details.
Sadly there is no simpler way to run the addons at the moment.
I hope this helps. If the manual is not clear enough or you have further questions don't hesitate to ask.
Thanks for your reply, that was very helpful.
Unfortunately, I did not find Chapter 8 of the manual to be as helpful as it could be.
It does explain nicely how to process the MISRA C pdf to generate a usable text file.
It doesn't explain clearly how to run the misra plugin (or any other plug in for that matter)
* I didn't find it all that clear that the main cppcheck code was unable to trigger the addons.
Once I've got things working from my end I'll take a look at writing something for inclusion in the manual.
Yes Chapter 8 is not really complete. Maybe a reference to the chapter explaining how addons work should be added there so this important information would be easier to find.
I am also not sure if this "pdftotext" process is really necessary. I just marked the relevant text, copied it and pasted it into a text file. Maybe
pdftotext
avoids some encoding / decoding problems, not sure about this.I am happy that i was able to help a bit and it would be great if you could improve the manual.
The "source" for the manual is now a MarkDown file so it should be easy to enhance it:
https://github.com/danmar/cppcheck/blob/master/man/manual.md