/* >>>------------------------------------------------------------ * * File: rule_13.7.c, Module: M2CM-3.2-QAC-8.1.2 * * RULE 13.7 (Required): * Boolean operations whose results are invariant shall not be * permitted. * * Implemented by messages: * 2990 The value of this loop controlling expression is always * 'true'. * * 2991 The value of this 'if' controlling expression is always * 'true'. * * 2992 The value of this 'if' controlling expression is always * 'false'. * * 2993 The value of this 'do - while' loop controlling * expression is always 'false'. The loop will only be * executed once. * * 2994 The value of this 'while' or 'for' loop controlling * expression is always 'false'. The loop will not be * entered. * * 2995 The result of this logical operation is always 'true'. * * 2996 The result of this logical operation is always 'false'. * * <<<------------------------------------------------------------ */ /* PRQA S 2982 ++ */ #include "misra.h" #include "m2cmex.h" extern S16 test_1307( void ) { S16 r = 0; const S16 s16x = 1; const S16 s16y = 1; S16 s16v = s16x; S16 s16w = s16y; U16 u16p = 1U; U16 u16q = 1U; bla = s16x == s16y; /* MISRA Violation */ bla = s16x != s16y; /* MISRA Violation */ bla = s16x == 1; /* MISRA Violation */ bla = s16v == s16w; /* MISRA Violation */ bla = u16p >= 0U; /* MISRA Violation */ bla = u16q < 0U; /* MISRA Violation */ for ( s16v = 0; s16v == 1; ) /* MISRA Violation */ { ++r; } if ( s16x == s16y ) /* MISRA Violation */ { while ( u16q < 0U ) /* MISRA Violation */ { ++r; } } do { ++r; } while ( s16x != s16y ); /* MISRA Violation */ return r; }