cppcheck manpage

Search topic Section

CPPCHECK(1)		     cppcheck User Manual		   CPPCHECK(1)

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

       cppcheck [--append=<file>] [--check-config] [-D<id>] [-U<id>]
		[--enable=<id>] [--error-exitcode=<n>] [--errorlist]
		[--exitcode-suppressions=<file>] [--file-list=<file>]
		[--force] [--help] [-I<dir>] [--includes-file=<file>]
		[-i<dir>] [--inline-suppr] [-j<jobs>] [--max-configs=<limit>]
		[--platform=<type>] [--quiet] [--report-progress]
		[--rule=<rule>] [--rule-file=<file>] [--style]
		[--suppress=<spec>] [--suppressions-list=<file>]
		[--template='<text>'] [--verbose] [--version] [--xml]
		[--xml-version=<version>]] [file or path] ...

       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.

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

	   This allows you to provide information about functions by providing
	   an implementation for these.

	   Check Cppcheck configuration. The normal code analysis is disabled
	   by this flag.

	   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

	   By default Cppcheck checks all configurations. Use '-U' to
	   explicitly hide certain #ifdef <id> code paths from checking.
	   Example: '-UDEBUG'

	   Enable additional checks. The available ids are:

	       Enable all checks

	       Check coding style

	       Enable performance messages

	       Enable portability messages

	       Enable information messages

	       Check for unused functions

	       Warn if there are missing includes. For detailed information
	       use --check-config

	   By default none of the additional checks are enabled. Several ids
	   can be given if you separate them with commas, e.g.

	   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.

	   Print a list of all possible error messages in XML format.

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

	   Specify the files to check in a text file. One filename per line.
	   When file is -, the file list will be read from standard input.

       -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. If used together with --max-ifdefs=, the last option is
	   the one that is effective.

       -h, --help
	   Print help text.

       -I <dir>
	   Give path to search for include files. Give several -I parameters
	   to give several paths. First given path is searched for contained
	   header files first. If paths are relative to source files, this is
	   not needed.

	   Specify directory paths to search for included header files in a
	   text file. Add one include path per line. First given path is
	   searched for contained header files first. If paths are relative to
	   source files, this is not needed.

       -i <dir>
	   Give path to ignore. Give several -i parameters to ignore several
	   paths. Give directory name or filename with path as parameter.
	   Directory name is matched to all parts of the path.

	   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.

	   Maximum number of configurations to check in a file before skipping
	   it. Default is 12. If used together with --force, the last option
	   is the one that is effective.

	   Specifies platform specific types and sizes.The available platforms

	       32 bit unix variant

	       64 bit unix variant

	       32 bit Windows ASCII character encoding

	       32 bit Windows UNICODE character encoding

	       64 bit Windows

	   By default the platform which was used to compile Cppcheck is used.

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

	   Report progress when checking a file.

	   Match regular expression to create your own checks. E.g. rule "/ 0"
	   can be used to check division by zero.

	   Use given rule XML file. See
	   https://sourceforge.net/projects/cppcheck/files/Articles/ for more
	   info about the syntax.

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

	   Suppress a specific warning. The format of <spec> is: [error
	   id]:[filename]:[line]. The [filename] and [line] are optional.
	   [error id] may be * to suppress all warnings (for a specified file
	   or files). [filename] may contain the wildcard characters * or ?.

	   Suppress warnings listed in the file. Each suppression is in the
	   format of <spec> above.

	   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

	   Print out version information

	   Write results in XML to error stream

	   Select the XML file version. Currently versions 1 and 2 are
	   available. The default version is 1.

       The program was written by Daniel Marjamaki and Cppcheck team. See
       AUTHORS file for list of team members.

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

       Reijo Tomperi <aggro80@users.sourceforge.net>
	   Wrote this manpage for the Debian system.

       Copyright (C) 2009 - 2011 Reijo Tomperi

       This manual page was written for the Debian system (but may be used by

       Permission is granted to copy, distribute and/or modify this document
       under the terms of the GNU General Public License, Version 3 or (at
       your option) any later version published by the Free Software

       On Debian systems, the complete text of the GNU General Public License
       can be found in /usr/share/common-licenses/GPL-3.

cppcheck			  12/26/2011			   CPPCHECK(1)