/* >>>------------------------------------------------------------ * * File: rule_12.7.c, Module: M2CM-3.2-QAC-8.1.2 * * RULE 12.7 (Required): * Bitwise operators shall not be applied to operands whose * underlying type is signed. * * Implemented by messages: * 4532 An expression of 'essentially signed' type (%1s) is * being used as the %2s operand of this bitwise operator * (%3s). * * 4533 An expression of 'essentially signed' type (%1s) is * being used as the left-hand operand of this shift * operator (%2s). * * <<<------------------------------------------------------------ */ #include "misra.h" #include "m2cmex.h" extern S16 test_1207( void ) { s16a = (S16)(s16a << 2); /* MISRA Violation */ s16a = s16a >> 1; /* MISRA Violation */ s16a = s16a & 3; /* MISRA Violation */ s16a = s16a | 5; /* MISRA Violation */ s16a = (S16)~s16a; /* MISRA Violation */ u8a = (U8)(u8a << 2); u8a = u8a >> 1; u8a = u8a & 0x3U; u8a = u8a | 0x5U; u8a = (U8)~u8a; return 1; }