Commit bc33aee
authored
When a for loop's condition is impossible given the initial value (e.g.
`for (int i = 0; i > 10; i++)`), cppcheck was not emitting a
knownConditionTrueFalse warning.
Fix by populating memory1, memory2 and memoryAfter with the init state
when the condition is immediately false (and no error occured). We can
then set the value for the condition token and thus emit a
knownConditionTrueFalse warning.
Signed-off-by: Francois Berder <fberder@outlook.fr>
1 parent bc04c0d commit bc33aee
2 files changed
Lines changed: 38 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5181 | 5181 | | |
5182 | 5182 | | |
5183 | 5183 | | |
5184 | | - | |
| 5184 | + | |
| 5185 | + | |
| 5186 | + | |
| 5187 | + | |
| 5188 | + | |
| 5189 | + | |
| 5190 | + | |
| 5191 | + | |
| 5192 | + | |
| 5193 | + | |
5185 | 5194 | | |
| 5195 | + | |
5186 | 5196 | | |
5187 | 5197 | | |
5188 | 5198 | | |
| |||
5388 | 5398 | | |
5389 | 5399 | | |
5390 | 5400 | | |
5391 | | - | |
5392 | | - | |
5393 | | - | |
5394 | | - | |
5395 | | - | |
5396 | | - | |
5397 | | - | |
5398 | | - | |
5399 | | - | |
5400 | | - | |
5401 | | - | |
5402 | | - | |
5403 | | - | |
5404 | | - | |
5405 | | - | |
5406 | | - | |
5407 | | - | |
| 5401 | + | |
| 5402 | + | |
| 5403 | + | |
| 5404 | + | |
| 5405 | + | |
| 5406 | + | |
| 5407 | + | |
| 5408 | + | |
| 5409 | + | |
| 5410 | + | |
| 5411 | + | |
| 5412 | + | |
| 5413 | + | |
| 5414 | + | |
| 5415 | + | |
| 5416 | + | |
| 5417 | + | |
| 5418 | + | |
| 5419 | + | |
| 5420 | + | |
| 5421 | + | |
| 5422 | + | |
| 5423 | + | |
| 5424 | + | |
| 5425 | + | |
| 5426 | + | |
5408 | 5427 | | |
5409 | 5428 | | |
5410 | 5429 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5680 | 5680 | | |
5681 | 5681 | | |
5682 | 5682 | | |
5683 | | - | |
| 5683 | + | |
5684 | 5684 | | |
5685 | 5685 | | |
5686 | 5686 | | |
| |||
0 commit comments