Commit Graph

14600 Commits

Author SHA1 Message Date
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