Commit Graph

14662 Commits

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