Daniel Marjamäki
64fbffc90d
astyle formatting
...
[ci skip]
2018-10-21 20:28:46 +02:00
Paul Fultz II
edde0eedaa
Fix FP issue 8801: Condition 'a+b' is always true ( #1444 )
2018-10-21 08:04:00 +02:00
Daniel Marjamäki
e2ea8bc2b0
astyle formatting
...
[ci skip]
2018-10-20 09:28:28 +02:00
Paul Fultz II
40cb9cb1bc
Check conditions in return statements ( #1411 )
...
* Identify return conditions in multiconditions
* Improve error messages
* Check return statements are always true or false
* Add more tests for FPs
* Fix FP when returning const like variables
* Fix FP when returning pointers or classes
* Fix FP with member variable access
* Check non-local variables
* Use simplematch
* Check for null
2018-10-18 21:01:47 +02:00
Paul Fultz II
1fe1ec09a8
Reenable follow var for logical conjunction ( #1400 )
2018-10-01 14:40:03 +02:00
Paul Fultz II
2c91b95d2a
Reenable followVar for multicondition ( #1401 )
2018-10-01 14:34:55 +02:00
Paul Fultz II
f65cf220ba
Fix false positives in unknownEvaluationOrder when using followVar ( #1391 )
...
Fix false positives in unknownEvaluationOrder when using followVar
2018-09-28 08:38:24 +02:00
Daniel Marjamäki
df9df70ba7
astyle formatting
...
[ci skip]
2018-09-08 09:07:59 +02:00
Paul Fultz II
5a2362b2a0
Fix issue 8738: Dont warn about multiconditions when value is known ( #1369 )
2018-09-07 15:02:34 +02:00
Paul Fultz II
2da958efb5
Fix issue 8722: Avoid duplicate messages due for followVar ( #1367 )
2018-09-06 06:55:36 +02:00
Paul Fultz II
ab55b9eccb
Check for same expression in condition check to avoid duplicate messages ( #1359 )
2018-09-02 08:43:17 +02:00
Paul Fultz II
bbf876256c
Add error path to more diagnostics that rely on isSameExpression ( #1342 )
2018-08-17 09:25:07 +02:00
Daniel Marjamäki
1b933f4dd1
astyle formatting
...
[ci skip]
2018-08-05 22:40:21 +02:00
Paul Fultz II
b839ad60dd
Fix issue 6856: add checks in isOppositeCond when using == and < or > ( #1298 )
...
* Fix issue 6856: add checks in isOppositeCond when using == and < or >
* Move tests to testcondition
* Fix some more tests
* Fix test messages
* Remove the float check
2018-08-05 22:39:40 +02:00
Paul Fultz II
9895ea5ff2
Fix issue 470: Condition is always true or false on logical operators ( #1294 )
...
* Fix issue 470: Condition is always true or false on logical operators
* Dont warn on literals
* Compute logical operators using valueflow
* Fix FP when using literals
* Always warn on subconditions that are always true
* Use percent matches first
* Add test for logical operators
* Check if parent is null
2018-07-23 08:51:59 +02:00
Daniel Marjamäki
77b653bf94
Clarify warnings when char literals are converted to bool in conditions
2018-07-21 18:40:06 +02:00
Daniel Marjamäki
c60763bc14
Refactoring; Use range for loop
2018-07-14 08:18:10 +02:00
Daniel Marjamäki
5b1d96b346
Clarify code with Token::isUnaryOp()
2018-07-14 08:04:08 +02:00
Daniel Marjamäki
2b125e013a
Code refactoring, no functional change intended
2018-07-13 09:20:53 +02:00
Paul Fultz II
42f075c3fa
Skip literals for always true/false ( #1304 )
2018-07-12 23:06:47 +02:00
Daniel Marjamäki
79ffe1d4fc
Rename _tokenizer, _settings, _errorLogger
2018-06-16 16:10:28 +02:00
Daniel Marjamäki
45379a3aa6
Updated copyright year for modified files
...
[ci skip]
2018-06-10 22:07:21 +02:00
Paul Fultz II
e571e598b6
Fix false positive with inner conditions when using pointers ( #1195 )
2018-04-28 18:56:13 +02:00
Daniel Marjamäki
f336c2efe7
Refactoring; Renamed Scope::classStart and Scope::classEnd
2018-04-27 22:36:30 +02:00
Daniel Marjamäki
3d78320d04
CheckCondition: Use isLikelyStreamRead
2018-04-22 09:48:54 +02:00
Daniel Marjamäki
7ee636b934
Refactoring: Reuse isLikelyStreamRead in isVariableChanged
2018-04-18 17:46:10 +02:00
Daniel Marjamäki
1b4f4d7130
Fixed #8495 (False positive: boolean result used in bitwise operation when & is overloaded)
2018-04-17 22:14:17 +02:00
PKEuS
b15cc3f236
Refactorization: Replace several push_back-sequences by initializer lists
2018-04-09 09:54:39 +02:00
Daniel Marjamäki
795b9f5e0f
astyle formatting
2018-04-08 09:25:59 +02:00
Paul Fultz II
b85dda77da
Add a check for identical inner conditions ( #1156 )
2018-04-08 08:13:44 +02:00
jrp2014
17bd2f0c72
Refactor lib/checkcondition.cpp
2018-04-05 15:53:49 +02:00
jrp2014
b6504c70ca
Improve constness
2018-04-04 21:51:31 +02:00
Daniel Marjamäki
c4caee6b18
Updated copyright year
2018-01-14 15:37:52 +01:00
Dmitry-Me
5a642ac35e
Omit unneeded computations
2017-12-26 02:07:24 +03:00
Dmitry-Me
8851fd64a6
Break loop early
2017-12-21 03:13:00 +03:00
Oleksandr Redko
a8700f5622
Remove redundant parts of conditional expressions ( #988 )
...
All issues were found with PVS-Studio:
V560 A part of conditional expression is always true: tok. astutils.cpp 407
V560 A part of conditional expression is always true: size > 0. checkbufferoverrun.cpp 709
V547 Expression 'secondTrue' is always true. checkcondition.cpp 1013
V547 Expression 'firstTrue' is always true. checkcondition.cpp 1020
V560 A part of conditional expression is always true: !scan. checkio.cpp 1036
V560 A part of conditional expression is always true: scope->function. checknullpointer.cpp 395
V560 A part of conditional expression is always true: tok2. checkstl.cpp 268
V560 A part of conditional expression is always true: par. tokenize.cpp 9440
V547 Expression '!erased' is always true. symboldatabase.cpp 3990
2017-11-03 10:39:57 +01:00
Daniel Marjamäki
539258f7a3
Fix FP for pointer addition checker
2017-10-22 23:13:12 +02:00
Daniel Marjamäki
28cfee2d4f
Fixed #8250 (New check: Pointer calculation result cant be NULL unless there is overflow)
2017-10-22 14:32:54 +02:00
Daniel Marjamäki
4700b75ded
Clarify error message 'condition is always true/false'
2017-10-16 22:05:00 +02:00
Dmitry-Me
696c5b8100
Reduce duplication, omit building unneeded string
2017-09-18 03:06:35 +03:00
Dmitry-Me
7d6ef71c4d
More selective match pattern
2017-09-18 02:45:02 +03:00
Daniel Marjamäki
927b14b60f
Fixed #8217 (Crash in isVariableChanged())
2017-09-14 15:45:15 +02:00
Daniel Marjamäki
bb20c0504e
CheckCondition: Fix FP in daca (iqtree) 'in >> ch'
2017-09-13 22:46:36 +02:00
Daniel Marjamäki
db321c2617
CheckCondition: Fix FP when there is increment/decrement in condition (daca icu)
2017-09-10 22:58:05 +02:00
Daniel Marjamäki
c34fdd1905
CheckCondition: Fix FP for undeclared variables (daca)
2017-09-10 22:30:41 +02:00
Daniel Marjamäki
b81b4fcb78
Fixed #8208 (CheckCondition: Use Library to determine if function is const)
2017-09-08 18:08:32 +02:00
Daniel Marjamäki
899ad8479d
CheckCondition: Fixed FP when condition contains global static variable
2017-09-08 15:44:56 +02:00
Daniel Marjamäki
d9adb5432a
astyle formatting
...
[ci skip]
2017-09-08 15:41:14 +02:00
Nekto89
9cbfa0e383
Fix #7803 : false negative: condition is always true 'if (flags & A)' ( #938 )
2017-09-08 14:30:42 +02:00
Daniel Marjamäki
58db814d72
Rephraze /Same/Identical/
2017-09-08 12:41:33 +02:00