mirror of
https://github.com/github/codeql.git
synced 2026-05-01 11:45:14 +02:00
CPP: Add a test where continue is used in a switch to exit the loop.
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
| test.cpp:13:4:13:12 | continue; | This 'continue' never re-runs the loop - the $@ is always false. | test.cpp:16:11:16:15 | 0 | loop condition |
|
||||
| test.cpp:59:5:59:13 | continue; | This 'continue' never re-runs the loop - the $@ is always false. | test.cpp:62:12:62:16 | 0 | loop condition |
|
||||
| test.cpp:88:4:88:12 | continue; | This 'continue' never re-runs the loop - the $@ is always false. | test.cpp:93:11:93:11 | 0 | loop condition |
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
bool cond();
|
||||
|
||||
void test1()
|
||||
void test1(int x)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -72,4 +72,23 @@ void test1()
|
||||
break;
|
||||
} while (true);
|
||||
} while (false);
|
||||
|
||||
do
|
||||
{
|
||||
switch (x)
|
||||
{
|
||||
case 1:
|
||||
// do [1]
|
||||
|
||||
break; // break out of the switch
|
||||
|
||||
default:
|
||||
// do [2]
|
||||
|
||||
continue; // break out of the loop entirely, skipping [3] [FALSE POSITIVE]
|
||||
};
|
||||
|
||||
// do [3]
|
||||
|
||||
} while (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user