chrchr-github
cbbf500cd4
Fix valueFlowBailoutIncompleteVar for init list (refs #10045 ) ( #5433 )
2023-09-11 16:49:39 +02:00
chrchr-github
aa281501c9
Fix #11923 FN unreadVariable (regression) ( #5409 )
2023-09-11 11:36:03 +02:00
Oliver Stöneberg
639a4131c4
changed `bool_to_string()` to return `const char*` instead and use it in more cases ( #5385 )
2023-09-11 11:34:22 +02:00
Oliver Stöneberg
bbe45ff0eb
cleaned up access of the check classes ( #5387 )
2023-09-11 11:12:42 +02:00
Oliver Stöneberg
64cd09ab62
fixed #11917 (Default to `native` platform in Windows builds) ( #5428 )
2023-09-11 11:08:23 +02:00
Daniel Marjamäki
fe46bd3f96
Fixed #11974 (Add critical error id premium-invalidLicense) ( #5431 )
2023-09-11 10:46:57 +02:00
Daniel Marjamäki
87719121bd
Fixed #11908 (SymbolDatabase: array not parsed properly 'int (**rs)[32]') ( #5430 )
2023-09-10 20:58:30 +02:00
chrchr-github
f9b18bc9d8
Fix FP (regression): Resource handle 'fd' freed twice. [doubleFree] ( #5424 )
2023-09-10 20:32:55 +02:00
Daniel Marjamäki
4fa1c7d5f9
2.12.99: Set versions ( #5427 )
2023-09-10 18:43:00 +02:00
Oliver Stöneberg
91070ca794
utils.h: added `startsWith()` and started using it ( #5381 )
...
This makes the code much more readable. It also makes it less prone to
errors because we do not need to specify the length of the string to
match and the returnvalue is clear.
The code with the bad returnvalue check was never executed and I added a
test to show that.
2023-09-08 19:30:25 +02:00
Oliver Stöneberg
3cbbb77335
fixed #11926 (Treat MacOS filesystem as case insensitive) / TestPath: added more tests ( #5412 )
2023-09-08 17:33:37 +02:00
chrchr-github
4d5e84aa5f
Partial fix for #11927 FP knownArgument with unknown function type ( #5413 )
2023-09-08 16:41:07 +02:00
chrchr-github
e4f92f6979
Fix #10837 crash/hang in expandTemplate ( #5410 )
2023-09-08 14:59:42 +02:00
Daniel Marjamäki
4739ac8416
Update copyright year
2023-09-06 15:51:05 +02:00
chrchr-github
7a79366ba0
Fix #11914 Crash when checking widelands ( #5404 )
2023-09-05 11:12:04 +02:00
chrchr-github
03026c7304
Fix #11915 Assert failure in getTemplateNamePosition() ( #5403 )
2023-09-05 00:35:33 +02:00
Oliver Stöneberg
ce780177b2
fixed #11910 - removed Visual Studio x86 targets from project files and builds from CI ( #5397 )
...
Windows XP Pro x64 was released on April 25, 2005 and consumer
processors supporting x86-64 have been around almost as long. Although
there are still 32-bit Windows images available there is not much of a
point maintaining support for these. We also never did any x86 builds
for non-Windows platforms in CI so we don't even know if we work on
those. You might still be able to build 32-bit binaries via CMake.
2023-09-04 19:40:13 +02:00
Oliver Stöneberg
c068c74e86
CI-mingw.yml: use pre-installed MinGW / also use `lld` and `ccache` for faster builds ( #4400 )
...
This used to be one of the longest running jobs because of the slow
setup and linking. Now it will take only ~2 minutes if everything is
cached with half the time taken up by the tests.
2023-09-04 13:56:18 +02:00
Daniel Marjamäki
6817113665
Ticket #11897 . Write Autosar/Cert C/Cert C++/Misra C++ in the checkers report also. ( #5400 )
2023-09-03 20:42:09 +02:00
Paul Fultz II
fd12baaf89
Fix 11898: FP knownEmptyContainer ( #5394 )
2023-09-02 14:30:35 +02:00
Paul Fultz II
ffbcfae988
Fix 11889: FP knownArgument with array element ( #5395 )
2023-09-02 14:29:38 +02:00
Paul Fultz II
6c0a5a5859
Fix 11894: FPs knownArgument with sizeof and function pointer ( #5396 )
2023-09-02 14:28:54 +02:00
Daniel Marjamäki
88a9119f88
Fixed #11907 (False positive: uninitialized member (mutable member, const method call)) ( #5384 )
2023-09-01 18:10:21 +02:00
Daniel Marjamäki
c3136dbc2a
Refactor: The code to generate id string from pointer can be simplified ( #5382 )
2023-08-31 23:14:28 +02:00
Daniel Marjamäki
85332b2af6
Fixed #11904 (One more related fix for Scope::findFunction) ( #5383 )
2023-08-31 23:12:54 +02:00
Daniel Marjamäki
44c149e51b
Fix #11897 (Safety: show what checks are enabled/disabled) ( #5378 )
...
This primarily adds the corresponding report in the GUI that we have in
the command line already
2023-08-31 18:28:47 +02:00
Daniel Marjamäki
1b061564d9
Fix #11904 (Scope::findFunction: better handling when non-virtual method with same name and arguments exists both in base class and derived class) ( #5379 )
2023-08-31 14:44:44 +02:00
Oliver Stöneberg
ad1caa8100
report `internalError` when command execution returns errorcode / also some related cleanups and tests ( #5037 )
...
Encountered while investigating https://trac.cppcheck.net/ticket/11708 .
This has been like this since the introduction of `internalError` in
b6bcdf2936
(almost ten years ago to the
day). Logging internal errors which bail out(!) of the analysis simply
to `std::cout` for them possibly never to be seen (and also not affected
the exitcode) is pretty bad IMO. They should always be visible.
I also removed the filename from the message as it is already available
(and thus redundant) and its existence should be defined by the
template.
2023-08-31 13:33:29 +02:00
Oliver Stöneberg
0fadf9ed25
sped up `Tokenizer::dump()` ( #5009 )
...
Scanning the `cli` folder with `DISABLE_VALUEFLOW=1` `Tokenizer::dump()`
will consume almost 25% of the total Ir count when an addon is
specified. This is mainly caused by the usage of `std::ostream`.
Encountered while profiling #4958 .
2023-08-31 11:54:46 +02:00
Oliver Stöneberg
e7dd9cd793
enabled `readability-use-anyofallof` clang-tidy warning / added more checks to evaluate ( #5339 )
2023-08-31 09:04:51 +02:00
Daniel Marjamäki
7c992ced4c
Fixed #11901 (Performance regression: large array with strings) ( #5375 )
...
Analysis has slowed down a lot when there are many strings in an array.
2023-08-30 19:35:43 +02:00
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