Fix #8545 FN Condition '...' is always true ' uint16_t i; ( i <= 0xFFFF)'#4114
Fix #8545 FN Condition '...' is always true ' uint16_t i; ( i <= 0xFFFF)'#4114danmar merged 6 commits intocppcheck-opensource:mainfrom
Conversation
|
Without the suppression, CMake test fails. |
|
|
||
| unsigned int u = errno; | ||
| // cppcheck-suppress unsignedPositive | ||
| // cppcheck-suppress [unsignedPositive, compareValueOutOfTypeRangeError] |
There was a problem hiding this comment.
Interesting - I thought the format was cppcheck-suppress id1;id2.
There was a problem hiding this comment.
According to the manual: // cppcheck-suppress [aaaa, bbbb]
In the same job or different ones? Maybe a
The only case I am aware of is with a Windows binary - see https://trac.cppcheck.net/ticket/10850#comment:2. |
|
I feel like this would be better in fixed in ValueFlow as this could enable inferring more values and improving non-style checks. In valueFlowImpossibleValues, we set out of range values to impossible, for example booleans are set to https://github.com/danmar/cppcheck/blob/main/lib/valueflow.cpp#L1650 We could add the impossible values for integers smaller than 32 bits, but several unit tests for valueflow may need to be updated to use |
|
There also is some overlap with |
da1f05a to
2f2545f
Compare
No description provided.