CPPCHECK(1)

NAME
cppcheck - Tool for static C/C++ code analysis

SYNOPSIS

cppcheck [--append=[file]] [-D[id]] [--enable=[id]] [--error-exitcode=[n]] [--exitcode-suppressions [file]] [--file-list=file] [--force] [--help] [-I[dir]] [--inline-suppr] [-j[jobs]] [--quiet] [--report-progress] [--style] [--suppressions [file]] [--template '[text]'] [--verbose] [--version] [--xml] [file or path] ...

DESCRIPTION

Cppcheck is a command-line tool that tries to detect bugs that your C/C++ compiler doesn't see. It is versatile, and can check non-standard code including various compiler extensions, inline assembly code, etc. Its internal preprocessor can handle includes, macros, and several preprocessor commands. While Cppcheck is highly configurable, you can start using it just by giving it a path to the source code.

OPTIONS

Analyze given C/C++ files for common errors.

--append=[file]
    This allows you to provide information about functions by providing an implementation for these.

-D[id]
    By default Cppcheck checks all configurations. Use -D to limit the checking. When -D is used the checking is limited to the given configuration. Example: -DDEBUG=1 -D__cplusplus

--enable=[id]
    Enable specific checks. The available ids are: .RS .TP all Enable all checks. .TP style Check coding style. .TP unusedFunction Check for unused functions. .TP missingInclude check for missing includes .RE .IP Several ids can be given if you separate them with commas, e.g. --enable=style,unusedFunction.

--error-exitcode=[n]
    If errors are found, integer [n] is returned instead of default 0. EXIT_FAILURE is returned if arguments are not valid or if no input files are provided. Note that your operating system can modify this value, e.g. 256 can become 0.

--exitcode-suppressions [file]
    Used when certain messages should be displayed but should not cause a non-zero exitcode.

--file-list=[file]
    Specify the files to check in a text file. One filename per line.

-f, --force
    Force checking of files that have a lot of configurations. Error is printed if such a file is found so there is no reason to use this by default.

-h, --help
    Print help text.

-I [dir]
    Give include path. Give several -I parameters to give several paths. First given path is checked first. If paths are relative to source files, this is not needed.

--inline-suppr
    Enable inline suppressions. Use them by placing comments in the form: // cppcheck-suppress memleak before the line to suppress.

-j [jobs]
    Start [jobs] threads to do the checking work.

-q, --quiet
    Only print something when there is an error.

--report-progress
    Report progress when checking a file.

-s, --style
    Deprecated, use --enable=style

--suppressions [file]
    Suppress warnings listed in the file. Filename and line are optional. The format of the single line in file is: [error id]:[filename]:[line]. You can use --template or --xml to see the error id.

--template '[text]'
    Format the error messages. E.g. '{file}:{line},{severity},{id},{message}' or '{file}({line}):({severity}) {message}'. Pre-defined templates: gcc, vs

-v, --verbose
    More detailed error reports

--version
    Print out version information

--xml
    Write results in xml to error stream

AUTHOR

The program was written by Bill Egert, Daniel Marjamäki, Gianluca Scacco, Hoang Tuan Su, Kimmo Varis, Leandro Penz, Martin Ettl, Nguyen Duong Tuan, Nicolas Le Cam, Reijo Tomperi, Robert Reif, Slava Semushin, Vesa Pikki and Zachary Blair

SEE ALSO

Full list of features: http://cppcheck.wiki.sourceforge.net/

AUTHOR
Reijo Tomperi.