CPP: Fix false positives in while/for loops.

This commit is contained in:
Geoffrey White
2018-11-08 18:13:28 +00:00
parent 136ca72297
commit 83d4b23ae3
3 changed files with 5 additions and 7 deletions

View File

@@ -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 |

View File

@@ -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;
}