Misra rule 15.2 misreported if case statement include composite statement.
static int k;
void test(int i) {
switch(i) {
case 2:
k--;
break;
case 3:
{
k--;
}
break;
default:
k++;
break;
}
}
Command line: C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/bin/armcl -mv7R4 --code_state=32 --float_support=VFPv3D16 -O4 --check_misra="15.2" -g --strict_ansi --emit_warnings_as_errors --diag_wrap=off --diag_warning=225 --display_error_number --abi=eabi --enum_type=packed --preproc_with_compile misra_15_2.c
Output:
"misra_15_2.c", line 8: error #1416: (MISRA-C:2004 15.2/R) An unconditional break statement shall terminate every non-empty switch clause
1 error detected in the compilation of "misra_15_2.c".