Commit Graph

12561 Commits

Author SHA1 Message Date
Anton Lindqvist 5c6962c273
Fix FP unusedVariable with arrays (#5319) 2023-08-12 16:55:52 +02:00
Anton Lindqvist b9cc138e57
Fix FP badBitmaskCheck in nested binary expressions (#5316)
If one operand is another binary expression, recursively ensure that no
nested operands are expanded macros.
2023-08-11 23:06:24 +02:00
chrchr-github 720ae01898
Fix #11353 FP uninitvar for struct member set via pointer (#5314) 2023-08-11 18:46:51 +02:00
chrchr-github a7d487f6db
Fix #11805 FP uninitvar for stringstream into deref pointer to uninit var / #11804 FP uninitvar for array in struct in struct (#5311) 2023-08-11 18:45:58 +02:00
chrchr-github 560982de94
Fix FP leakNoVarFunctionCall (#5309) 2023-08-10 20:55:02 +02:00
chrchr-github 23deadb370
Fix #11866 FN memleak when pointer is converted to bool (#5306) 2023-08-10 15:38:12 +02:00
Paul Fultz II 24479c60f9
Fix 11850: false negative: knownConditionTrueFalse with std::string::empty() after modification (#5307) 2023-08-09 20:33:44 +02:00
Oliver Stöneberg 2502897265
avoid some redundant and unused settings in tests among other cleanups / added and used `WARN_UNUSED` attribute (#5284) 2023-08-09 12:43:55 +02:00
Paul Fultz II 037bed5b3c
testrunner: fix clang compile error related to `dinit` (#5297)
This fixes the compile error introduced in 5d201c4.
2023-08-08 23:55:07 +02:00
chrchr-github 5ea1bca99f
Fix argument direction in windows.cfg, missing Qt macros (#5302) 2023-08-08 22:55:55 +02:00
chrchr-github c3d7c91e88
Additional call to setValueTypeInTokenList() (#5300) 2023-08-08 22:54:27 +02:00
chrchr-github eee1221738
Use in-class initializers, default constructors, class -> struct (#4842) 2023-08-08 11:05:02 +02:00
chrchr-github 838b6b86e3
Fix #11862 FN constParameterPointer with increment (#5291) 2023-08-08 10:38:03 +02:00
chrchr-github 610777d586
Set enum ValueType for :: (#5298) 2023-08-07 21:40:33 +02:00
Oliver Stöneberg 072212e708
added `TestCheck` and moved some tests from `TestCppcheck` (#5289) 2023-08-07 20:49:10 +02:00
Oliver Stöneberg 988edd24c2
TestSingleExecutor: test clang-tidy invocation (#5294) 2023-08-07 20:47:24 +02:00
Oliver Stöneberg dcdf67a694
some `-Wdouble-promotion` Clang compiler warnings (#4820) 2023-08-07 20:44:25 +02:00
Oliver Stöneberg cc592a6927
CppCheckExecutor: improved library loading error handling a bit (#5275) 2023-08-07 19:48:11 +02:00
Oliver Stöneberg a17f6e89d1
pass `Suppressions` separately from `const Settings` into executors (#5278) 2023-08-07 18:39:57 +02:00
chrchr-github 73251544a4
Fix #11842 FN constParameterPointer with library function (#5257) 2023-08-05 18:48:43 +02:00
Samuel Poláček b2511fb3ae
Check if --cppcheck-build-dir exists (#5254)
Cppcheck does not report that cppcheck build dir does not exist and also
does not report any write issues to the non-existent directory.

This means that cppcheck build dir is actually not used.

We should either create the directory or fail.
2023-08-04 17:38:43 +02:00
Oliver Stöneberg 5d201c4e87
testrunner: use structs with designated initialization to pass options (#4975)
I need to add parameters to some `check()` functions in the tests and
things are already pretty messy with having to specify all the default
values - readability aside.

I found this on https://stackoverflow.com/a/49572324/532627 - apparently
the CC BY-SA license by StackOverflow allows the usage within GPL.
2023-08-04 13:56:18 +02:00
chrchr-github 5ff8955dbe
Fix #11862 FP truncLongCastAssignment with increment (#5290) 2023-08-03 13:49:11 +02:00
chrchr-github faf8047050
Fix FP truncLongCastReturn on Windows (#5262) 2023-08-02 12:27:29 +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
Paul Fultz II 389e446dc0
Fix 11848: Assert failure in getParentValueTypes() (#5274) 2023-08-02 10:29:19 +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
Tobias f10851dc37
posix.cfg: erand48/nrand48/jrand48 fixed argument direction (#5253) 2023-07-27 07:50:46 +02:00
chrchr-github 2cf4b3a6f3
Fix functionConst TODO (#5261) 2023-07-24 16:26:23 +02:00
chrchr-github 101ddea1e6
Fix #11840 FP constStatement with template parameters on operator (#5258) 2023-07-21 17:33:18 +02:00
chrchr-github a6b0129725
Fix #11838 FP uninitvar with label matching variable name (#5251) 2023-07-20 10:45:44 +02:00
chrchr-github d2546d5252
Fix #11788 False positive: unreadVariable in else (#5248) 2023-07-18 21:11:03 +02:00
chrchr-github 2878c68ec0
Fix FP unknownMacro (#5249) 2023-07-18 12:16:54 +02:00
Paul Fultz II 92caa835b6
Fix 11806: FP uninitvar for reference to unitvar in ternary ?: operator (#5247) 2023-07-17 10:34:54 +02:00
chrchr-github e4827cb3df
Fix #11828 False positive when getting a span via an out argument (#5243)
We didn't warn for the TODO even before this change.
2023-07-15 17:53:40 +02:00
chrchr-github 72212331fb
Fix #11832 False positive: uninitialized variable '*(&var) = 0' (#5241) 2023-07-14 19:14:33 +02:00
chrchr-github a4a29bfbc5
Fix #11411 FP selfInitialization after initialization of previous member from initializer list (#5239) 2023-07-14 10:33:05 +02:00
chrchr-github 48dd4dc33e
Fix #11831 FP negativeContainerIndex / wrong return value from virtual function (#5240) 2023-07-13 20:38:47 +02:00
chrchr-github 258581ce2e
Fix FP uselessOverride with macro (#5238) 2023-07-13 12:18:29 +02:00
chrchr-github c0bd9f8bbd
Fix #11827 FP duplInheritedMember - different return type (#5231) 2023-07-12 15:56:07 +02:00
chrchr-github 709fec88f9
Revert "Fix #11765 FN: minsize not checked for string literal, buffer… (#5235)
… access out of bounds not found (#5154)"

This reverts commit 9ad18f51af.
2023-07-11 22:19:01 +02:00
chrchr-github 8d3fd88d3f
Fix #11802 FP stlcstr for string in shared_ptr copied elsewhere (#5230) 2023-07-10 15:27:33 +02:00
chrchr-github 9ad18f51af
Fix #11765 FN: minsize not checked for string literal, buffer access out of bounds not found (#5154) 2023-07-08 14:46:32 +02:00
chrchr-github 49b79b7674
Extend duplInheritedMember check to functions (#5226) 2023-07-08 12:05:19 +02:00
chrchr-github 218650dc85
Fix #11820 FP duplicateExpression with double negation (#5227) 2023-07-07 23:30:59 +02:00
chrchr-github d6d3c7b3fc
Fix #11139, #11817 FP unreadVariable (#5221) 2023-07-07 20:18:15 +02:00
chrchr-github e73183a182
Fix FP uselessOverride with shadowed member functions (#5225)
We should probably use `getDuplInheritedMemberFunctionsRecursive()` as
part of the `duplInheritedMember` check.
2023-07-07 20:17:58 +02:00
chrchr-github cc38ef4168
Fix #11818 FP constParameterReference / #11819 FP stlcstrConstructor / #11814 FP unknownMacro (#5224) 2023-07-07 15:54:07 +02:00
chrchr-github c738627d15
Fix uselessOverride FPs (#5223) 2023-07-07 13:18:00 +02:00
chrchr-github fa03f49d2b
Fix #11810 nullptr deref in compilePrecedence2() (II) (#5222) 2023-07-07 10:42:11 +02:00
chrchr-github dde45455bf
uselessOverride: Detect code duplication in overriding function (#5219) 2023-07-05 22:58:01 +02:00
chrchr-github ee5cf0f141
Fix #11810 nullptr deref in compilePrecedence2() (#5218) 2023-07-05 22:34:25 +02:00
chrchr-github db49687ae5
Fix getOverriddenFunction(), add test (#5213) 2023-07-01 17:23:26 +02:00
chrchr-github b99931c59c
Fix #11808 FP uselessOverride - grandchildren calling grandfather (#5212) 2023-07-01 14:11:28 +02:00
Daniel Marjamäki 96955ccfe9
Tokenizer: detect unknown macro 'if (x) MACRO }' (#5209) 2023-07-01 13:17:41 +02:00
Paul Fultz II 59a8944e30
Fix 11656: FP: containerOutOfBounds std::array (#5210) 2023-07-01 09:43:57 +02:00
chrchr-github 6d9fa6f10a
Fix #11803 FP uselessOverride - overloaded virtual member function (#5211) 2023-06-30 15:21:08 +02:00
chrchr-github e9feeef81d
Fix FPs: uselessOverride (#5208) 2023-06-29 20:46:12 +02:00
chrchr-github a40e5817bf
Fix #11757 Detect useless overriding functions (#5155) 2023-06-29 07:43:35 +02:00
chrchr-github 818ebb8d7e
Fix autovarInvalidDeallocation regression (#5203) 2023-06-29 07:42:53 +02:00
Daniel Marjamäki 55af68aaf7
Update type for Settings::checksMaxTime. (#5205)
It's a time offset not a size. It should not have value SIZE_MAX that
makes it ineffective (overflow in calculation of stop time).
2023-06-28 19:52:33 +02:00
chrchr-github 4f71bbe986
Detect lambda with template argument (#5202) 2023-06-27 16:19:12 +02:00
chrchr-github 0a72cd3b72
Fix #11795 debug: simplifyUsing: unmatched body end (#5198) 2023-06-27 15:45:25 +02:00
chrchr-github e063656173
checkLibraryCheckType: handle global scope operator / Fix FN unreadVariable (#5199) 2023-06-27 14:28:14 +02:00
Paul Fultz II 63b7e6a283
Fix 11088: False positive: Array index out of bounds (function pointer parameter is array) (#5200) 2023-06-27 10:44:11 +02:00
chrchr-github a0c4e20e2d
Add tests for #10587, #11539 (#5197) 2023-06-26 13:37:33 +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 7507d400de
Fix regression: wrong array size (#5194) 2023-06-26 06:51:01 +02:00
chrchr-github 9dc38f80c0
Fix #11790 FP functionConst with template function (#5187) 2023-06-25 20:38:54 +02:00
Paul Fultz II a2ee32695f
Fix 11530: FP arrayIndexOutOfBounds with array of functions (#5191) 2023-06-25 20:38:44 +02:00
Paul Fultz II 4f466a5961
Fix 11505: FP zerodivcond with modulo (#5192) 2023-06-25 20:38:32 +02:00
chrchr-github 9b892f3239
Partial fix for #11552 Handle lambda return types (#5188) 2023-06-25 12:01:59 +02:00
Paul Fultz II 60321edd0d
Fix 11784: FP arrayIndexOutOfBounds when increment is counted twice (#5186) 2023-06-24 20:08:55 +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
chrchr-github 55581fc2e9
Fix FP deallocuse (#5183) 2023-06-23 18:21:53 +02:00
chrchr-github b80460f3ae
Fix #11786 False positive: memory leak (#5182) 2023-06-22 23:03:55 +02:00
chrchr-github fe56b0c42a
LeakAutoVar: Handle C++ casts in function calls (#5181) 2023-06-22 16:01:21 +02:00
chrchr-github 4eebf2e733
Fix uninitdata regression (#5179) 2023-06-21 21:19:22 +02:00
Daniel Marjamäki 3abe8eeca5 Update copyright year 2023-06-21 19:58:11 +02:00
chrchr-github 9a95d4fe67
Fix #11785 Syntax error: typedef not first keyword in statement (#5178) 2023-06-21 18:26:28 +02:00
chrchr-github b26bfc9b4f
Use getAllocFuncInfo() (#5176) 2023-06-21 17:35:15 +02:00
Daniel Marjamäki f2510228cb
Fix #10847 (FP: unusedStructMember) (#5177) 2023-06-20 22:34:54 +02:00
chrchr-github bb962e2bc3
Enable and mitigate readability-else-after-return (#5175) 2023-06-20 18:43:21 +02:00
chrchr-github f96e3c9d84
Fix #11766 FP uninitdata with cast (#5170) 2023-06-20 18:06:57 +02:00
chrchr-github 78c7e3351f
Fix #11697 FP negativeContainerIndex after index is validated (#5172) 2023-06-20 10:55:14 +02:00
Daniel Marjamäki 38b2c5ee3f
Fix #11777 (False positive: uninitialized variable, handling 'false ||' in valueflow) (#5169) 2023-06-17 21:08:22 +02:00
chrchr-github 082331c210
Fix #11770 cppcheckError for unknown macro after else (#5163) 2023-06-17 18:39:23 +02:00
chrchr-github 8f6b0b41e7
Simplify qt.cfg, wxwidgets.cfg (#5166) 2023-06-17 17:04:14 +02:00
chrchr-github 53cab34484
Fix #11769 cppcheckError for function with lambda as default parameter (#5159) 2023-06-17 17:03:19 +02:00
orbitcowboy fd3befe60a
Added a regression test for FP #10681 uninitvar. (#5168)
Test case is from: https://trac.cppcheck.net/ticket/10681#comment:10
2023-06-17 15:45:28 +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 7075b6e61d
Fix #11763 internalAstError caused by parameter pack simplification (#5150) 2023-06-17 11:31:02 +02:00
Daniel Marjamäki 9a290c959f
Fix #11776 (False positive: uninitialized variable, struct array member initialized in function) (#5165) 2023-06-17 10:20:20 +02:00
chrchr-github 58dd92dd1b
Merge pull request #5152 from chrchr-github/chr_Fix11189
Partial fix for #11189 checkLibraryNoReturn with std::function parameter
2023-06-16 23:59:17 +02:00
chrchr-github 8761e6b8fc
Merge pull request #5148 from chrchr-github/chr_Fix11764
Fix #11764 checkLibraryFunction/NoReturn when inheriting from container
2023-06-16 23:33:08 +02:00
chrchr-github 62dfa8877c
Merge pull request #5147 from chrchr-github/chr_astregr
Fix AST regression
2023-06-16 22:47:47 +02:00
chrchr-github 3f0f9e4476
Merge pull request #5158 from chrchr-github/chr_Fix11770
Partial fix for #11770 cppcheckError with unknown macro
2023-06-16 22:40:56 +02:00
chrchr-github 75e0bdfdd9
Merge pull request #5164 from chrchr-github/chr_Fix11768
Fix #11768 FP autovarInvalidDeallocation
2023-06-16 22:40:27 +02:00