mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
CPP: Fix false positives in while/for loops.
This commit is contained in:
@@ -1,4 +1,2 @@
|
||||
| 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:39:4:39:12 | continue; | This 'continue' never re-runs the loop - the $@ is always false. | test.cpp:36:9:36:13 | 0 | loop condition |
|
||||
| test.cpp:47:4:47:12 | continue; | This 'continue' never re-runs the loop - the $@ is always false. | test.cpp:44:14:44:18 | 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 |
|
||||
|
||||
@@ -36,7 +36,7 @@ void test1()
|
||||
while (false)
|
||||
{
|
||||
if (cond())
|
||||
continue; // GOOD [never reached, if the condition changed so it was then the result would no longer apply] [FALSE POSITIVE]
|
||||
continue; // GOOD [never reached, if the condition changed so it was then the result would no longer apply]
|
||||
if (cond())
|
||||
break;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ void test1()
|
||||
for (i = 0; false; i++)
|
||||
{
|
||||
if (cond())
|
||||
continue; // GOOD [never reached, if the condition changed so it was then the result would no longer apply] [FALSE POSITIVE]
|
||||
continue; // GOOD [never reached, if the condition changed so it was then the result would no longer apply]
|
||||
if (cond())
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user