cppcheck/tools
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
..
bisect bisect.sh: make it possible to detect commits which fix scan time regressions / improved documentation (#4863) 2023-03-08 15:00:10 +01:00
test
triage 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
triage_py triage_version.py: extend template for 1.x versions with error ID (#4801) 2023-02-24 07:02:51 +01:00
CMakeLists.txt use `ccache` for sanitizer builds / do not use precompiled headers with `ccache` (#4910) 2023-04-01 09:40:10 +02:00
ci.py
compare.cs
compare_ast_symdb.py
creduce.py
daca2-download.py
daca2-getpackages.py
dmake.cpp extracted single job execution into `SingleExecutor` / improved testing / do not unconditionally apply colors to output (#4882) 2023-04-08 18:06:38 +02:00
dmake.vcxproj
donate-cpu-server.py split `templateInstantiation` from `debug` warnings (#4933) 2023-04-08 16:50:11 +02:00
donate-cpu.py
donate_cpu_lib.py refs #11603 - deprecated `--enable=information` implicitly enabling `missingInclude` (#4865) 2023-03-09 20:04:20 +01:00
extract_and_run_more_tests.sh
extracttests.py
generate_and_run_more_tests.sh
git-pre-commit-cppcheck
listErrorsWithoutCWE.py
matchcompiler.py
parse-glibc.py
readme.md
reduce.py use python3 on debians too (#3812) 2022-11-03 22:14:30 +01:00
run-coverity.sh
run_more_tests.sh ValueFlow: Evaluate if statement for function returns (#4908) 2023-03-24 13:31:26 +01:00
test-my-pr.py
test_donate_cpu_lib.py
test_donate_cpu_server.py
test_matchcompiler.py
test_reduce.py
test_showtimetop5.sh CI-unixish.yml: fixed and enabled all `build` steps for macos (#4832) 2023-03-02 20:54:30 +01:00
testrunnerify_code.sh
times-tags.sh
times-vs.py
times.c
times.sh
trac-keywords.py

readme.md

Cppcheck developer and build tools

* tools/matchcompiler.py

The matchcompiler.py is a build script that performs a few code transformations to .cpp files under the lib directory. These transformations are related to the use of Token::Match() function and are intended to improve code performance. The transformed files are saved on the build directory. This tool is silently used when building the code with SRCDIR=build, that is:

$ cd path/to/cppcheck
$ make MATCHCOMPILER=yes

Here is a simple example of the matchcompiler.py optimization. Suppose there is a file example.cpp under lib/:

// lib/example.cpp
void f1() {
    Token::Match(tok, "abc");
}

void f2() {
    const char *abc = "abc";
    Token::Match(tok, abc);
}

If you manually run matchcompiler.py from the main directory:

$ cd path/to/cppcheck
$ python tools/matchcompiler.py

A file example.cpp will be generated on the build directory:

// build/example.cpp
#include "token.h"
#include "errorlogger.h"
#include <string>
#include <cstring>
static const std::string matchStr1("abc");
// pattern: abc
static bool match1(const Token* tok) {
    if (!tok || !(tok->str()==matchStr1)/* abc */)
        return false;
    return true;
}
void f1() {
    match1(tok);
}

void f2() {
    const char *abc = "abc";
    Token::Match(tok, abc);
}

From this we can see that the usage of Token::Match() in f1() has been optimized, whereas the one in f2() couldn't be optimized (the string wasn't inline on the Token::Match() call). The developer doesn't need to use this tool during development but should be aware of these optimizations. Building with this optimization, cppcheck can get a boost of 2x of speed-up.

* tools/dmake.cpp

Automatically generates the main Makefile for Cppcheck (the main Makefile should not be modified manually). To build and run the dmake tool execute:

$ cd path/to/cppcheck
$ make dmake
$ ./dmake

* tools/reduce.py

Script that reduces code for a hang/false positive.

* tools/times.sh

Script to generate a times.log file that contains timing information of the last 20 revisions.

* tools/donate-cpu.py

Script to donate CPU time to Cppcheck project by checking current Debian packages.

* tools/test-my-pr.py

Script to compare result of working Cppcheck from your branch with main branch.

* tools/triage

This tool lets you comfortably look at Cppcheck analysis results for daca packages. It automatically downloads the package, extracts it and jumps to the corresponding source code for a Cppcheck message.