Hello,
before all, thank you for this great software!
Running the software I got some false positives, and one of them is related to MISRA 18.8 rule.
When the length of an array is determined using a #define I get the rule violation. It seems related to some sort of preprocessing problem, in fact if the #define is in the same file in which the array is declared there is no error. Otherwise, if the #define is located in a header which will be included, the rule violation is raised.
In my embedded project I have to deal with a large amount of generated code, that I can't modify, which make a wide use of #defines that recall to other #defines in another include file.
I have attached a small project that reproduces the error.
I've tried to launch the tests from command line also, this is the result:
Hello Georgiy,
thanks to you for taking into account my report.
Checking the embedded code of my application I've found other cases: for some of them I'm pretty sure they are false positives, for some others I'm suspicious. Now I'm a little busy at work, but as soon as I've some time I will provide a separate report for each of them with attached a simple project that can reproduce the false positive (or the suspicious one).
Have a nice day!
👍
2
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
before all, thank you for this great software!
Running the software I got some false positives, and one of them is related to MISRA 18.8 rule.
When the length of an array is determined using a #define I get the rule violation. It seems related to some sort of preprocessing problem, in fact if the #define is in the same file in which the array is declared there is no error. Otherwise, if the #define is located in a header which will be included, the rule violation is raised.
In my embedded project I have to deal with a large amount of generated code, that I can't modify, which make a wide use of #defines that recall to other #defines in another include file.
I have attached a small project that reproduces the error.
I've tried to launch the tests from command line also, this is the result:
Finally, if check the configuration from command line, I got no errors:
Hello, Marco,
Thanks for reporting this. I can confirm this false positive.
I created the following ticket: https://trac.cppcheck.net/ticket/10197
Hello Georgiy,
thanks to you for taking into account my report.
Checking the embedded code of my application I've found other cases: for some of them I'm pretty sure they are false positives, for some others I'm suspicious. Now I'm a little busy at work, but as soon as I've some time I will provide a separate report for each of them with attached a simple project that can reproduce the false positive (or the suspicious one).
Have a nice day!