Commit Graph

383 Commits

Author SHA1 Message Date
Paul Fultz II 9da574f4a0
Fix 11227: ValueFlow: Known value not set in condition for ternary operator ()
* Evaluate args before function call

* Fix tests

* Format

* Add test for 11227

* Format

* Fix known condition
2022-12-18 22:07:43 +01:00
Paul Fultz II 9c55b933c1
Partial fix for 11303: False negative: knownConditionTrueFalse using container .back() ()
* Partial fix for 11303: False negative: knownConditionTrueFalse using container .back()

* Format

* Fix error message
2022-12-15 18:35:19 +01:00
chrchr-github 553b579f8d
Fix FP knownConditionTrueFalse with loop over bool array ()
* Fix  FP knownConditionTrueFalse with loop over bool array

* Simplify
2022-12-15 14:31:02 +01:00
Paul Fultz II c150317f02
Fix 11384: FP knownConditionTrueFalse when variable is modified in return statement ()
* Fix 11384: FP knownConditionTrueFalse when variable is modified in return statement

* Format
2022-12-09 07:15:15 +01:00
chrchr-github 04b7c0c200
Fix FP knownConditionTrueFalse with iterator ()
* Fix wrong value set in valueFlowSameExpressions()

* Fix   FP knownConditionTrueFalse with iterator
2022-12-08 10:40:55 +01:00
chrchr-github 3b5601dbea
Add tests for , ()
* Add test for 

* Add test for 
2022-10-25 19:41:48 +02:00
chrchr-github 544ec38ca9
Add test for () 2022-10-14 11:55:45 +02:00
Daniel Marjamäki 65cd6ea7b4 Clarify knownConditionTrueFalse warnings 2022-10-10 13:45:30 +02:00
Paul Fultz II bd22ea565f
Use return instead of condition for alwaysTrueFalse check () 2022-10-09 21:03:48 +02:00
chrchr-github 3644d79162
Fix duplicateConditionalAssign FP ()
* Fix  FN redundant assignment of Boolean variable

* Fix warning, refactor

* Update testcondition.cpp

* Fix duplicateConditionalAssign FP

* Format
2022-09-20 21:57:27 +02:00
chrchr-github dcb332acb0
Fix FN redundant assignment of Boolean variable ()
* Fix  FN redundant assignment of Boolean variable

* Fix warning, refactor

* Update testcondition.cpp
2022-09-20 07:30:12 +02:00
Oliver Stöneberg b3ec225480
iwyu.yml: use `debian:unstable` to always get latest include-what-you-use / cleaned up includes ()
* iwyu.yml: use debian:unstable to always get latest include-what-you-use

* cleaned up includes based on include-what-you-use

* mitigated include-what-you-use false positives
2022-09-16 07:15:49 +02:00
Paul Fultz II 117a753b10
Partial fix 11154: FN: knownConditionTrueFalse ()
* Partial fix 11154: FN: knownConditionTrueFalse

* Formay

* Add more tests

* FOrmat

* Fix FP

* Add test

* Check for side effects

* Format

* Update tests

* Format
2022-09-08 22:08:38 +02:00
Paul Fultz II 7c986fbef1
Fix 11203: false positive: knownConditionTrueFalse 'always false' when comparing integer with floating-point () 2022-09-08 19:59:02 +02:00
Paul Fultz II 2d37a77281
Fix 11296: FN: knownConditionTrueFalse ( a !=0 && b != 0 && a == 0) () 2022-09-06 07:31:48 +02:00
Paul Fultz II 016793f258
Fix 11295: Regression FP: knownConditionTrueFalse () 2022-09-06 07:31:38 +02:00
Paul Fultz II 6ce5c24f21
Refactor knownConditionTrueFalse check and isUsedAsBool function ()
* Refactor knownConditionTrueFalse check and isUsedAsBool function

* Format1

* Format

* Skip assign
2022-09-04 10:24:45 +02:00
chrchr-github 3925a27182
Fix FP knowConditionTrueFalse ()
* Fix  FN (style) Condition 's.empty()' is always false

* Fix test

* Fix FP knowConditionTrueFalse

* Check for casts

* Fix FP for user-defined functions

* Adjust condition detection

* Tweaks
2022-08-30 18:08:24 +02:00
chrchr-github 9ab4f9976d
Fix FN (style) Condition 's.empty()' is always false ()
* Fix  FN (style) Condition 's.empty()' is always false

* Fix test
2022-08-29 12:25:10 +02:00
chrchr-github 5cc8ef7e87
Add test for ()
* Add test for 

* Add test for 

* Revert
2022-08-20 19:23:55 +02:00
Oliver Stöneberg 1b4141cbe5
added more missing `sstream` includes () 2022-08-19 18:23:15 +02:00
chrchr-github bdbd84ba98
: Fix regression ()
* Fix  FP knownConditionTrueFalse with constexpr?

* Modify isConstVarExpression()

* Use predicate

* Format

