/* >>>------------------------------------------------------------ * * File: rule_15.3.c, Module: M2CM-3.2-QAC-8.1.2 * * RULE 15.3 (Required): * The final clause of a switch statement shall be the default * clause. * * Implemented by messages: * 2002 No 'default' label found in this 'switch' statement. * * 2009 This 'default' label is not the final 'case' label * within the 'switch' block. * * <<<------------------------------------------------------------ */ #include "misra.h" #include "m2cmex.h" extern S16 test_1503( void ) { S16 x = 0; switch ( s16a ) { case 0: x = 2; break; case 1: x = 1; break; } /* MISRA Violation */ switch ( s16b ) { default: /* MISRA Violation */ x = 7; break; case 2: x = 5; break; case 3: ++x; break; } return x; }