Chisle
The coding-agent plugin that bills 52% of a bare model across 20 live tasks. Terse persona + tool-output compressor + context diet.
翻訳待ち
static analysis of C/C++ code
翻訳待ち
Loading the full README.
Read the full README ↗NOTE: This repository was recently moved from https://github.com/danmar/cppcheck to https://github.com/cppcheck-opensource/cppcheck. Please make sure to update all your references to it accordingly.
| release-windows | OSS-Fuzz | Coverity Scan Build Status | include-what-you-use | License |
|---|---|---|---|---|
The original name of this program was "C++check", but it was later changed to "Cppcheck".
Despite the name, Cppcheck is designed for both C and C++.
A manual is available online.
Cppcheck is a hobby project with limited resources. You can help us by donating CPU (1 core, which is the default, or as many as you like. Use the -j flag to use more cores). It is simple:
Download (and extract) Cppcheck source code.
Run (Linux/MacOS example):
cd cppcheck/
python3 -m venv .venv
source .venv/bin/activate
pip install -r tools/donate-cpu-requirements.txt
./tools/donate-cpu.py
The script will analyse Debian source code and upload the results to a Cppcheck server. We need these results both to improve Cppcheck and to detect regressions.
You can stop the script whenever you like with Ctrl+C.
Cppcheck requires a C++ compiler with (partial) C++11 support. Minimum required versions are GCC 5.1 / Clang 3.5 / AppleClang 6.0 / Visual Studio 2015.
To build the GUI application, you need to use the CMake build system.
When building the command line tool, PCRE is optional. It is used if you build with rules.
There are multiple compilation choices:
The minimum required Python version is 3.7.
The minimum required version is CMake 3.22.
Example, compiling Cppcheck with cmake:
cmake -S . -B build
cmake --build build
If you want to compile the GUI you can use the flag.
-DBUILD_GUI=ON
For rules support (requires pcre) use the flag.
-DHAVE_RULES=ON
For release builds it is recommended that you use:
-DUSE_MATCHCOMPILER=ON
For building the tests use the flag.
-DBUILD_TESTING=ON
Using CMake you can generate project files for Visual Studio, XCode, etc.
For single-configuration generators (like "Unix Makefiles") you can generate and build a specific configuration (e.g. "RelWithDebInfo") using:
cmake -S . -B build_RelWithDebInfo -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
cmake --build build_RelWithDebInfo --config RelWithDebInfo
For multi-configuration generators (like "Visual Studio 17 2022") the same is achieved using:
cmake -S . -B build
cmake --build build --config RelWithDebInfo
Use the cppcheck.sln file. The file is configured for Visual Studio 2019, but the platform toolset can be changed easily to older or newer versions. The solution contains platform targets for both x86 and x64.
To compile with rules, select "Release-PCRE" or "Debug-PCRE" configuration. pcre.lib (pcre64.lib for x64 builds) and pcre.h are expected to be in /externals then. A current version of PCRE for Visual Studio can be obtained using vcpkg.
If you do not wish to use the Visual Studio IDE, you can compile Cppcheck from the command line the following command.
msbuild cppcheck.sln
Cppcheck Official is an extension officially supported by the cppcheck team allowing you to easily use cppcheck in VS Code. You can find it in VS Code Marketplace through the extension tab in your IDE. For instructions on how to set it up and use it, see the readme on the github page: https://github.com/cppchecksolutions/vscode-cppcheck-official
The PCRE dll is needed to build the CLI. It can be downloaded here: http://software-download.name/pcre-library-windows/
Simple, unoptimized build (no dependencies):
make
You can use CXXOPTS, CPPOPTS and LDOPTS to append to the existing CXXFLAGS, CPPFLAGS and LDFLAGS instead of overriding them.
The recommended release build is:
make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck HAVE_RULES=yes CXXOPTS="-O2" CPPOPTS="-DNDEBUG"
If you just want to build Cppcheck without dependencies then you can use this command:
g++ -o cppcheck -std=c++11 -Iexternals -Iexternals/simplecpp -Iexternals/tinyxml2 -Iexternals/picojson -Ilib -Ifrontend frontend/*.cpp cli/*.cpp lib/*.cpp externals/simplecpp/simplecpp.cpp externals/tinyxml2/tinyxml2.cpp
MATCHCOMPILER=yes
Several Token matching patterns are converted into more efficient C++ code at compile time (requires Python to be installed).
FILESDIR=/usr/share/cppcheck
Specifies the folder where Cppcheck files (addons, cfg, platform) are installed to.
HAVE_RULES=yes
Enables rules (requires PCRE to be installed).
CXXOPTS="-O2"
Enables most compiler optimizations.
CPPOPTS="-DNDEBUG"
Disables assertions.
This is the beginning of the README. Read the rest at the original. Read the full README ↗