Disable rule for specific library function
Throughout our code we do not check the return code on memcpy and memset. This is causing rule violations to be reported. We can prevent the warning by adding "(void)" before each function or by adding a parasoft comment before each call but this is not an ideal solution. What we would like to do is disable the rule for specific functions. Is this possible?
Comments
-
I don't know which rule you mean, but if it is static analysis rule MISRA2004-16_10 ( or its clone: JSF-115, MISRA2008-0_3_2, AUTOSAR-M0_3_2-a), you can create duplicate of the rule and modify it in Rule Wizard. It is possible disable checking functions with specific names.
Modification of rule MISRA2004-16_10 in Rule Wizard:
Use property 'Name' for 'Functions' node
Add regular expression ^(memcpy|memset)$ and check the 'Negate' checkbox
Move 'Name is not' block to top1 -
I am glad to know it is possible. I understand that it is extremely flexible but it does seem awfully complex. I am coming from the PCLint world where all that was needed was "-esym(534,memset)". Thanks for the help.
0