chrchr-github
99e38cf8f8
Partial fix for #10968 FN detect always false/true comparison of function with constant ( #5480 )
2023-09-25 22:18:07 +02:00
Oliver Stöneberg
3979ade9ea
got rid of test-only `Library` functions / avoid some more direct modifications of library data structures in test ( #5468 )
2023-09-25 13:37:24 +02:00
chrchr-github
bba96c5c8f
Fix valueFlowConditionExpressions bailout for C++ casts (refs #10045 ) ( #5472 )
2023-09-22 18:19:36 +02:00
chrchr-github
b745d9ad6e
Fix #12010 Improve unknownMacro message: int ( #5473 )
2023-09-22 10:16:21 +02:00
chrchr-github
dc59543348
Fix #12006 Improve unknownMacro message ( #5470 )
2023-09-21 00:28:49 +02:00
chrchr-github
57bbb17f3b
Fix #11986 debug: Executable scope 'x' with unknown function. ( #5463 )
2023-09-20 17:18:00 +02:00
chrchr-github
dc19916966
Fix valueFlowConditionExpressions bailout for library function (refs #10045 ) ( #5461 )
2023-09-20 15:49:13 +02:00
Oliver Stöneberg
f49fedb2ad
fixed #11483 (FN unusedFunction for method with inline implementation) ( #5457 )
...
Co-authored-by: chrchr-github <78114321+chrchr-github@users.noreply.github.com>
2023-09-20 14:45:44 +02:00
Oliver Stöneberg
a43b55a0ca
Improved addon execution errorhandling ( #5451 )
2023-09-20 10:40:57 +02:00
Paul Fultz II
58a7519cbb
Fix 11992: FN (regression): uninitvar ( #5465 )
2023-09-20 06:43:58 +02:00
chrchr-github
c6b3c56174
Improve findEnumerator() (refs #10045 ) ( #5459 )
2023-09-19 11:45:59 +02:00
Tomasz Edward Posluszny
b6f60ad952
Support importing projects with project-name ( #5456 )
2023-09-18 13:54:20 +02:00
chrchr-github
10c1ac977c
Fix findEnumerator() with nested enum (refs #10045 ) ( #5454 )
2023-09-18 12:09:59 +02:00
chrchr-github
640b561633
Fix #11995 FP passedByValue when variable is moved from ( #5455 )
2023-09-17 22:32:35 +02:00
chrchr-github
0c51977f86
Fix valueFlowBailoutIncompleteVar for cast and template args (refs #10045 ) ( #5452 )
2023-09-16 13:03:14 +02:00
Paul Fultz II
df4457e895
Use intrinsics for source location if available ( #5449 )
...
Sometimes the compiler supports the intrinsic even if the C++ runtime
doesnt yet.
2023-09-15 17:18:08 +02:00
chrchr-github
50ba5061c7
Fix #11438 MathLib error on user defined literals ( #5448 )
...
Based on #4701 , #5418
A helper function for the `isdigit()` test should be introduced on the
simplecpp side.
Co-authored-by: gerboengels <github@gerbo.org>
2023-09-15 10:00:00 +02:00
chrchr-github
5a21851bb7
Fix #11981 internalAstError with using declaration ( #5446 )
2023-09-14 12:14:08 +02:00
chrchr-github
775af5ec70
Add test for simplecpp#314 ( #5438 )
2023-09-14 09:41:39 +02:00
Paul Fultz II
e6632d93e3
Fix 11983: False positive: uninitialized variable ( #5443 )
2023-09-13 23:27:08 +02:00
Mark Hermeling
6e6b3747fd
Fix copy-paste-error ( #5444 )
...
This is a warning we found during static analyis with CodeSecure
CodeSonar.
It flagged a suspicious copy-paste error, where it finds code that seems
to have been copied from another location, with some, but not all,
variables substituted.
Unclear to me if this truly is a problem, or intentional, but I wanted
to provide the feedback as I am not sure how to test this.
Lines 5614 to 5619 in lib/symboldatabase.cpp are a copy from 5597-5602
with vartok replaced by valuetok, except for line 5616
2023-09-13 22:35:14 +02:00
Paul Fultz II
a1078f446a
Fix 11980: False positive returnDanglingLifetime returning pointer to stack array as std::string (by way of struct return value constructor) ( #5445 )
2023-09-13 21:26:37 +02:00
chrchr-github
844ed2bf22
Fix #11421 FP shiftTooManyBits with 64bit enum ( #5406 )
2023-09-13 17:59:47 +02:00
Daniel Marjamäki
7d1423c5fb
Fix #11975 (SymbolDatabase: findFunction does not find the correct function) ( #5440 )
2023-09-13 13:37:57 +02:00
chrchr-github
523c41a60b
Fix #11978 debug: Executable scope 'x' with unknown function. ( #5437 )
2023-09-13 11:39:09 +02:00
chrchr-github
18ee859737
Fix #11976 FP incorrectStringBooleanError in assert ( #5415 )
2023-09-12 10:05:51 +02:00
Oliver Stöneberg
02b836baad
do not pass POD types by reference (based on clazy `function-args-by-value` check) ( #5388 )
2023-09-11 20:40:39 +02:00
Oliver Stöneberg
e7dd490fed
adjusted tests to reduce the amount of `friend` declarations necessary ( #5435 )
...
We were calling several interface functions through their inherited
classes instead of using the base classes requiring us to add `friend`
declarations to make the implementations accessible. This adjusts
several of those cases.
2023-09-11 20:26:22 +02:00
Oliver Stöneberg
b31860b72d
fixed #11925 (build slowest files first) ( #5419 )
...
This will mainly help if you only build the `cppcheck` targets and the
more threads you utilize for compilation.
2023-09-11 20:22:07 +02:00
chrchr-github
1b5b74d1f3
Fix FP knownArgument (f'up to #11927 ) ( #5434 )
2023-09-11 20:02:00 +02:00
chrchr-github
c6721688e2
Fix #11929 FP knownPointerToBool with dynamic_cast ( #5416 )
2023-09-11 18:04:36 +02:00
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