Oliver Stöneberg
dac6671195
matchcompiler.h: fixed some clang-tidy warnings ( #5374 )
...
These do not show up in the CI since we only scan the non-matchcompiled
code.
2023-08-29 21:50:21 +02:00
Daniel Marjamäki
276f017fbe
Partial fix for #11897 (Safety: show what checks are enabled/disabled) ( #5372 )
...
Example output on stdout:
```
$ ./cppcheck m1.cpp
Checking m1.cpp ...
Active checkers: 59/177
```
2023-08-29 12:00:52 +02:00
chrchr-github
4d18f3e68b
Fix use-after-free crash when using --clang ( #5367 )
...
Still ran into an assert failure in `Tokenizer::hasIfdef()`, since some
checks assume that the tokenizer is always present. Seems like
clangimport is yet another rogue under-tested feature...
2023-08-28 09:28:47 +02:00
chrchr-github
f6340c02da
Partial fix for #11894 FP knownArgument with function pointer ( #5366 )
2023-08-26 00:37:10 +02:00
Daniel Marjamäki
6017c254dd
Cppcheck: Remove dumpfile and filelist file using RAII class to avoid that these files are forgotten in early returns or exceptions. ( #5369 )
2023-08-24 22:47:20 +02:00
chrchr-github
394996581e
Fix FP incorrectCharBooleanError with known condition ( #5365 )
2023-08-24 10:36:01 +02:00
chrchr-github
4654b6561b
Fix #11890 FP uninitvar for address taken in init list ( #5360 )
2023-08-24 10:35:33 +02:00
chrchr-github
5a7c7b9b5a
Fix FP incorrectStringBooleanError with unknown macro ( #5364 )
2023-08-23 18:06:41 +02:00
chrchr-github
8cd61941dc
Unified checks for unevaluated context ( #5362 )
2023-08-23 12:07:47 +02:00
Oliver Stöneberg
499f566e9d
got rid of duplicated file/directory existence implementations / improved errorhandling and testing of `FileLister` ( #5350 )
2023-08-23 11:22:41 +02:00
Oliver Stöneberg
0901e496ed
refs #3450 (CLI --report-progress is currently useless) - added `--report-progress=<val>` to specify interval ( #5353 )
2023-08-23 11:20:20 +02:00
Daniel Marjamäki
e35d5d3ceb
Fix #11882 (add --premium=misra-c-2023 option) ( #5363 )
2023-08-23 10:28:02 +02:00
Paul Fultz II
2adaafd20e
Fix 11887: FP knownPointerToBool with const_cast ( #5357 )
2023-08-23 01:07:49 +02:00
chrchr-github
6ffe08c9b3
Fix #11886 performance regression (hang) in 2.12dev ( #5355 )
...
Or maybe we should just limit the recursion depth.
2023-08-22 21:01:52 +02:00
chrchr-github
af46c68a94
Fix FP incorrectStringBooleanError with macro ( #5358 )
2023-08-22 19:33:24 +02:00
chrchr-github
05a2d88ec8
Fix #11888 FP knownPointerToBool with incorrect overload match / FP unreadVariable ( #5356 )
2023-08-22 16:53:38 +02:00
chrchr-github
3281fc91db
Fix #11879 FN unreadVariable (regression) ( #5345 )
2023-08-21 10:44:17 +02:00
chrchr-github
725c431ecc
Fix #11881 FP returnStdMoveLocal / Fix FP incorrectStringBooleanError / Support std::string::starts/ends_with() ( #5347 )
2023-08-21 10:43:54 +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
a5cfa85e0d
Fix 11884: Hang in valueFlowGetStrLength ( #5352 )
2023-08-20 22:01:04 +02:00
chrchr-github
63811b2993
Fix #11872 FN unusedVariable with multidimensional array ( #5334 )
2023-08-20 11:08:17 +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
a92b10ca3b
fixes #11104 (avoid C++-only parsing when processing C code in parsedecl()) / also avoid remaining `Library::detect*()` calls ( #5346 )
2023-08-18 22:48:24 +02:00
chrchr-github
41bdd87d30
Fix #11875 : hang in hasBorrowingVariables() ( #5337 )
2023-08-18 21:02:08 +02:00
Oliver Stöneberg
74c4daaadf
optimized `Token::Match()` a bit by always inlining `Token::multiCompare()` ( #5332 )
...
Scanning `mame_regtest` with `DISABLE_VALUEFLOW=1` and `--enable=all
--inconclusive`:
Clang 15 `1,170,770,173` -> `1,167,227,434`
GGC 12 `1,370,070,422` -> `1,366,775,852`
2023-08-18 20:41:50 +02:00
Oliver Stöneberg
e669b102f8
renamed `Check::reportError(const ErrorMessage&)` to `writeToErrorList()` to reflect its actual behavior ( #5322 )
2023-08-18 13:45:25 +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
Oliver Stöneberg
33dee83c21
moved suppression-specific code out of `ErrorLogger` ( #5329 )
2023-08-18 11:55:23 +02:00
chrchr-github
7f22ef4e14
Set ValueType for auto with ternary ( #5304 )
2023-08-18 10:33:26 +02:00
chrchr-github
827e87afe7
Fix #11579 FN knownConditionTrueFalse with non-bool as bool parameter / #9450 string literal to bool conversion in function call ( #5338 )
2023-08-18 10:32:52 +02:00
Oliver Stöneberg
5dbcea3f1d
enabled and mitigated `readability-container-size-empty` clang-tidy warnings ( #5340 )
2023-08-17 17:01:08 +02:00
Oliver Stöneberg
3cf9100198
fixed #6316 (Use std::to_string() in place of MathLib::toString() ...) - deleted default implementation of `Mathlib::toString()` ( #5341 )
...
It was also used inconsistently and seemed to imply there is some
special handling which wasn't the case. It was just an alias for
`std::to_string()` for non-`double` types. So there was no need for it.
---------
Co-authored-by: Robert Reif <reif@earthlink.net>
2023-08-17 16:46:32 +02:00
Oliver Stöneberg
d8b44dff56
fixed/suppressed several compiler warnings ( #5327 )
2023-08-16 19:35:53 +02:00
Oliver Stöneberg
84a9b3a5f2
enabled and mitigated `modernize-use-equals-default` clang-tidy warnings / removed unnecessary default destructors ( #5335 )
2023-08-16 17:13:36 +02:00
Oliver Stöneberg
6a263ba026
optimized `Library::detectContainerInternal()` a bit ( #5333 )
...
Scanning `cli/filelister.cpp` with `DISABLE_VALUEFLOW=1` and
`--enable=all -Ilib -D__GNUC__`
Clang 15 `111,300,996` -> `106,883,955`
GCC 13 `110,555,879` -> `105,983,608`
2023-08-16 11:10:38 +02:00
Paul Fultz II
8aa9d710d1
Fix 11844: FP negativeIndex for known loop ( #5282 )
2023-08-14 15:17:05 +02:00
chrchr-github
c257c70347
Fix #11546 FP danglingTemporaryLifetime with unknown member ( #5256 )
2023-08-14 14:32:35 +02:00
Paul Fultz II
52081ef08f
Add special function to match lifetimes ( #5320 )
...
This also removes the termination checking in `valueFlowUninit` as this
causes a lot of FNs.
2023-08-14 10:27:00 +02:00
Paul Fultz II
48c91abba6
Fix issue 11867: Assert failure in valueFlowContainerSize() ( #5317 )
2023-08-13 22:31:38 +02:00
chrchr-github
466da1e77a
Fix FP misusedScopedObject ( #5321 )
2023-08-13 22:24:17 +02:00
Oliver Stöneberg
5371455606
optimized pipe writing/reading and `ErrorMessage` serialization a bit ( #5279 )
2023-08-13 11:52:02 +02:00
chrchr-github
d4d77edeae
Fix FP uninitStructMember / cleanup from #5311 ( #5315 )
2023-08-12 23:46:31 +02:00
Paul Fultz II
0901ba9a7e
Fix 11865: Assert failure in setSymbolic() ( #5318 )
2023-08-12 19:58:09 +02:00
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
4e8c240129
updated CI to Clang 17 ( #4797 )
2023-08-09 12:45:15 +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
chrchr-github
c3d7c91e88
Additional call to setValueTypeInTokenList() ( #5300 )
2023-08-08 22:54:27 +02:00
chrchr-github
47c9a941a0
Restore references ( #5303 )
2023-08-08 17:50:08 +02:00
Samuel Poláček
09962a6bcf
Edit verbose warning message for uninitVarError ( #5301 )
...
I think that context needs to be provided as to why it is an issue that
a variable is not initialized.
2023-08-08 15:11:39 +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
dcdf67a694
some `-Wdouble-promotion` Clang compiler warnings ( #4820 )
2023-08-07 20:44:25 +02:00
Oliver Stöneberg
e38a031ae6
ValueFlow: pass `SymbolDatabase` by reference into `ValueFlow::setValues()` ( #5295 )
2023-08-07 18:41:50 +02:00
chrchr-github
73251544a4
Fix #11842 FN constParameterPointer with library function ( #5257 )
2023-08-05 18:48:43 +02:00
Oliver Stöneberg
77c479a6c4
pass `TokenList` as reference into `ValueFlow::setValues()` ( #4868 )
...
This avoid lots of unchecked pointer dereferences.
There was a single case which checked it and that looked like a
leftover. The only way this might have been a `nullptr` pointer was
through several default constructors which were not used at all so I
removed them.
2023-08-04 18:17:27 +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
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
Samuel Poláček
e7a2585e0a
noExplicitConstructor - Verbose error message edit ( #5260 )
...
The goal is to use keywords like "converting constructor" and "implicit
conversion" that will help users further study what this warning is
about. I think that the old message provided no context to the
uninitiated.
2023-08-01 11:21:23 +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
Oliver Stöneberg
265759dfa4
tokenlist.cpp: fixed GCC `-Wunused-variable` warning ( #5266 )
...
Added https://trac.cppcheck.net/ticket/11847 about the false negative.
2023-07-27 07:27:04 +02:00
Samuel Poláček
c5deb0a631
Fix a typo in error message ( #5264 )
2023-07-26 07:54:59 +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
Daniel Marjamäki
3508464c6d
dump: fix dump output for typedef info, file is <stdout> ( #5236 )
2023-07-12 11:21:59 +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
Daniel Marjamäki
2ff9e60650
Fix #11815 (dump: add token attribute isTemplateArg) ( #5220 )
2023-07-05 23:12:22 +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
Daniel Marjamäki
3f832df6cb
lib/version.h: add fix version option ( #5216 )
2023-07-02 18:13:28 +02:00
Daniel Marjamäki
72245b1b15
xml: use version from configuration if provided ( #5215 )
2023-07-02 18:13:11 +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
1b4ec0def4
Fix #11787 (GUI: configure check level) ( #5206 )
2023-06-28 19:55:57 +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
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
Daniel Marjamäki
87c2b8df04
Tokenizer: dumpfile will say if type token is _Atomic ( #5189 )
2023-06-25 11:22:30 +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
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
Daniel Marjamäki
557241ad71
2.11.99: Set versions
2023-06-22 13:50:51 +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
e8de2aeeea
Fix #9398 (Incorrect "Overall Time" in timing info) ( #5173 )
2023-06-20 10:31:11 +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
53cab34484
Fix #11769 cppcheckError for function with lambda as default parameter ( #5159 )
2023-06-17 17:03:19 +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
e31cd05ae9
Merge pull request #5129 from chrchr-github/chr_action_yield2
...
Detect container action and yield functions (2)
2023-06-16 22:47:19 +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
chrchr-github
1ffff8dc06
Fix #11772 top() on empty stack in TypedefSimplifier::replace() ( #5161 )
2023-06-16 19:35:01 +02:00
Daniel Marjamäki
aca6c47024
Fix #11774 (False positive: passing struct pointer to function that initialize it) ( #5162 )
2023-06-16 18:43:32 +02:00
chrchr
b41f9af2c5
Fix #11768 FP autovarInvalidDeallocation
2023-06-16 17:21:37 +02:00
Daniel Marjamäki
b462d070bf
Minor tweaking of constness
2023-06-15 19:41:47 +02:00
chrchr
9579b4509d
Partial fix for #11770 cppcheckError with unknown macro
2023-06-15 18:36:21 +02:00
Daniel Marjamäki
f934d6e5d0
Fix #11767 (False positive: uninitialized member after assignment) ( #5157 )
2023-06-15 14:42:58 +02:00
Daniel Marjamäki
d75331d00d
Fix #11435 (FP ctuOneDefinitionRuleViolation for template specialization) ( #5156 )
2023-06-15 11:43:07 +02:00
Long Radix
c033c62190
Typos and stilistic updates ( #5141 )
2023-06-14 12:30:45 +02:00
Daniel Marjamäki
9339802be3
Fix #11740 (FP syntaxError from switch in C code) ( #5153 )
2023-06-14 10:41:37 +02:00
chrchr-github
457e0ce0c8
Partial fix for #11189 checkLibraryNoReturn with std::function parameter
2023-06-13 21:48:16 +02:00
chrchr
0afc5aba78
Fix #11764 checkLibraryFunction/NoReturn when inheriting from container
2023-06-13 15:04:25 +02:00
chrchr
fad1f6b559
Fix AST regression
2023-06-13 14:32:31 +02:00
chrchr-github
6f56a9563e
Add missing rebinding trait to TaggedAllocator (complete #5015 ) ( #5146 )
2023-06-13 11:22:43 +02:00
Anton Lindqvist
09cd3a8269
Fix FP deallocuse regression ( #5144 )
...
Introduced in commit 69116c838
("Fix #11758 Regression: memleak / Fix #11746 FN:
deallocuse (#5139 )").
2023-06-11 14:11:41 +02:00
Daniel Marjamäki
f6a65afdee
Fix FP uninitStructMember when other variable is only nonzero if struct member is initialized ( #5143 )
2023-06-10 21:35:17 +02:00
chrchr-github
24b0d08753
Fix FP autoVariables ( #5107 )
...
* Fix #11732 FP autoVariables when reassigning argv
* Fix #11732 FN autoVariables with array and std::string
* Add test
* Format
* Format
* Simplify check, fix inconclusive
* Fix merge, add test
* Fix FPs
* Format
* Format
* Undo move
* Format
2023-06-10 16:28:29 +02:00
Daniel Marjamäki
1c28457d2c
ValueFlow: Fix uninitvar false positive after initialization '*((int*)&x) = ..' ( #5142 )
2023-06-10 15:22:17 +02:00
Daniel Marjamäki
3c8caac772
Fix #11688 (FP uninitvar in for loop iteration expression) ( #5140 )
2023-06-10 09:58:08 +02:00
chrchr-github
7e0f64688f
Fix #11275 internalAstError on C++20 templated lambda / Fix #11400 internalAstError on nested lambda ( #5134 )
...
* Fix #11275 internalAstError on C++20 templated lambda
* Fix #11400 internalAstError on nested lambda passed as argument
2023-06-10 07:42:10 +02:00
chrchr-github
d4705ca8ab
Fix #10809 cppcheckError Cyclic reverse analysis ( #5137 )
...
* Fix #10809 cppcheckError Cyclic reverse analysis
* Handle fixed AST in ValueFlow, fix FN
* Remove
2023-06-10 07:41:52 +02:00
chrchr-github
69116c8386
Fix #11758 Regression: memleak / Fix #11746 FN: deallocuse ( #5139 )
...
* Fix #11758 Regression: memleak
* Format
* Fix #11746 FN: deallocuse
* Complete the trifecta
2023-06-10 00:24:36 +02:00
Daniel Marjamäki
22e67d3534
Fixed #10442 (AST: wrong ast of ({}) in struct initialization) ( #5135 )
2023-06-09 22:31:14 +02:00
chrchr
f5c61bebef
Simplify
2023-06-09 18:21:26 +02:00
chrchr-github
2da453fdc9
Update library.cpp
2023-06-09 16:53:23 +02:00
chrchr
006a323caa
Format
2023-06-09 16:53:23 +02:00
chrchr
f17f03befa
C++11 sucks
2023-06-09 16:53:23 +02:00
chrchr
68a59830a4
Fix returnValueType()
2023-06-09 16:53:23 +02:00
chrchr-github
022fcb3be1
Handle const, noreturn, return type
2023-06-09 16:53:23 +02:00
chrchr-github
220ad27fa8
Add Yield::ITERATOR
2023-06-09 16:53:23 +02:00
chrchr-github
c609ef8814
Add Yield::AT_INDEX
2023-06-09 16:53:23 +02:00
chrchr-github
605ff520b9
Add Yield::BUFFER
2023-06-09 16:53:23 +02:00
chrchr-github
e798e72252
Handle combined action/yield
2023-06-09 16:53:22 +02:00
chrchr-github
bd6c5318ad
Detect container action and yield functions ( #5117 )
...
* Detect container action and yield functions
* Fix test
* Adapt getUseRetValType() to handle container yield functions
Add TODO
* Handle combined action/yield
* Add Yield::BUFFER
* Remove redundant functions
* Revert "Remove redundant functions"
This reverts commit 4f124a57de5c761ac757ebed83d9f047ef4a1328.
* Add Yield::AT_INDEX
* Add Yield::ITERATOR
* Simplify
2023-06-09 16:03:47 +02:00
Daniel Marjamäki
b086873599
Cppcheck: change severity from information to error for internalError ( #5133 )
2023-06-08 23:31:36 +02:00
Carl Morgan
6741f774b1
Support integer Z suffix and user defined literals with _ suffix ( #10807 , #11438 ) ( #5130 )
...
Co-authored-by: Carl Morgan <no-reply@crown.com>
2023-06-08 20:03:41 +02:00
chrchr-github
be2824b003
Fix FN deallocuse with array access ( #5121 )
...
* Fix FN deallocuse with array access
* Fix another FN
* Undo
2023-06-08 07:55:49 +02:00
chrchr-github
901b775471
Fix scope for function returning rvalue reference, insert std:: in return statement ( #5119 )
...
* Fix scope for function returning rvalue reference
* Insert std:: in return statement
* Fix failing test
2023-06-08 07:47:21 +02:00
chrchr-github
4dbbae62a7
Fix #11753 FN: invalidLifetime ( #5128 )
...
* Fix #11753 FN: invalidLifetime
* Format
* Format
* Only forward for local variables
* Format
* Format
2023-06-08 07:45:59 +02:00
chrchr-github
3ff8ce316c
Fix AST for parameter pack ( #10199 , #10492 , #11103 ) ( #5125 )
...
* Fix AST for parameter pack (#10199 , #10492 , #11103 )
* Skip ... after )
2023-06-07 20:46:14 +02:00
chrchr-github
ec4267a2bd
Don't suggest const for smartptr::get() ( #5126 )
...
* Don't suggest const for smartptr::get()
* Fix test
* Fix merge
* get() doesn't change a smartpointer
* Parentheses
2023-06-07 20:45:48 +02:00
chrchr-github
12fe652321
Fix #11063 FP unreadVariable with extra parentheses and scope operator ( #5122 )
2023-06-07 20:45:27 +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
ac86eda6b3
Revert "Revert "Skip forwarding values for unique expressions ( #5103 )"" ( #5124 )
2023-06-07 11:11:48 +02:00
Daniel Marjamäki
7d4472616b
Revert "Skip forwarding values for unique expressions ( #5103 )"
...
This reverts commit 26ed052e8d
.
2023-06-06 17:31:24 +02:00
Paul Fultz II
26ed052e8d
Skip forwarding values for unique expressions ( #5103 )
2023-06-05 20:49:19 +02:00
Daniel Marjamäki
5976faaaf5
Fixed #11745 (Fix AST for 'new type..[..]{..}') ( #5118 )
2023-06-05 20:43:17 +02:00
chrchr-github
18b60d2f2b
Fix #11670 FP constStatement (inconclusive) triggered by namespace ( #5114 )
2023-06-03 15:13:15 +02:00
chrchr-github
1b98be458d
Fix #11739 Assert failure in valueflow.cpp / setSymbolic() ( #5104 )
2023-06-03 11:08:06 +02:00
chrchr-github
82e9c076da
Fix #11744 FN functionConst/functionStatic with recursion ( #5105 )
...
* Fix FN functionStatic
* Fix FN functionConst, add test
* Fix build
2023-06-02 23:33:42 +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
7c56514bd5
Fix #9104 reopened Improve check: missing virtual destructor ( #5110 )
...
* Fix #9104 reopened Improve check: missing virtual destructor
* Add support for missing container members
* Add more stuff
* Improve qt.cfg
* Improve wxwidgets.cfg, qt.cfg
2023-06-02 15:24:18 +02:00
chrchr-github
52c0f10fa1
Fix FP mismatchAllocDealloc, uninitdata for new with initializer ( #5106 )
2023-06-02 13:01:55 +02:00
chrchr-github
c636641e67
Remove hardcoded whitelist ( #5063 )
2023-06-01 14:45:41 +02:00
chrchr-github
a32fb63443
Fix hang on huge array (followup to #11649 ) ( #5094 )
...
* Fix hang on huge array
* Fix another hang
2023-05-31 20:56:12 +02:00
chrchr-github
238cf75f6f
Fix #11732 FN autoVariables with array and std::string ( #5096 )
...
* Fix #11732 FP autoVariables when reassigning argv
* Fix #11732 FN autoVariables with array and std::string
* Add test
* Format
* Format
2023-05-31 20:55:55 +02:00
chrchr-github
0b44429a7c
Fix spurious lambda detection ( #5101 )
2023-05-31 20:55:39 +02:00
chrchr-github
a91222fad8
Partial fix for #11637 FN functionConst ( #5102 )
...
* Partial fix for #11637 FN functionConst
* Redundant check
2023-05-31 20:55:12 +02:00
chrchr-github
0ecf101fe3
Fix #11547 FN stlcstrConstructor, stlcstrAssignment with std::stringview ( #5097 )
...
* Fix #11547 FN stlcstrParam with std::string_view
* Add suppression
* Use emplace()
* Fix #11547 FN stlcstrConstructor, stlcstrAssignment with std::string_view
2023-05-31 16:51:37 +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
Daniel Marjamäki
9d6449cc44
dump file: fix xml format error in <macro> ( #5095 )
2023-05-30 14:51:11 +02:00
chrchr-github
ec2f00d7c2
Fix #1175 uninitialized data: casted to 'int *' and dereferenced ( #5008 )
2023-05-29 15:29:53 +02:00
chrchr-github
cf4334904c
Fix #11626 FN functionConst with non-dereferenceable pointer access ( #5074 )
...
* Partial fix for #11626 FN functionConst with non-dereferenceable pointer access
* Fix #11626 FN functionConst with non-dereferenceable pointer access
* Fix test
2023-05-28 19:42:47 +02:00
chrchr-github
4c1e06a84b
Fix #8174 Regression: false negative autovarInvalidDeallocation since 1.79 ( #5045 )
2023-05-28 14:34:07 +02:00
chrchr-github
774123d28d
Remove hardcoded lists of functions/templates/types ( #5069 )
...
* Remove hardcoded list of functions
* Remove hardcoded list of templates
* Remove hardcoded list of types
* Format
* Fix test
* Unused variable
* Add tests
* auto -> int
2023-05-28 14:33:41 +02:00
chrchr-github
ac41b45a5f
Fix #11729 danglingLifetime of static variable ( #5080 )
2023-05-28 14:33:12 +02:00
chrchr-github
163fb79de1
Fix #11732 FP autoVariables when reassigning argv ( #5084 )
2023-05-28 13:51:41 +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
17789778c9
Fix #11547 FN stlcstrParam with std::string_view ( #5093 )
...
* Fix #11547 FN stlcstrParam with std::string_view
* Add suppression
* Use emplace()
2023-05-28 01:11:11 +02:00
Daniel Marjamäki
6b9fac41f4
Fixed #11734 (stylistic warnings from addons are not filtered when style is not enabled) ( #5091 )
2023-05-27 10:24:00 +02:00
Anton Lindqvist
96c6276ce7
Suppress unused struct members from types expanded from macros ( #5087 )
2023-05-26 17:48:49 +02:00
chrchr-github
10b55cc0cf
Fix #11654 FN functionConst if only non-const member usage is call to itself ( #5092 )
...
* Fix #11654 FN functionConst if only non-const member usage is call to itself
* Format
* Add const
2023-05-26 17:24:13 +02:00
Anton Lindqvist
3d6c453058
Fix uninitvar false positive in designed initializers ( #5079 )
...
Stop interpreting struct fields in designed initializers as usage of local
variables which can happen if they share the same name.
```
$ cat test.c
struct a { int b; };
int main() {
char *b;
extern int foo(struct a *);
return foo(&(struct a){.b = 0});
}
$ cppcheck --quiet test.c
test.c:5:27: error: Uninitialized variable: b [legacyUninitvar]
return foo(&(struct a){.b = 0});
```
2023-05-26 11:59:10 +02:00
chrchr-github
fb850a844b
Use path to executable when trying to load library ( #5082 )
...
* Use path to executable when trying to load library
* Fix function call, add support for more OS, add test
* Format
* Handle MacOS
* Amend
* Argument as fallback
* Use Path::getCurrentExecutablePath()
* Move to cmdlineparser.cpp
* Debug output
* Use argv[0] in Cygwin
* Revert "Debug output"
This reverts commit 5a68d71f1d27549c7b4a46363f3cd5cd912018e7.
* Use native python in Cygwin
2023-05-26 06:55:36 +02:00
chrchr-github
bc03bed075
#11733 FP unusedFunction with templates and --cppcheck-build-dir ( #5085 )
...
* #11733 FP unusedFunction with templates and --cppcheck-build-dir
* Add test
2023-05-26 06:13:48 +02:00
chrchr-github
beea1a2345
Fix #11689 FP constStatement with nested typedefs ( #5090 )
...
* Fix #11689 FP constStatement with nested typedefs
* Add test
2023-05-26 06:12:40 +02:00
Daniel Marjamäki
107eea236f
Improved handling of alignas. alignas will not be removed from now on so we don't loose this information. ( #5081 )
2023-05-24 10:33:53 +02:00
chrchr-github
94b6c87049
Fix #11728 FP unreadVariable with brace-init ( #5075 )
2023-05-23 20:21:02 +02:00
Rainer Wiesenfarth
d1781a8cfb
Fix #11727 Limit check to selected VS configurations does not work ( #5072 )
...
Fix #11727 Limit check to selected VS configurations does not work
2023-05-23 12:44:03 +02:00
chrchr-github
6d2662b8a2
Fix #4400 FN (error) Memory leak - assignment to reference of a pointer ( #5048 )
...
* Fix #4400 false negative: (error) Memory leak - assignment to reference of a pointer
* Comment
* Run tests as C++
* Add TODOs
* Bail out for local references
2023-05-23 06:29:20 +02:00
Stefan Hagen
9e8cb6904a
[nit] Fixed lib/tokenize.cpp:2815:2: warning: extra ‘;’ [-Wpedantic] ( #5071 )
...
Single character fix removing extra semi colon.
2023-05-23 06:27:25 +02:00
chrchr-github
33f728df14
Fix #11725 Hang in simplifyTypedef() with extra parentheses ( #5078 )
...
* Fix #11725 Hang in simplifyTypedef() with extra parentheses
* Amend test
2023-05-23 06:26:22 +02:00
chrchr-github
00733893e0
Fix #11726 "this->" confuses non void return check ( #5073 )
2023-05-22 20:23:09 +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
chrchr-github
8eabf5c211
Fix #8433 FN unused variable not detected when there is lambda ( #5060 )
...
* Fix #8433 FN unused variable not detected when there is lambda
* Format
* Fix tests
* Check lambda return
* Add test
* Undo, add test
* simpleMatch()
* Rename test
2023-05-22 07:39:57 +02:00
chrchr-github
e621f721fc
Use library to get deallocation function ( #5061 )
...
* Use library to get deallocation function
* Add suppressions
* Amend
* Remove suppression
* More getDeallocFuncInfo()
* Fix suppressions
* Fix suppression
2023-05-21 14:01:14 +02:00
chrchr-github
d30f8e18f7
Partial fix for #11626 FN functionConst with non-dereferenceable pointer access ( #5070 )
2023-05-21 14:00:24 +02:00
chrchr-github
ba57e15cb2
Fix #11717 Warn when C++ code is scanned as C (prevent FPs) ( #5064 )
...
* Fix #11717 Warn when C++ code is scanned as C (prevent FPs)
* Don't throw for operators
* Detect reference variables
* Fix tests
* Fix compilation
* Fix test
* Fix another test
* Use strAt()
2023-05-21 13:59:49 +02:00
Daniel Marjamäki
f72db74817
Fixed #11013 (FP overlappingWriteUnion with anonymous struct in union) ( #5067 )
2023-05-20 10:34:42 +02:00
chrchr-github
e6576dd949
Fix #11708 internal error: converting '1f' to integer failed ( #5066 )
...
* Fix #11708 "internal error: converting '1f' to integer failed - not an integer" with width in printf format string
* Format
2023-05-18 23:26:56 +02:00
chrchr-github
518b6a27ab
Fix #11719 Handle lambdas in global scope ( #5065 )
...
* Fix #11719 Handle lambdas in global scope
* Capture list
2023-05-17 14:37:56 +02:00
chrchr-github
1999bc68bf
Set values when assigning init list ( #5057 )
...
* Assign values to pointers with C++11 init
* Handle assigning empty init list
* Fix #10596 FN uninitdata with value initialization
* Fix test
* Set values when assigning init list
2023-05-14 17:01:07 +02:00
Daniel Marjamäki
d475591665
Tokenizer: simplification of typedefs in _Generic arguments ( #5059 )
2023-05-14 15:14:52 +02:00
Daniel Marjamäki
793d6aef01
Tokenizer: do not report unknownMacro for alignas ( #5058 )
2023-05-14 15:14:41 +02:00
chrchr-github
cf4d59a835
Partial fix for #9602 False positives with function pointers ( #5042 )
...
* Partial fix for #9602 False positives with function pointers
* Add test for #9222
2023-05-14 12:16:17 +02:00
chrchr-github
096d3a78b0
Fix #10596 FN uninitdata with value initialization ( #5056 )
...
* Assign values to pointers with C++11 init
* Handle assigning empty init list
* Fix #10596 FN uninitdata with value initialization
* Fix test
2023-05-13 22:07:09 +02:00
chrchr-github
6a8c70c1b9
Fix #10976 false negative: autoVariables [inconclusive] (regression) ( #5044 )
...
* Fix #10976 false negative: autoVariables [inconclusive] (regression)
* Use link()
* Use linkAt()
* Skip over [][]
2023-05-13 14:11:01 +02:00
chrchr-github
dc7550ed9f
Assign values to pointers with C++11 init ( #5055 )
...
* Assign values to pointers with C++11 init
* Handle assigning empty init list
2023-05-13 14:09:47 +02:00
Daniel Marjamäki
2b74a2084e
Fixed #11716 (simplifyTypedef: function with const should be handled better) ( #5054 )
2023-05-12 20:39:08 +02:00
Stefan Hagen
2abd9dcf79
nit: removed stray semicolon in checkother.cpp ( #5053 )
...
This fixed nit removes a compiler warning.
2023-05-12 11:27:21 +02:00
chrchr-github
2a0143c8e1
Fix #10358 Bad ValueFlow depending on initialization ( #5052 )
2023-05-12 07:19:44 +02:00
chrchr-github
f5b1537ed1
Fix internalASTError with decltype() ( #5047 )
2023-05-11 14:35:23 +02:00
Daniel Marjamäki
e1d5d9988d
Fixed #11715 (Add --showtime=file-total option to show checking time of each file) ( #5049 )
2023-05-11 14:04:22 +02:00