Commit Graph

1377 Commits

Author SHA1 Message Date
Anton Lindqvist 73b9442edd
Fix constParameterPointer regression (#5361)
Commit 73251544a ("Fix #11842 FN constParameterPointer with library
function (#5257)") most likely introduced a regression for (C) function
pointers passed to functions provided by the standard library that
cppcheck has knowledge about.
2023-08-23 10:33:01 +02:00
Paul Fultz II 2adaafd20e
Fix 11887: FP knownPointerToBool with const_cast (#5357) 2023-08-23 01:07:49 +02:00
Paul Fultz II 03b952d5eb
Fix 11579: false negative: knownConditionTrueFalse with non-bool as bool parameter (#5349)
This adds a new checker to check for pointer to bool conversions that
are always known. I removed the previous knownConditionTrueFalse checks
since this was too noisy.
2023-08-20 22:32:41 +02:00
Paul Fultz II d691450443
Improve knownArgument to check arguments to any nary function (#5348) 2023-08-19 19:59:15 +02:00
Oliver Stöneberg bfb50ca9d8
removed unnecessary `Settings` parameter from `Check::runChecks()` and made `Tokenizer` a reference (#5308)
There was no need for the `Tokenizer` parameter to be a pointer as it
could never be `nullptr` and was also dereferenced without checking
first.

As a reference to the `Settings` was already available via the
`Tokenizer` there was no need to pass it separately. In the production
code there will only be one instance of it but in the tests we could
have accidentally passed a different one.
2023-08-18 12:03:50 +02:00
chrchr-github 824f89514a
Add test for #10350, fix arg direction in windows.cfg (#5328) 2023-08-14 17:25:00 +02:00
chrchr-github 466da1e77a
Fix FP misusedScopedObject (#5321) 2023-08-13 22:24:17 +02:00
chrchr-github 838b6b86e3
Fix #11862 FN constParameterPointer with increment (#5291) 2023-08-08 10:38:03 +02:00
chrchr-github 73251544a4
Fix #11842 FN constParameterPointer with library function (#5257) 2023-08-05 18:48:43 +02:00
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
chrchr-github 931a59a724
Fix FN variableScope (#5273)
Co-authored-by: chrchr-github <chrchr@github>
2023-08-01 23:56:24 +02:00
chrchr-github bfaa7c075a
Fix #11845 FP variableScope if buffer is passed to a conditionally called function (#5265)
Co-authored-by: chrchr-github <chrchr@github>
2023-07-27 22:18:34 +02:00
chrchr-github 99f7f88f39
Fix FN constParameterPointer (#5270)
Co-authored-by: chrchr-github <chrchr@github>
2023-07-27 20:54:12 +02:00
chrchr-github 218650dc85
Fix #11820 FP duplicateExpression with double negation (#5227) 2023-07-07 23:30:59 +02:00
chrchr-github cc38ef4168
Fix #11818 FP constParameterReference / #11819 FP stlcstrConstructor / #11814 FP unknownMacro (#5224) 2023-07-07 15:54:07 +02:00
Paul Fultz II 4f466a5961
Fix 11505: FP zerodivcond with modulo (#5192) 2023-06-25 20:38:32 +02:00
chrchr-github 8f6b0b41e7
Simplify qt.cfg, wxwidgets.cfg (#5166) 2023-06-17 17:04:14 +02:00
Paul Fultz II d6e3182441
Fix 11721: False positive: constParameterReference with overloaded template function (#5151) 2023-06-17 11:31:47 +02:00
chrchr-github 39f958bcfb
Fix #11596 FP uninitvar with array of function pointers (#5098) 2023-06-07 11:41:22 +02:00
chrchr-github 055489df5a
Fix #11742 Can't reduce scope as variable references itself (#5112) 2023-06-02 23:33:17 +02:00
chrchr-github 7696bd1357
Fix #11225 FN constParameter with cast (#5100)
* Fix #11225 FN constParameter with cast

* Add const
2023-05-31 16:51:03 +02:00
chrchr-github 647432580f
Fix #11720 FN functionConst when using base class members (#5068)
* Fix #11720 FN functionConst when using base class members

* Format

* Add const

* Add const

* Improve const check for arguments, comments, tests

* Add test for #11573

* Add test for #11501

* Fix merge

* Add tests

* Use ASSERT_EQUALS

* Redundant check
2023-05-28 01:11:59 +02:00
chrchr-github 78182d4773
Fix FN constVariablePointer (#5076)
* Fix FN constVariablePointer

* Fix FP

* Add const

* Fix tests

* Add const
2023-05-22 19:53:51 +02:00
Daniel Marjamäki f72db74817
Fixed #11013 (FP overlappingWriteUnion with anonymous struct in union) (#5067) 2023-05-20 10:34:42 +02:00
Paul Fultz II 543b4adc8a
Fix 11682: False positive: constParameterReference with overloaded method (#5038)
* Fix 11682: False positive: constParameterReference with overloaded method

* Format
2023-05-05 11:27:15 +02:00
chrchr-github 100d17df4f
Fix #11681 FN constParameterPointer with std::vector (#5000) 2023-05-04 11:10:58 +02:00
Oliver Stöneberg 5833fc3c19
testrunner: even more `SettingsBuilder` usage and `const` cleanups (#5030)
* moved some of the test-only `Library::loadxmldata()` calls into `test`

* testrunner: reduced need for backup/restore of settings
2023-05-04 10:31:05 +02:00
chrchr-github f04d47ac61
Fix remaining example from #11131 (#5029) 2023-05-03 16:24:56 +02:00
chrchr-github ec2a2ad41f
Partial fix for #11131 FN variableScope with const member functions (#5027) 2023-05-03 10:02:16 +02:00
chrchr-github 7e0ddd3669
Set function pointer for ::f (#5028) 2023-05-02 22:53:21 +02:00
Oliver Stöneberg 25183ff484
testrunner: more `SettingsBuilder` usage and `const` cleanups (#5026) 2023-05-02 15:54:19 +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
chrchr-github 5c7914aaa6
Fix FN constParameterReference with std::array (#4999) 2023-04-21 20:33:06 +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
chrchr-github e70a888833
Fix constPointer FP #11674, TODOs (#4976)
* Fix constPointer TODOs

* Fix #11674 FP constParameterPointer when function signature is fixed

* Format
2023-04-18 20:36:14 +02:00
chrchr-github 87755e3bae
Fix autoNoType with function returning container, rvalue reference (#4926) 2023-04-12 22:10:10 +02:00
chrchr-github a0b59ff56a
Fix FN constVariableReference (#4949) 2023-04-11 14:00:40 +02:00
Paul Fultz II ac14fd218b
ValueFlow: Infer possible symbolic values (#4947) 2023-04-10 19:27:29 +02:00
chrchr-github 63151f3291
Fix crash in constPointer() (#4945) 2023-04-09 16:38:09 +02:00
chrchr-github ab24e3a3c8
Fix remaining example from #11599, FN #11646, fix crash (#4929)
* Fix remainig example from #11599

* Fix FP, new warnings

* More warnings

* Use getTokenArgumentFunction()

* Fix crash

* Fix #11646 constParameter not reported with "const * const" parameter

* Fix test

* Fix new warnings

* Add suppression

* Add const, fix suppression
2023-04-06 18:46:45 +02:00
Paul Fultz II d5e2ee411e
Fix 11578: FP accessMoved with range-based for loop (#4931)
* Fix 11578: FP accessMoved with range-based for loop

* Format
2023-04-03 19:44:47 +02:00
chrchr-github 86efca28a3
Fix crash in constPointer() (#4932)
* Fix crash in constPointer()

* Format
2023-04-03 19:44:08 +02:00
chrchr-github a336048d14
Fix #11599 false negative: constParameter (#4902)
* Partial fix for #11599 false negative: constParameter

* Adjust test

* Update testother.cpp

* Update testother.cpp

* Fix #11599 false negative: constParameter

* Fix new warnings

* Format

* Add difference_type

* Remove isAliased()

* Undo

* Adjust test

* Add test

* Improve const check

* Tweak constness, add tests

* Add tests

* Use new helper function, fixtest

* Remove bailout, fix check for cast

* Prevent FP

* Fix constVariable check, add tests

* Format

* Format

* Add test for #11632
2023-04-02 20:36:23 +02:00
chrchr-github 4d72e0f5b5
Fix #11625 FP constVariable when returning by reference (#4921) 2023-03-30 07:24:36 +02:00
chrchr-github 3836367d95
Fix FN passedByValue with array access, range-based for (#4922)
* Fix FN passedByValue with array access, range-based for

* Format

* Fix/suppress new warnings
2023-03-30 07:24:23 +02:00
chrchr-github 19eef2c584
Partial fix for #11599 false negative: constParameter (#4901) 2023-03-19 17:43:23 +01:00
Oliver Stöneberg e2f38fdaf3
removed `experimental` and `safe` from `Certainty` (#4819) 2023-03-12 14:15:29 +01:00
Oliver Stöneberg 901b2ab838
Preprocessor: provide suppressions separately from settings (#4878) 2023-03-09 20:15:53 +01:00
chrchr-github c76b05ad75
Fix #11607 FP constVariable with auto and std::map (#4877) 2023-03-09 20:01:50 +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