Skip to content

Commit d6ac6df

Browse files
committed
Rule 15.3: Address compiler compatibility issues
Labels must be before a statement.
1 parent 5edcade commit d6ac6df

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
| test.c:2:3:2:10 | goto ... | The $@ statement and its $@ are not declared or enclosed in the same block. | test.c:2:3:2:10 | goto ... | goto | test.c:4:3:4:5 | label ...: | label |
2-
| test.c:37:3:37:10 | goto ... | The $@ statement and its $@ are not declared or enclosed in the same block. | test.c:37:3:37:10 | goto ... | goto | test.c:41:3:41:5 | label ...: | label |
3-
| test.c:52:5:52:12 | goto ... | The $@ statement and its $@ are not declared or enclosed in the same block. | test.c:52:5:52:12 | goto ... | goto | test.c:55:3:55:5 | label ...: | label |
2+
| test.c:40:3:40:10 | goto ... | The $@ statement and its $@ are not declared or enclosed in the same block. | test.c:40:3:40:10 | goto ... | goto | test.c:44:3:44:5 | label ...: | label |
3+
| test.c:55:5:55:12 | goto ... | The $@ statement and its $@ are not declared or enclosed in the same block. | test.c:55:5:55:12 | goto ... | goto | test.c:58:3:58:5 | label ...: | label |

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ void f1() {
22
goto L1;
33
for (int i = 0; i < 100; i++) {
44
L1: // NON_COMPLIANT
5+
break;
56
}
67
}
78

@@ -13,6 +14,7 @@ void f2() {
1314
}
1415
}
1516
L2: // COMPLIANT
17+
return;
1618
}
1719

1820
void f3() {
@@ -21,6 +23,7 @@ void f3() {
2123
for (int j = 0; j < 10; j++) {
2224
goto L3;
2325
L3: // COMPLIANT
26+
break;
2427
}
2528
}
2629
}

0 commit comments

Comments
 (0)