mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
CPP: Add a test case.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
| test.cpp:2:2:2:12 | goto ... | This statement makes $@ unreachable. | test.cpp:3:2:3:5 | ExprStmt | ExprStmt |
|
||||
| test.cpp:9:3:9:8 | break; | This statement makes $@ unreachable. | test.cpp:10:3:10:6 | ExprStmt | ExprStmt |
|
||||
| test.cpp:37:3:37:8 | break; | This statement makes $@ unreachable. | test.cpp:38:3:38:11 | return ... | return ... |
|
||||
| test.cpp:91:2:91:11 | goto ... | This statement makes $@ unreachable. | test.cpp:93:2:93:5 | ExprStmt | ExprStmt |
|
||||
|
||||
@@ -81,3 +81,29 @@ void test7(int x, int cond) {
|
||||
}
|
||||
end:
|
||||
}
|
||||
|
||||
#define CONFIG_DEFINE
|
||||
|
||||
void test8() {
|
||||
int x = 0;
|
||||
|
||||
#ifdef CONFIG_DEFINE
|
||||
goto skip; // GOOD (the `x++` is still reachable in some configurations) [FALSE POSITIVE]
|
||||
#endif
|
||||
x++;
|
||||
|
||||
skip:
|
||||
}
|
||||
|
||||
void test9() {
|
||||
int x = 0;
|
||||
|
||||
#ifdef CONFIG_NOTDEFINED
|
||||
goto mid;
|
||||
#endif
|
||||
goto end; // GOOD (the `x++` is still reachable in some configurations)
|
||||
mid:
|
||||
x++;
|
||||
|
||||
end:
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user