Neither the PC-Lint manual nor the Gimpel forum - at least at the time of writing - gives a good recommendation how to suppress MISRA-C warnings in the global wrap-up.
This issue pertains for example to the message "Note 960: Violates MISRA 2004 Required Rule 8.9, undefined symbol", which is followed by the name of the undefined symbol. You might have defined this symbol in Assembler, therefore a suppression of this message for this specific symbol is adequate. However:
- All suppressions that pertain to a specific location in the source code are useless, as this message is raised during global wrap-up, where none of these suppressions apply.
- -estring(960, "symbol name") is not specific enough: it suppresses most MISRA-C warning about that symbol, not only the violation of rule 8.9. That's only because most MISRA-C warning have message code 960 or 961. Otherwise this is just the right option to suppress message in the global wrap-up.
- -esym(960, 8.9) disables rules 8.9 for ALL symbols.
- -estring(960, "undefined symbol*symbol name") doesn't work either: it seems like the whole message text is not matched against the expression, only all parts of the message.
Only through some experimentation I finally found the solution:
-estring(960, "undefined symbol", "symbol name")
Opposite to other options like -esym, the arguments of the -estring option seem to be AND-ed for the match, not OR-ed. Therefore the above -estring option suppresses the MISRA-C warning about undefined symbols just for "symbol name" and nothing else.
Hi Matthias,
ReplyDeleteDo you know if there is already a general way to suppress the messages from library files in the Global wrap-up section? I would like to avoid adding a specific suppression for each message, I am using PC Lint v9.00.
I assume you have options in place so PC Lint knows which files are library files. So normally you would use -elib so the suppression applies to library files only. But that doesn't work for the global wrap up. I recommend the above named options then. Or, actually, switch to the new reboot of PC Lint.
ReplyDeleteOk Matthias, thanks for your help!
ReplyDelete