Skip to content

Commit 4e477e9

Browse files
committed
EssentialTypes: Make switch cases valid
Compiler testing showed that the switch cases were not valid as they required a statement. Added breaks to satisfy this condition.
1 parent bf1ee22 commit 4e477e9

File tree

1 file changed

+4
-4
lines changed
  • c/misra/test/rules/RULE-10-3

1 file changed

+4
-4
lines changed

c/misra/test/rules/RULE-10-3/test.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,31 +131,31 @@ void testSwitchCase() {
131131
case A: // NON_COMPLIANT
132132
case 100: // NON_COMPLIANT
133133
case ((unsigned int)200): // NON_COMPLIANT
134-
// case 1.0f: // NON_COMPILABLE
134+
break; // case 1.0f: // NON_COMPILABLE
135135
}
136136

137137
switch (e1) {
138138
case true: // NON_COMPLIANT
139139
case A: // COMPLIANT
140140
case 100: // NON_COMPLIANT
141141
case ((unsigned int)200): // NON_COMPLIANT
142-
// case 1.0f: // NON_COMPILABLE
142+
break; // case 1.0f: // NON_COMPILABLE
143143
}
144144

145145
switch (s) {
146146
case true: // NON_COMPLIANT
147147
case A: // NON_COMPLIANT
148148
case 100: // COMPLIANT
149149
case ((unsigned int)200): // NON_COMPLIANT
150-
// case 1.0f: // NON_COMPILABLE
150+
break; // case 1.0f: // NON_COMPILABLE
151151
}
152152

153153
switch (u) {
154154
case true: // NON_COMPLIANT
155155
case A: // NON_COMPLIANT
156156
case 100: // COMPLIANT - by exception 1
157157
case ((unsigned int)200): // COMPLIANT - by exception 1
158-
// case 1.0f: // NON_COMPILABLE
158+
break; // case 1.0f: // NON_COMPILABLE
159159
}
160160
}
161161

0 commit comments

Comments
 (0)