Skip to content

Commit e462d66

Browse files
committed
Rule 15.3: Fix message, remove dead code
1 parent 743b707 commit e462d66

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

c/misra/src/rules/RULE-15-3/GotoLabelBlockCondition.ql

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ predicate isPartOfSwitch(Stmt goto) {
1919
exists(SwitchStmt switch | switch.getStmt() = goto.getParent())
2020
}
2121

22-
Stmt getNextStmt(ControlFlowNode node) {
23-
node.getASuccessor() = result
24-
or
25-
exists(ControlFlowNode other |
26-
node.getASuccessor() = other and other != result and result = getNextStmt(other)
27-
)
28-
}
29-
3022
SwitchCase getSwitchCase(Stmt stmt) {
3123
exists(int index, SwitchStmt switch |
3224
getStmtInSwitch(switch, stmt, index) and getStmtInSwitch(switch, result, index - 1)
@@ -66,5 +58,5 @@ where
6658
isPartOfSwitch(goto) and not getSwitchCase(goto) = getSwitchCase(target)
6759
)
6860
)
69-
select goto, "The $@ statement and its $@ are not declared or enclosed in the same block. test",
70-
goto, "goto", target, "label"
61+
select goto, "The $@ statement and its $@ are not declared or enclosed in the same block.", goto,
62+
"goto", target, "label"
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
| test.c:2:3:2:10 | goto ... | The $@ statement and its $@ are not declared or enclosed in the same block. test | 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 | 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 | test.c:52:5:52:12 | goto ... | goto | test.c:55:3:55:5 | label ...: | label |
1+
| 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 |

0 commit comments

Comments
 (0)