The commit message has zero information on why or any sort of justification.
This commit completely breaks MISRA suppressions when processing stand alone via .dump files because it is no longer loading the suppressions that were added into the dump file by cppcheck.
How is stand alone processing of .dump files supposed to work now?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The reason is that we want that suppressions work for other addons also and not just misra. It is preferable to have a generic infrastructure for all addons.
Look at the output closer. The text of the message was prevented but the summary still shows 2 rules violated and 15.1 is listed in the dump of rules violated.
The reason is that we want that suppressions work for other addons also and not just misra. It is preferable to have a generic infrastructure for all addons.
So what is that new infrastructure and how is misra.py supposed to use it?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Look at the output closer. The text of the message was prevented but the summary still shows 2 rules violated and 15.1 is listed in the dump of rules violated.
it should be fixed.
In the long run I envision that it's better to put the summary in a common place like cppcheckdata. This is not functionality that strongly belongs to the misra addon. But this move will not be rushed.
So what is that new infrastructure and how is misra.py supposed to use it?
For the addons there is not much..
* An addon is not allowed to analyze 2 dumpfiles in parallell. It can analyze 2 dumpfiles in sequence. You can execute 2 addons in parallell if you want..
* Addons should call cppcheckdata.reportError to report errors.
If these 2 rules are followed the the addon should have proper handling of suppressions.
It would feel natural to me if cppcheckdata.reportError collects statistics.
Last edit: Daniel Marjamäki 2020-12-02
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Look at the output closer. The text of the message was prevented but the summary still shows 2 rules violated and 15.1 is listed in the dump of rules violated.
it should be fixed
Nod. How?
Also --show-suppressed-rules output is empty.
This is an important diagnostic tool that we use to figure out why suppression may not be working. How can this diagnostic be re-implemented such that it works? I do not see a similar cppcheck option.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
not sure.. I think some "quick hack" would be fine right now so it will work in the next release:
* either cppcheckdata.reportError will return False when the warning is suppressed. Then Misra addon must collect the statistics.
* cppcheckdata.reportError can collect some statistics about what messages are diagnosed/suppressed.
I'd say the most straightforward /simple solution is best if we want something working now.. I want to release cppcheck-2.3 on saturday.
We can add a flag isSuppressed in the class Suppression. Then it is possible for an addon to iterate suppressions and report those that was unused.
For the long term I would suggest that we collect the statistics about reported/suppressed messages etc in a central place so all addons can easily write corresponding reports.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've taken a look at this and cppcheckdata is only instantiated scope of the dump file being processed so it won't work for a summary of suppressions. It will need to be managed by something that stays in scope.
We can add a flag isSuppressed in the class Suppression. Then it is possible for an addon to iterate suppressions and report those that was unused.
The --show-suppressed-rules just showed all the suppression not the ones that were actually used so the flag isn't necessary.
I propose that for now misra.py keep a list of the suppressions it finds so that --show-suppressed-rules can be fixed and that the MISRA summary information be removed since its broken now and with --addon its not available.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What do you think about this then.. it seems to work for --show-suppressed-rules as far as I see.. however please note it is just intended as a rough but working proof of concept.
That patch only shows suppressions if they actually created a violation. The previous behavior was to list all suppressions defined for all files regardless if a violation was triggered. The point of that option was to be be able to check if the suppression you create is actually getting picked up by the checker.
IMO you should revert that change and restore the previous behavior until a migration plan for implementing it in cppcheck is created while preserving the existing behavior.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What was the reasoning for:
The commit message has zero information on why or any sort of justification.
This commit completely breaks MISRA suppressions when processing stand alone via .dump files because it is no longer loading the suppressions that were added into the dump file by cppcheck.
How is stand alone processing of .dump files supposed to work now?
The reason is that we want that suppressions work for other addons also and not just misra. It is preferable to have a generic infrastructure for all addons.
It works for me when testing it. Test code:
m1.c:
No suppression:
Suppressing misra-c2012-15.1
Also the suppression works the same through cppcheck core:
I think that is important too.. you should not get different suppressions depending on how you call it.
Last edit: Daniel Marjamäki 2020-12-02
Look at the output closer. The text of the message was prevented but the summary still shows 2 rules violated and 15.1 is listed in the dump of rules violated.
Also --show-suppressed-rules output is empty.
Also --show-suppressed-rules output is empty.
So what is that new infrastructure and how is misra.py supposed to use it?
it should be fixed.
In the long run I envision that it's better to put the summary in a common place like cppcheckdata. This is not functionality that strongly belongs to the misra addon. But this move will not be rushed.
For the addons there is not much..
* An addon is not allowed to analyze 2 dumpfiles in parallell. It can analyze 2 dumpfiles in sequence. You can execute 2 addons in parallell if you want..
* Addons should call
cppcheckdata.reportErrorto report errors.If these 2 rules are followed the the addon should have proper handling of suppressions.
It would feel natural to me if
cppcheckdata.reportErrorcollects statistics.Last edit: Daniel Marjamäki 2020-12-02
Nod. How?
This is an important diagnostic tool that we use to figure out why suppression may not be working. How can this diagnostic be re-implemented such that it works? I do not see a similar cppcheck option.
not sure.. I think some "quick hack" would be fine right now so it will work in the next release:
* either
cppcheckdata.reportErrorwill return False when the warning is suppressed. Then Misra addon must collect the statistics.*
cppcheckdata.reportErrorcan collect some statistics about what messages are diagnosed/suppressed.I'd say the most straightforward /simple solution is best if we want something working now.. I want to release cppcheck-2.3 on saturday.
We can add a flag
isSuppressedin theclass Suppression. Then it is possible for an addon to iterate suppressions and report those that was unused.For the long term I would suggest that we collect the statistics about reported/suppressed messages etc in a central place so all addons can easily write corresponding reports.
I've taken a look at this and cppcheckdata is only instantiated scope of the dump file being processed so it won't work for a summary of suppressions. It will need to be managed by something that stays in scope.
The --show-suppressed-rules just showed all the suppression not the ones that were actually used so the flag isn't necessary.
I propose that for now misra.py keep a list of the suppressions it finds so that --show-suppressed-rules can be fixed and that the MISRA summary information be removed since its broken now and with --addon its not available.
What do you think about this then.. it seems to work for --show-suppressed-rules as far as I see.. however please note it is just intended as a rough but working proof of concept.
Last edit: Daniel Marjamäki 2020-12-03
If you create some pull request that solves this now .. then I will appreciate it. it doesn't have to be a fully centralized solution at this point.
That patch only shows suppressions if they actually created a violation. The previous behavior was to list all suppressions defined for all files regardless if a violation was triggered. The point of that option was to be be able to check if the suppression you create is actually getting picked up by the checker.
IMO you should revert that change and restore the previous behavior until a migration plan for implementing it in cppcheck is created while preserving the existing behavior.
well.. I am scared that this will not be implemented properly then..
I can revert my commit.. and then after the release I revert back to current behavior.. and then there is some time to make it proper..
I only need to temporarily revert 1ce78a108604b3987c1fbb3f69df09789da2d3fc and then it will work as you want?
I think so let me test and see.
Yes. That appears to restore the previous behavior.