Commit Graph

601 Commits

Author SHA1 Message Date
Daniel Marjamäki 6b9fac41f4
Fixed #11734 (stylistic warnings from addons are not filtered when style is not enabled) (#5091) 2023-05-27 10:24:00 +02:00
Daniel Marjamäki e1d5d9988d
Fixed #11715 (Add --showtime=file-total option to show checking time of each file) (#5049) 2023-05-11 14:04:22 +02:00
Oliver Stöneberg a77ab9759c
Suppressions: some cleanups (#4980)
* Suppressions: merged `isSuppressedLocal()` into `isSuppressed()`

* avoid some unnecessary copies when adding suppressions

* TestSuppressions: improved readability of multiple line string literals

* supressions.h: got rid of unnecessary copy and assignment operators for `Suppressions::Suppression` - fixes `performance-move-const-arg` clang-tidy warning

* TestSuppressions: cleaned up a variable construction
2023-05-04 18:15:18 +02:00
chrchr-github 100d17df4f
Fix #11681 FN constParameterPointer with std::vector (#5000) 2023-05-04 11:10:58 +02:00
Oliver Stöneberg e6ae312a0b
moved more code into `HAVE_RULES` (#4956)
* moved more code into `HAVE_RULES`

* properly enable all internal and rules code in selfcheck

* updated TODOs in selfcheck

* testrunner.vcxproj.filters: updated

* added missing `Debug-PCRE` and `Release-PCRE` configurations for `testrunner` Visual Studio project

* cppcheck.cpp: fixed `useStlAlgorithm` selfcheck warning
2023-05-04 10:54:19 +02:00
Daniel Marjamäki 46b9d4ec61
Fixed #11700 (Markup support is broken, unused function false positives) (#5025) 2023-05-03 11:19:13 +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 2bc4ee925e
parse files with `simplecpp` without providing a stream (#4955) 2023-04-30 20:16:51 +02:00
Oliver Stöneberg c249cc9098
avoid redundant `simplecpp::Output::type` switch blocks (#5005)
* avoid redundant `simplecpp::Output::type` switch blocks

* fixed `useStlAlgorithm` warnings
2023-04-28 15:37:59 +02:00
Oliver Stöneberg 5658319976
CppCheck: removed changing of `debugwarnings` for non-accepted files (#4965) 2023-04-28 12:30:01 +02:00
Oliver Stöneberg ad464c4feb
Preprocessor: relaxed dependency on `Suppressions` (#4983)
* Preprocessor: cleaned up `missingInclude()`

* Preprocessor: relaxed dependency on `Suppressions` / adjusted `TestPreProcessor::inline_suppression_for_missing_include()` which was not testing production behavior

* test/cli/test-other.py: added test for `missingInclude` and `missingIncludeSystem` inline suppressions

* fixed `constParameterReference` selfcheck warning
2023-04-21 10:14:34 +02:00
Oliver Stöneberg 9ad26f51e8
removed `CppCheck` dependency from `CppCheckExecutor::parseFromArgs()` (#4967)
* made `CppCheck::getErrorMessages()` static

* removed `CppCheck` dependency from `CppCheckExecutor::parseFromArgs()`
2023-04-16 13:54:21 +02:00
Daniel Marjamäki e59e34c0eb showtime: separate items properly 2023-04-11 19:52:55 +02:00
Oliver Stöneberg f5e51eace7
do not use string-to-integer conversions without error handling (#4906) 2023-04-08 22:29:09 +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
Daniel Marjamäki 1ac6c3e2ea remove dump files in cppcheck build dir after usage 2023-04-07 11:07:43 +02:00
Daniel Marjamäki aa73427699 cleanup ctu-info when project import is used 2023-04-06 20:17:19 +02:00
Paul Fultz II fd8a7b9537
ValueFlow: Evaluate if statement for function returns (#4908) 2023-03-24 13:31:26 +01:00
Oliver Stöneberg 901b2ab838
Preprocessor: provide suppressions separately from settings (#4878) 2023-03-09 20:15:53 +01:00
Oliver Stöneberg ad6c5d80ff
removed unused `ErrorLogger::reportInfo()` / small `*Executor` cleanup (#4852) 2023-03-04 17:29:34 +01:00
Oliver Stöneberg 0ec2d84f1a
optimized suppression lookups a bit when no suppressions exist (#4839) 2023-03-03 18:37:09 +01:00
Oliver Stöneberg 5af6ca6637
made `Platform` a member of `Settings` instead of inheriting from it / cleanups (#4791) 2023-03-03 18:36:27 +01:00
Oliver Stöneberg b70e1d5461
avoid some unchecked pointer dereferences (#4811) 2023-03-02 22:05:41 +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
Michael Drake d651b6baf1
dump: Fix concurrency problem with dump files (#4757)
* dump: Fix concurrency problem with dump files

This adds the process ID for the cppcheck process to the filenames
of the .dump and .ctu-info files that the process generates.

So
  lib/cppcheck.cpp.dump
becomes
  lib/cppcheck.cpp.<PID>.dump

For example:
  lib/cppcheck.cpp.2637871.dump

The reason for this change is that if there is a buildsystem which
supports concurrency, multiple instances of cppcheck may be run for
the same file.  For example, if the same file is compiled in multiple
build variants, or for multiple targets.

If running the MISRA plugin over such a project with concurrency
enabled in the buildsystem, the plugin ends up crashing as multiple
jobs attempt to create/trample/delete the same files while other
jobs are using them.

For more information see:
    https://sourceforge.net/p/cppcheck/discussion/general/thread/02c757b4af/

* dump: Include pid in filename if dump not explicit

Only change the dump and ctu-info filenames to include the PID if
they are being generated due to an addon.

This means that existing scripts that use `--dump` will still work
if they depend on the previous naming behaviour. The more robust
filenames containing the pid will be used when the dump files are
used as an internal implementation detail for passing data to addons.

However this means that anything that does explicitly use `--dump`
will be susceptible to concurrency problems.

* test: Update addon dump file test to account for pid

This test causes a dump file to be created by enabling the misra
addon. Since the dump files now include the cppcheck process pid
this test had to be updated to account for the change.
2023-02-13 20:54:21 +01:00
Oliver Stöneberg 8ef14dad98
fixed and enabled `performance-faster-string-find` clang-tidy warning (#4769) 2023-02-08 21:01:51 +01:00
Oliver Stöneberg 14e78e1800
greatly improved error handling in Cppcheck project file parsing / some cleanups (#4752) 2023-02-08 20:30:43 +01:00
Daniel Marjamäki 464fbe8d53 Update copyright year 2023-01-28 10:16:34 +01:00
Oliver Stöneberg a8fd5cbaf4
added `entrypoint` to library configuration and got rid of hard-coded ones (#4691) 2023-01-18 20:52:33 +01:00
Daniel Marjamäki f8c4354d2e Cleanup *.ctu-info files that are not needed anymore after analysis 2023-01-18 17:32:14 +01:00
Oliver Stöneberg d3a2cdc26c
converted (undocumented) define `MAXTIME` into (undocumented) command-line options `--checks-max-time=`, `--template-max-time=` and `--typedef-max-time=` (#4661) 2022-12-30 21:21:05 +01:00
Oliver Stöneberg 1cfe49e340
use `const_iterator` where possible (#4662) 2022-12-30 15:13:47 +01:00
Oliver Stöneberg 3c68b9b29f
use `cbegin()` and `cend()` with `const_ierator` loops (#4658) 2022-12-20 20:32:16 +01:00
Daniel Marjamäki 7aae78fed3 Refactoring: Remove unused parameter for AnalyzerInfo::reportErr 2022-12-11 21:27:16 +01:00
Daniel Marjamäki ad8c1e26f0 dump: output language to dumpfile 2022-11-20 12:30:09 +01:00
Daniel Marjamäki 15d3e510e1 ValueFlow: throw TerminateException in valueFlowGenericForward in case analysis is terminated 2022-11-12 12:47:54 +01:00
Oliver Stöneberg 9f7a725983
added environment variable `UNUSEDFUNCTION_ONLY` to make sure only the `unusedFunction` check is being executed (#4362) 2022-10-06 20:54:24 +02:00
Oliver Stöneberg cff1cd9cda
applied clang-tidy `misc-const-correctness` fixes for POD types, iterators and references (#4529)
* applied `misc-const-correctness` fixes for POD types and iterators

* applied `misc-const-correctness` fixes for references
2022-10-02 07:12:40 +02:00
Oliver Stöneberg eeb6db05f1
avoid some unnecessary object creations and copies (#4493) 2022-09-29 21:47:17 +02:00
Oliver Stöneberg 10426f6707
cppcheck.cpp: only call `getFileInfo()` if necessary (#4510) 2022-09-27 20:04:35 +02:00
Oliver Stöneberg dc03a50414
some small cleanups and refactorings (#4488)
* moved `plistFile` from `ErrorLogger` to `CppCheck`

* got rid of global CWE objects

* lib/CMakeLists.txt: suppress some `-Wfloat-equal` clang warning in matchcompiled builds as well

* lib/CMakeLists.txt: moved a loop into proper block

* test/CMakeLists.txt: simplified `add_fixture`

* test/CMakeLists.txt: moved `fixture_cost`

* fixed `naming-privateMemberVariable` selfcheck warning
2022-09-24 11:59:13 +02:00
Oliver Stöneberg 339484d2a1
mitigated and enabled more clang-tidy warnings (#4470)
* fixed some `performance-inefficient-string-concatenation` clang-tidy warnings

* fixed and enabled `modernize-replace-random-shuffle` clang-tidy warning

* fixed and enabled `bugprone-suspicious-string-compare` clang-tidy warning

* mitigated and enabled `readability-non-const-parameter` clang-tidy warnings

* clang-tidy.md: documented some disabled checks

* mitigated and enabled `performance-unnecessary-value-param` clang-tidy warnings
2022-09-16 18:58:59 +02:00
Oliver Stöneberg b3ec225480
iwyu.yml: use `debian:unstable` to always get latest include-what-you-use / cleaned up includes (#4466)
* iwyu.yml: use debian:unstable to always get latest include-what-you-use

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

* mitigated include-what-you-use false positives
2022-09-16 07:15:49 +02:00
Oliver Stöneberg 76d1b9f31a
avoid unnecessary copies with `emplace_back()` (#4450)
* avoid unnecessary copies with `emplace_back()`

* cmdlineparser.cpp: suppress `accessMoved` selfcheck false positives
2022-09-10 11:25:15 +02:00
Oliver Stöneberg d46ea7ba86
avoid unnecessary copies with `push_back()` and `push_front()` (#4451) 2022-09-08 09:21:35 +02:00
Oliver Stöneberg 847391ea2d
some minor optimizations (#4449)
* cppcheck.cpp: reduced scope of a variable

* cppcheck.cpp: removed unnecessary severity checks

* cppcheck.cpp: avoid unnecessary copy

* templatesimplifier.cpp: perform early exit in loop in `expandTemplate()`
2022-09-07 19:19:04 +02:00
Daniel Marjamäki 5d267000e2 GUI: configuration of premium features 2022-08-22 21:11:28 +02:00
Oliver Stöneberg 16f598c409
added missing `sstream` includes (#4381) 2022-08-19 10:16:23 +02:00