/* >>>------------------------------------------------------------ * * File: rule_12.5.c, Module: M2CM-3.2-QAC-8.1.2 * * RULE 12.5 (Required): * The operands of a logical && or || shall be * primary-expressions. * * Implemented by messages: * 3398 Extra parentheses recommended. A function call, array * subscript, or member operation is the operand of a * logical && or ||. * * 3399 Extra parentheses recommended. A unary operation is the * operand of a logical && or ||. * * 3400 Extra parentheses recommended. A binary operation is the * operand of a logical && or ||. * * <<<------------------------------------------------------------ */ /* PRQA S 2982,2983 ++ */ #include "misra.h" #include "m2cmex.h" extern S16 test_1205( void ) { S16 *psi16 = &s16d; bla = ( s16a == 0 ) && !( s16d == 1 ); /* MISRA Violation */ bla = ( s16a == 0 && s16d != 0 ); /* MISRA Violation - Also Rule 12.1 */ bla = *psi16 != 0 && ( s16a == 0 ); /* MISRA Violation - Also Rule 12.1 */ bla = (s16a < s16b) && (s16b < s16c) || (s16c < s16d); /* MISRA Violation - Also Rule 12.1 */ bla = (s16a < s16b) && (s16b < s16c) && (s16c < s16d); bla = (s16a < s16b) || (s16b < s16c) || (s16c < s16d); return 1; }