* : Fix regression
2022-08-09 13:13:16 +02:00
chrchr-github 078a6d7804
Fix FP knownConditionTrueFalse with constexpr? () 2022-08-07 19:06:19 +02:00
chrchr-github 0eabe0505b
Handle float values () 2022-08-02 22:11:31 +02:00
chrchr-github bc409776e3
Fix Wrong redundant condition: misleading/wrong message ()
* Fix  Wrong redundant condition: misleading/wrong message

* Use expressionString()

* Clarify condition

* Update testcondition.cpp

* Trigger CI
2022-08-02 18:31:02 +02:00
chrchr-github 92d569afb6
FP: knownConditionTrueFalse (wrong message text) ()
*  FP: knownConditionTrueFalse (wrong message text)

* Format

* Update testcondition.cpp

* Trigger CI
2022-08-02 18:18:46 +02:00
Daniel Marjamäki 898ad314ab badBitmaskCheck: Avoid FP when there is #ifdef in expression 2022-07-28 21:56:05 +02:00
chrchr-github 5342e2cd03
Fix FP knownConditionTrueFalse with dynamic_cast () 2022-07-20 20:48:17 +02:00
chrchr-github 6dc606fd6a
Add tests for , , () 2022-07-18 18:03:08 +02:00
chrchr-github 9e74da6126
Fix FP compare with negated constant () 2022-07-16 07:28:15 +02:00
chrchr-github 596f75e2af
Fix FP compareValueOutOfTypeRangeError ()
* Fix FP compareValueOutOfTypeRangeError

* Remove suppressions
2022-07-01 10:48:32 +02:00
Paul Fultz II 8945c151f5
Fix 11124: FP knownConditionTrueFalse with fruit ()
* Update valueType

* Allow comparisons

* Fix compare op

* Add test

* Format

* Fix FP

* Format
2022-06-11 11:02:04 +02:00
Paul Fultz II 653a1ea83e
Fix 11100: FP knownConditionTrueFalse with getter/setter member functions ()
* Fix 11100: FP knownConditionTrueFalse with getter/setter member functions

* Format
2022-06-11 11:00:40 +02:00
chrchr-github 51c8630bb3
Fix FP knownConditionTrueFalse with virtual function ()
* Fix  FP knownConditionTrueFalse with virtual function

* Remove redundant check
2022-06-10 20:17:57 +02:00
chrchr-github b80d06b69e
Don't warn for 'x | MACRO' when MACRO is 0 () 2022-06-07 21:13:31 +02:00
chrchr-github 52453947c8
Don't warn for 'x | 0' in macro ()
* Fix  FN badBitmaskCheck for binary or with 0

* Add test for 

* Don't warn for 'x | 0' in macro

* Add test for 
2022-06-06 11:17:36 +02:00
chrchr-github f962436826
Fix FN badBitmaskCheck for binary or with 0 ()
* Fix  FN badBitmaskCheck for binary or with 0

* Add test for 
2022-06-04 17:25:10 +02:00
orbitcowboy c30333425b Added a regression test for ticket - FN: knownConditionTrueFalse 2022-05-24 09:21:21 +02:00
chrchr-github 2a7f00cf9a
Fix FN Condition '...' is always true ' uint16_t i; ( i <= 0xFFFF)' () 2022-05-21 08:33:42 +02:00
chrchr-github 63a1698335
Fix FP multiCondition when variable is assigned in if/else () 2022-05-11 20:01:13 +02:00
chrchr-github ad547af6f9
Add tests for , , ()
* Add tests for , 

* Add test for 

* Add tests for , 

* Add test for 

* Comment
2022-05-10 18:25:01 +02:00
chrchr-github 16ef2c1838
Add test for ()
* Add tests for , 

* Add test for 
2022-05-09 20:26:15 +02:00
chrchr-github 8c0561a78b
Add tests for , () 2022-05-09 14:52:31 +02:00
chrchr-github 509e42afd4
Fix FN duplicateCondition with struct member ()
* Fix  FN duplicateCondition with struct member

* Update testcondition.cpp
2022-05-03 19:57:30 +02:00
Paul Fultz II 4e7125554f
Fix 8358: FP: Condition '(number*0)!=0' is always false () 2022-04-30 09:35:51 +02:00
Paul Fultz II aafd1e10be
Fix 11006: FP uninitvar with unknown constant () 2022-04-28 10:48:37 +02:00
chrchr-github da1e2b22be
Add some tests ()
* Test for 

* Test for 

* Test for 

* Test for 

* Fix test case
2022-04-13 12:25:53 +02:00
chrchr-github 28a024ac4a
Fix incorrectLogicOperator/knownConditionTrueFalse for constexpr () 2022-04-11 20:42:54 +02:00
chrchr-github 2bccde0e3b
Fix FP Logical condition considered always false () 2022-04-09 14:09:10 +02:00
chrchr-github 52b4aeb279
Fix FP knownConditionTrueFalse with double to int cast () 2022-04-07 10:42:57 +02:00