Commit Graph

707 Commits

Author SHA1 Message Date
Daniel Marjamäki da29903ffc Makefile: run 'dmake --release' 2023-12-23 07:29:47 +01:00
Oliver Stöneberg aa7629d969
aligned and optimized unique error handling (#5280)
The handling in `CppCheck::reportErr()` and `Executor::hasToLog()` was
slightly different. I hope this can somehow be shared after the executor
reworking.

We were also using a very inappropriate container for the error list
which caused a lot of overhead.

`-D__GNUC__ --debug-warnings --template=daca2 --check-library -j2
../test/testsymboldatabase.cpp`

Clang 15
main process  `284,218,587` -> `175,691,241`
worker process `9,123,697,183` -> `8,951,903,360`
2023-12-17 21:59:06 +01:00
Daniel Marjamäki 2932ab7592
Revert "Fixed #12071 (suppressing critical error, no indication to user that analysis of file fails) (#5771)" (#5775)
This reverts commit 7c316fb76d.
2023-12-17 19:13:14 +01:00
Daniel Marjamäki 7c316fb76d
Fixed #12071 (suppressing critical error, no indication to user that analysis of file fails) (#5771) 2023-12-17 15:42:17 +01:00
Oliver Stöneberg 453800211c
testrunner: make sure that more redirects/outputs are actually being consumed (#5721) 2023-12-06 22:01:00 +01:00
Daniel Marjamäki 70745b527a
Fix #12210 (Cppcheck hang in SymbolDatabase::createSymbolDatabaseExprIds) (#5699) 2023-12-05 14:22:32 +01:00
chrchr-github 41e6c87cb2
Fix #12236 FP related to decltype/__typeof__ (#5717) 2023-12-04 11:19:49 +01:00
Oliver Stöneberg 3272a2bbe7
greatly improved `Settings::loadCppcheckCfg()` error handling (#5712)
This also fixes the issue that `cppcheck.cfg` is no longer being loaded
from executable path. That was introduced by #5704.
2023-12-01 16:34:14 +01:00
Oliver Stöneberg f2461781fd
added `xml.h` wrapper for TinyXML2 / cleaned up suppressions of Clang compiler warnings (#5700) 2023-11-26 14:04:35 +01:00
Oliver Stöneberg 4addad1643
moved settings-related code from `CppCheckExecutor` to `CmdLineParser` (#5672)
`CppCheckExecutor` contains some code which is not related to the
execution but actually to the creation of the settings. This is causing
inconsistencies in the error handling/logging as well as interfering
with the testability.
2023-11-19 19:45:10 +01:00
Oliver Stöneberg 8b69ccadd4
CppCheckExecutor: extracted logging instance related code into separate implementation class (#5658) 2023-11-16 10:35:43 +01:00
orbitcowboy 966a89d5f4
Removed -DTIXML_USE_STL flag (#5624)
Updated version of https://github.com/danmar/cppcheck/pull/5145
2023-11-05 15:54:22 +01:00
Oliver Stöneberg ca6d1aafdb
moved `fileSettings` out of `Settings` (#5608)
Moved the `FileSettings` out of the `Settings` and pass them around
explicitly. They can never be specified at the same time and are used
exclusively. The code hasn't been fully adjusted to reflect this as this
is only the refactoring without any functional changes.
2023-11-03 23:24:04 +01:00
Oliver Stöneberg e6d15b17ff
extracted `FileSettings` from `ImportProject` to `filesettings.h` (#5604) 2023-11-02 17:42:41 +01:00
Oliver Stöneberg 3103736c51
refs #11928 / refs #10045 / fixes #11794 - generate `limits.h`/`climits` defines from platform (#5414) 2023-10-21 17:21:12 +02:00
Oliver Stöneberg 09785a4eb8
moved `MyFileInfo` definitions into source files (#4697) 2023-10-21 16:58:29 +02:00
Oliver Stöneberg 85f40ed47c
moved `TokensFrontBack` from `token.h` to `tokenlist.h` (#5547) 2023-10-21 09:14:25 +02:00
Oliver Stöneberg 5e89eb05a6
iwyu.yml: made `include-what-you-use` output more verbose / cleaned up includes (#5540) 2023-10-16 12:57:49 +02:00
Oliver Stöneberg 2f62e9d316
mitigated several compiler warnings / suppress compiler warnings in CI where we don't care about them (#5497)
There's no need to generate any warnings in the CI unless we react on
them.
2023-10-09 12:25:56 +02:00
Oliver Stöneberg 06b5ef1e4d
cleaned up includes based on include-what-you-use (#5532) 2023-10-09 10:07:20 +02:00
Oliver Stöneberg 0f28f3e493
generate `AddonInfo` only once (#4958)
Currently the `AddonInfo` is generated and discarded on each addon
invocation. This leads to an unnecessary process invocation for each
addon on each file.

Also if an addon is completely broken we will still perform the whole
analysis only for it to be failed at the end so we should bail out early
if we know it doesn't work at all.
2023-10-08 21:28:57 +02:00
Oliver Stöneberg 960e8bb4ea
testrunner: got rid of some redundant preprocessing code / added some missing asserts (#5521)
This consolidates the stray invocations of preprocessing.
2023-10-08 11:29:52 +02:00
Oliver Stöneberg 8dee551cad
added testing of clang-tidy invocation to executor tests / also some cleanups (#5514) 2023-10-08 09:06:02 +02:00
Oliver Stöneberg fc700b68eb
refs #4452 / refs #11705 - improved `--showtime=` behavior and testing (#4876)
This is a step onto leveraging the `ThreadExecutor` implementation for
`ProcessExecutor` which is a follow-up to #4870. We need to have the
proper test coverage and the existing implementations working as
expected before we move to the shared code.

Fixes:
- added `--showtime=` tests for all executor implementations
- only print `--showtime=summary` once at the end
- prevents `--showtime=` by multiple threads to be written at the same
time - essentially breaking the output
- reset the timer results before each test
- deprecated `top5` in favor of `top5_file`
- fixed printing for all executors except `ProcessExecutor`
2023-10-05 19:04:06 +02:00
Daniel Marjamäki d069dbfd93
Fix #12029 (Fix definitions of global constants) (#5504) 2023-10-02 20:32:51 +02:00
chrchr-github 4ba19c42ba
Bump simplecpp (fix #11991) (#5486) 2023-09-26 15:58:16 +02:00
Oliver Stöneberg 3fd00c19df
perform logging in `CmdLineParser` through an interface (#5478)
This is in preparation of avoiding accessing `std::cout` directly as
well as streamlining and improving the logging during the settings
parsing. There are no functional changes yet.
2023-09-25 13:43:18 +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
Paul Fultz II e6632d93e3
Fix 11983: False positive: uninitialized variable (#5443) 2023-09-13 23:27:08 +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
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
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 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
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
chrchr-github af46c68a94
Fix FP incorrectStringBooleanError with macro (#5358) 2023-08-22 19:33:24 +02:00
Oliver Stöneberg d6beccc445
fixed #11783 (Remove .plist files generated by unit tests) (#5312) 2023-08-22 15:25:28 +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
Oliver Stöneberg d8b44dff56
fixed/suppressed several compiler warnings (#5327) 2023-08-16 19:35:53 +02:00
Oliver Stöneberg 693084470d
TestCmdlineParser: fixed some TODO test cases (#5325) 2023-08-14 11:37:59 +02:00
Oliver Stöneberg 072212e708
added `TestCheck` and moved some tests from `TestCppcheck` (#5289) 2023-08-07 20:49:10 +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
Oliver Stöneberg 5833fc3c19
testrunner: even more `SettingsBuilder` usage and `const` cleanups (#5030)
* moved some of the test-only `Library::loadxmldata()` calls into `test`

* testrunner: reduced need for backup/restore of settings
2023-05-04 10:31:05 +02:00
Oliver Stöneberg 2935c855c3
reduced usage of mutable `Settings` objects in tests (#4798) 2023-05-02 11:48:24 +02:00
Paul Fultz II 86757de4d5
ValueFlow: Add pass runner to check timeout and report time (#4952) 2023-04-30 20:39:05 +02:00
Oliver Stöneberg 8cf6a22ea3
cleaned up includes based on `include-what-you-use` (#5021) 2023-04-30 07:33:19 +02:00
Oliver Stöneberg 6eae4e71f6
make sure executors are only used in the intended context / `TestSuppressions` cleanups (#4963)
* added asserts to make sure executors are only used in the intended context

* TestSuppressions: specify proper job counts in `checkSuppression*()`

* TestSuppressions: enabled all asserts in `runChecks()`

* TestSuppressions: removed unnecessary setting from `checkSuppression()`

* TestSuppressions: small cleanup in the way tests are called

* TestSuppressions: use `SingleExecutor`
2023-04-28 12:41:53 +02:00
chrchr-github 9c184462ad
Fix #10720 Hang/Crash with big variadic template (#5018)
* Fix #10720 Hang/Crash with big variadic template

* Fix CI
2023-04-28 08:26:35 +02:00
Oliver Stöneberg db955a13a9
moved test-only `Preprocessor::getcode()` out of `lib` (#4993) 2023-04-22 10:22:00 +02:00
Oliver Stöneberg cfca3a69a2
optimized template string substitutions a bit (#4840) 2023-04-08 22:19:52 +02:00