Skip to content

Commit 48175e7

Browse files
committed
Added test case to 16-3 for non last default labels
1 parent 21a4432 commit 48175e7

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
| test.c:11:3:11:9 | case ...: | The switch $@ does not terminate with a break statement. | test.c:11:3:11:9 | case ...: | clause |
22
| test.c:14:3:14:9 | case ...: | The switch $@ does not terminate with a break statement. | test.c:14:3:14:9 | case ...: | clause |
33
| test.c:26:3:26:10 | default: | The switch $@ does not terminate with a break statement. | test.c:26:3:26:10 | default: | clause |
4+
| test.c:45:3:45:10 | default: | The switch $@ does not terminate with a break statement. | test.c:45:3:45:10 | default: | clause |

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,12 @@ void f2(int p1) {
3939
break;
4040
}
4141
}
42+
43+
void f3(int p1) {
44+
switch (p1) {
45+
default: // NON_COMPLIANT
46+
p1++;
47+
case 1: // COMPLIANT
48+
break;
49+
}
50+
}

0 commit comments

Comments
 (0)