Commit Graph

680 Commits

Author SHA1 Message Date
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
Oliver Stöneberg 1f2b49142e
extracted single job execution into `SingleExecutor` / improved testing / do not unconditionally apply colors to output (#4882)
* added `Settings::useSingleJob()` and use it instead of checking `jobs` or `jointSuppressionReport`

* extracted single job execution into `SingleExecutor`

* moved `reportStatus()` from `CppCheckExecutor` to Èxecutor

* TestSingleExecutor: improved tests

* added testing of markup extension handling in executors

* cleaned up includes based on `include-what-you-use`

* testsingleexecutor.cpp: suppress `performance-unnecessary-value-param` clang-tidy warnings

* ProcessExecutor: send color via pipe instead of applying it beforehand

* do not unconditionally apply colors to output / disable all colors in tests / adjusted tests for changed output behavior

* fixed precision loss in `Executor::reportStatus()`

* fixed `naming-varname` selfcheck warnings
2023-04-08 18:06:38 +02:00
Oliver Stöneberg 5be8eee943
iwyu.yml: use a distro which has the latest `include-what-you-use` / enabled Qt mappings / cleaned up includes (#4885) 2023-04-08 16:08:47 +02:00
Oliver Stöneberg a00b6e1f8a
simplified `ThreadExecutor` class by moving some code out of it / fixed some thread safety issues (#4849) 2023-03-04 12:05:17 +01:00
Oliver Stöneberg 50eb0641b9
iwyu.yml: added `clang-include-cleaner` job / cleaned up includes based on `include-what-you-use` (#4844) 2023-03-04 08:53:19 +01:00
Oliver Stöneberg bd1ae69b00
cleaned up includes based on `include-what-you-use` (#4599) 2023-03-02 21:50:14 +01:00
Oliver Stöneberg 8f5f06add7
some `Tokenizer` construction and related other cleanups (#4799) 2023-03-02 21:48:14 +01:00
Oliver Stöneberg 75619db1d5
symboldatabase.cpp: use `Keywords` / added TODOs (#4828) 2023-03-02 21:20:56 +01:00
Oliver Stöneberg 674231ae52
added clean C/C++ keyword lists and use them in `TokenList` (#3774) 2023-02-24 21:43:27 +01:00
Oliver Stöneberg 4d9caa99f3
improved testing of missing includes / made it possible to clear the include cache in simplecpp (#4704) 2023-02-07 22:02:12 +01:00
Oliver Stöneberg 7c7ccdf7c0
Check: disallow more than one instance per check (#4749) 2023-01-29 17:23:03 +01:00
Oliver Stöneberg 1d3955bd92
renamed some files in the `test` folder (#4705) 2023-01-27 08:18:32 +01:00
Oliver Stöneberg bea6aec2b2
extracted `ValueFlow::Value` to `vfvalue.{cpp|h}` (#4642) 2023-01-26 22:23:22 +01:00
Oliver Stöneberg 38abeccd24
added command-line option `--disable=<id>` to disable individual checks (#4712) 2023-01-21 10:39:44 +01:00
Oliver Stöneberg 0ed98c8f29
removed unused test files (#4648) 2022-12-18 19:36:37 +01:00
Oliver Stöneberg e5721030ca
greatly sped up `dmake` (#4630)
* dmake.cpp: use `endsWith()` in `getCppFiles()`

* dmake.cpp: optimized string concatenation in `getDeps()`

* dmake.cpp: avoid duplicated `std::string::find()` in `getDeps()`

* dmake.cpp: no need to get dependencies of headers without `.h` extension in `getDeps()`

* dmake.cpp: do not try to look for file in `externals` folder which does not contain any headers in `getDeps()`
2022-12-17 09:13:31 +01:00
Oliver Stöneberg 29e0133cb5
extracted `FwdAnalysis` from `astutils.{cpp|h}` (#4637)
* added missing filtering offiles in Visual Studio project

* extracted `FwdAnalysis` from `astutils.{cpp|h}`
2022-12-13 22:29:23 +01:00
Oliver Stöneberg 01abf4c347
fixed macos build by manually installing `pcre` (#4597)
* Makefile: bail out if `pcre-config` is missing

* CI-unixish.yml: install `pcre` for `macos` via `brew` since it suddenly disappeared from the runner images
2022-11-25 15:11:57 +01:00
Oliver Stöneberg 0481edf9c3
return `SmallVector` from `followAllReferences()` (#3925) 2022-09-29 21:41:32 +02:00
Oliver Stöneberg 9542a7b3cc
Makefile: some cleanups / added `VERBOSE` option (#4438) 2022-09-09 15:06:40 +02:00
Oliver Stöneberg 467648bec6
fixed #11249 (potential hang with -j and --showtime= when using threads) - synchronized access to `TimerResults::mResults` / added TSAN to CI (#4355) 2022-08-23 20:30:45 +02:00
Oliver Stöneberg 1202efb438
some `--exception-handling` related improvements (#4368) 2022-08-20 20:54:31 +02:00
Oliver Stöneberg 1d95d1908d
refs #10663 - sped up `Library::detectContainerOrIterator()` by iterating the containers only once (#4380) 2022-08-20 12:14:55 +02:00
Oliver Stöneberg 32c0167eab
specify `-pipe` for GCC to use pipes instead of temporary files - greatly reduces I/O usage (#4360) 2022-08-16 22:12:01 +02:00
Oliver Stöneberg 31d704e4bc
cppcheckexecutor.cpp: extracted platform-dependent code into separate files (#4359) 2022-08-16 22:03:44 +02:00
Oliver Stöneberg 271213cbbd
added make target `validatePlatforms` to CMake (#4343)
* added missing `platforms/cppcheck-platforms.rng` validation

* added make target `validatePlatforms` to CMake
2022-08-06 19:56:32 +02:00
chrchr-github 21d992cc00
Fix crash on Windows with -j option (#4229)
* Fix crash on Windows with -j option

* Disable CI-cygwin workflow

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Try to fix Cygwin build

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Cygwin uses THREADING_MODEL_FORK

* Restore workflows

* Remove comment

* Fix dmake

* Fix #11179 FP invalidFunctionArgStr

* Revert "Fix #11179 FP invalidFunctionArgStr"

This reverts commit dd5d3e67c6.
2022-07-13 13:46:03 +02:00
Daniel Marjamäki b387ae80f1 Fixed whole program analysis 2022-07-12 22:58:52 +02:00