Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Disable rule for specific library function

Options
drubery
drubery Posts: 2

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?

Tagged:

Comments

  • mstaron
    mstaron Posts: 35
    Options

    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 top

  • drubery
    drubery Posts: 2
    Options

    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.