Cppcheck – static analysis tool for C and C++

Cppcheck is a static analysis tool designed to detect bugs and potentially dangerous constructs in C and C++ source code. Its emphasis is on identifying defects that compilers may not report, including undefined behaviour and incorrect use of language features.

The analyser uses its own parsing and analysis techniques, allowing it to examine code even when it contains non-standard syntax commonly found in embedded projects. It also supports existing build configurations to improve the accuracy of analysis.

Cppcheck is available as a command-line utility and with a graphical interface. It is suitable for examining individual files, checking complete projects and incorporating additional analysis into automated development workflows.

This is free and open source software.

Key Features

  • Detects potential null pointer dereferences and invalid memory accesses.
  • Identifies memory leaks, use-after-free defects and other memory management problems.
  • Checks for uninitialised variables and unsafe use of pointers.
  • Detects division by zero, invalid shifts and selected integer overflow problems.
  • Identifies out-of-bounds array access and suspicious buffer operations.
  • Checks for misuse of C++ standard library classes and functions.
  • Detects selected portability, performance and coding style problems.
  • Analyses C and C++ source without requiring a successful complete build.
  • Imports compilation databases generated by CMake and other build systems.
  • Supports project configurations from compatible development environments.
  • Command-line and graphical interfaces for running analyses and examining results.
  • Configurable diagnostics, warning severity levels and suppressions.
  • Support for custom rules and additional checks through add-ons.
  • XML output and tools for generating HTML reports.
  • Supports parallel analysis and integration into continuous integration workflows.

Website: cppcheck.sourceforge.io
Support:
Developer: Daniel Marjamäki and Cppcheck contributors
License: GNU General Public License v3.0

Cppcheck is written in C++. Learn C++ with our recommended free books and free tutorials.


Related Software

C and C++ Linters
OCLintStatic code analysis tool for improving quality and reducing defects
cpplintStatic code checker for C++
CodeCheckerPlatform for running static analysers and managing code defects
UncrustifySource code beautifer
InferStatic analyser that detects bugs in Java, C and C++ code
Include What You UseSource analysis tool for C and C++ projects built on Clang
CppcheckStatic analysis tool for C/C++ code
flawfinderScans C and C++ source code for potential security weaknesses
clazyQt-focused static analyser that catches common C++ mistakes
ClangFormatCode formatting tool
Clang-TidyClang-based C++ “linter” tool
SmatchStatic analysis tool for finding defects in C code
CoccinelleSemantic patching tool for analysing and transforming C code

Read our verdict in the software roundup.


Best Free and Open Source Software LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.

We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more.

Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion.

Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted