Commit Graph

400 Commits

Author SHA1 Message Date
orbitcowboy b2263d9475 Added regression test: (style) Condition 'i==0||i==1' is always true (for loop index) 2023-03-17 19:06:17 +01:00
Paul Fultz II 61e8b84578
Fix 11610: false negative: knownConditionTrueFalse with address of variable () 2023-03-12 19:57:11 +01:00
Oliver Stöneberg 901b2ab838
Preprocessor: provide suppressions separately from settings () 2023-03-09 20:15:53 +01:00
Oliver Stöneberg 50eb0641b9
iwyu.yml: added `clang-include-cleaner` job / cleaned up includes based on `include-what-you-use` () 2023-03-04 08:53:19 +01:00
Oliver Stöneberg 5af6ca6637
made `Platform` a member of `Settings` instead of inheriting from it / cleanups () 2023-03-03 18:36:27 +01:00
Oliver Stöneberg bd1ae69b00
cleaned up includes based on `include-what-you-use` () 2023-03-02 21:50:14 +01:00
Oliver Stöneberg 8f5f06add7
some `Tokenizer` construction and related other cleanups () 2023-03-02 21:48:14 +01:00
chrchr-github 491299048b
Amend fix for Function call not recognized () 2023-03-02 21:45:15 +01:00
Oliver Stöneberg 3ec4da0f8a
improved library loading in tests () 2023-03-02 21:10:51 +01:00
Paul Fultz II 346ecdb53a
Improve valueflow after pushing to container () 2023-02-23 18:05:31 +01:00
chrchr-github ff0eee4d77
Fix FP knownConditionTrueFalse when checking for zero character ()
* Fix  FP knownConditionTrueFalse when checking for zero characte

* Fix test

* Set impossible value only for non-Boolean conditions, rename

* Fix condition
2023-02-18 17:35:12 +01:00
Oliver Stöneberg 132a5a31cf
improved setting of platform in tests / also improved platform tests ()
* fixture.h: added TODO

* TestPlatform: improved tests for built-in platforms

* TestPlatform: changed tests to TODO asserts

* testfilelister.cpp: added TODO

* fixture.h: added `PLATFORM` macro to load platform / use `PLATFORM` in tests

* platform.h: corrected capitalization in `Platform::platformString(PlatformType)` and bail on unknown type

* fixture.h: fixed `readability-redundant-string-cstr` clang-tidy warning

* testplatform.cpp: fixed `functionConst` selfcheck warnings
2023-02-11 10:44:56 +01:00
Oliver Stöneberg 7c7ccdf7c0
Check: disallow more than one instance per check () 2023-01-29 17:23:03 +01:00
Daniel Marjamäki 464fbe8d53 Update copyright year 2023-01-28 10:16:34 +01:00
Oliver Stöneberg 1d3955bd92
renamed some files in the `test` folder () 2023-01-27 08:18:32 +01:00
chrchr-github b12aebc817
Fix FN (style) Condition '...' is always true, add test for () 2023-01-26 22:03:12 +01:00
chrchr-github 4ebdf5fae1
Fix FP identicalConditionAfterEarlyExit when passing *this () 2023-01-07 22:10:07 +01:00
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