Commit Graph

407 Commits

Author SHA1 Message Date
Oliver Stöneberg 45de338f1b
cleaned up includes based on include-what-you-use / iwyu.yml: updated to yet another distro to get the latest version and updated the Chaotic-AUR key (#5267)
This is a mess. The version is AUR is still outdated and also doesn't
install anymore. Fedora 38 carries the latest version of it so use that
now. Keep the old steps in case we need to switch again in the future.
2023-08-02 10:36:17 +02:00
Anton Lindqvist 4ebb8eaf0c
Ignore zero valued enum entries from badBitmaskCheck (#5195)
Usage of zero valued enum entries can be used for documenting purposes
and should be ignored just like zeroes expanded from macros.
2023-06-26 10:43:20 +02:00
chrchr-github 6c750d9ae9
Fix #11789 FP knownConditionTrueFalse with std::vector::size() (#5184)
There is special handling for `size_t` in
`ValueType::fromLibraryType()`, which gets preempted if it is also
configured as a podtype.
2023-06-23 20:31:25 +02:00
Oliver Stöneberg 25183ff484
testrunner: more `SettingsBuilder` usage and `const` cleanups (#5026) 2023-05-02 15:54:19 +02:00
Oliver Stöneberg 2935c855c3
reduced usage of mutable `Settings` objects in tests (#4798) 2023-05-02 11:48:24 +02:00
chrchr-github 2b92351b49
Fix #11679 FP knownArgument with known return value (#5007)
* Fix #11679 FP knownArgument with known return value

* Add test for #11051
2023-04-28 08:27:48 +02:00
Oliver Stöneberg ad464c4feb
Preprocessor: relaxed dependency on `Suppressions` (#4983)
* Preprocessor: cleaned up `missingInclude()`

* Preprocessor: relaxed dependency on `Suppressions` / adjusted `TestPreProcessor::inline_suppression_for_missing_include()` which was not testing production behavior

* test/cli/test-other.py: added test for `missingInclude` and `missingIncludeSystem` inline suppressions

* fixed `constParameterReference` selfcheck warning
2023-04-21 10:14:34 +02:00
orbitcowboy b2263d9475 #8499 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 (#4883) 2023-03-12 19:57:11 +01:00
Oliver Stöneberg 901b2ab838
Preprocessor: provide suppressions separately from settings (#4878) 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` (#4844) 2023-03-04 08:53:19 +01:00
Oliver Stöneberg 5af6ca6637
made `Platform` a member of `Settings` instead of inheriting from it / cleanups (#4791) 2023-03-03 18:36:27 +01:00
Oliver Stöneberg bd1ae69b00
cleaned up includes based on `include-what-you-use` (#4599) 2023-03-02 21:50:14 +01:00
Oliver Stöneberg 8f5f06add7
some `Tokenizer` construction and related other cleanups (#4799) 2023-03-02 21:48:14 +01:00
chrchr-github 491299048b
Amend fix for #11449 Function call not recognized (#4838) 2023-03-02 21:45:15 +01:00
Oliver Stöneberg 3ec4da0f8a
improved library loading in tests (#4806) 2023-03-02 21:10:51 +01:00
Paul Fultz II 346ecdb53a
Improve valueflow after pushing to container (#4803) 2023-02-23 18:05:31 +01:00
chrchr-github ff0eee4d77
Fix #11558 FP knownConditionTrueFalse when checking for zero character (#4794)
* Fix #11558 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 (#4787)
* 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 (#4749) 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 (#4705) 2023-01-27 08:18:32 +01:00
chrchr-github b12aebc817
Fix #9353 FN (style) Condition '...' is always true, add test for #10508 (#4731) 2023-01-26 22:03:12 +01:00
chrchr-github 4ebdf5fae1
Fix #11478 FP identicalConditionAfterEarlyExit when passing *this (#4684) 2023-01-07 22:10:07 +01:00
Paul Fultz II 9da574f4a0
Fix 11227: ValueFlow: Known value not set in condition for ternary operator (#4653)
* 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() (#4633)
* 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 #11434 FP knownConditionTrueFalse with loop over bool array (#4646)
* Fix #11434 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 (#4625)
* Fix 11384: FP knownConditionTrueFalse when variable is modified in return statement

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

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

* Add test for #10597
2022-10-25 19:41:48 +02:00
chrchr-github 544ec38ca9
Add test for #2490 (#4551) 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 (#4446) 2022-10-09 21:03:48 +02:00
chrchr-github 3644d79162
Fix duplicateConditionalAssign FP (#4484)
* Fix #9406 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 #9406 FN redundant assignment of Boolean variable (#4482)
* Fix #9406 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 (#4466)
* 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 (#4453)
* 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 (#4350) 2022-09-08 19:59:02 +02:00
Paul Fultz II 2d37a77281
Fix 11296: FN: knownConditionTrueFalse ( a !=0 && b != 0 && a == 0) (#4444) 2022-09-06 07:31:48 +02:00
Paul Fultz II 016793f258
Fix 11295: Regression FP: knownConditionTrueFalse (#4443) 2022-09-06 07:31:38 +02:00
Paul Fultz II 6ce5c24f21
Refactor knownConditionTrueFalse check and isUsedAsBool function (#4432)
* Refactor knownConditionTrueFalse check and isUsedAsBool function

* Format1

* Format

* Skip assign
2022-09-04 10:24:45 +02:00
chrchr-github 3925a27182
Fix FP knowConditionTrueFalse (#4419)
* Fix #10426 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 #10426 FN (style) Condition 's.empty()' is always false (#4414)
* Fix #10426 FN (style) Condition 's.empty()' is always false

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

* Add test for #9817

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

* Modify isConstVarExpression()

* Use predicate

* Format

* #11238: Fix regression
2022-08-09 13:13:16 +02:00
chrchr-github 078a6d7804
Fix #11238 FP knownConditionTrueFalse with constexpr? (#4341) 2022-08-07 19:06:19 +02:00
chrchr-github 0eabe0505b
Handle float values (#4336) 2022-08-02 22:11:31 +02:00
chrchr-github bc409776e3
Fix #10320 Wrong redundant condition: misleading/wrong message (#4334)
* Fix #10320 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
#11233 FP: knownConditionTrueFalse (wrong message text) (#4330)
* #11233 FP: knownConditionTrueFalse (wrong message text)

* Format

* Update testcondition.cpp

* Trigger CI
2022-08-02 18:18:46 +02:00