Menu

Misra violation 10_1 not triggering

2023-05-05
2023-05-08
  • Emiel Estiévenart

    Hi,

    I'm using Cppcheck as an alternative to Polyspace Bug Finder for Misra compliancy checking.
    It's a great tool and finds many bugs that Polyspace doesn't.

    We are using C89 so we don't have bool types.

    Misra 10.1 is not triggering in this scenario. Polyspace is detecting this as a violation.
    I think in this case Polyspace is correct.

    I think this check should consider all operators that are listed in the Misra 10.1 rule and see if the operators are of the boolean type.

    uint8_t frrt_misra_function(uint8_t value)
    {
        uint8_t retval;
    
        if (value) //10.4 here, this is correct
        {
            retval = 1;
        }
    
        if (!value) //expect 10.1. 10.4 is not triggered either
        {
            retval = 2;
        }
    
        return retval;
    }
    
     
  • Daniel Marjamäki

     
  • Emiel Estiévenart

    Great! I can assist in checking the solution for all operators.
    This Misra rule is important to us as it takes a lot of effort to go back and forth between Polyspace and the code to fix these kinds of violations.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.