CPPCHECK(1)

πŸ’– CPPCHECK(1) β€” the cppcheck user manual, but make it make sense πŸ’–

okay bestie, so this is the cppcheck manual page β€” it's from the cppcheck User Manual section of the man pages, and it's genuinely a lot, so we're doing this in parts. buckle up, hydrate, and let's get into it 🫢


✨ NAME ✨

cppcheck β€” the tool for static C/C++ code analysis. that's it, that's the whole vibe. it reads your code and side-eyes it before your compiler even gets a chance πŸ‘€


✨ SYNOPSIS ✨

like, here's the whole shape of how you call it. don't panic at the wall of flags, we're gonna get to every single one:

       cppcheck [--check-config] [--check-library] [-D<id>] [-U<id>]
                [--disable=<id>] [--enable=<id>] [--error-exitcode=<n>]
                [--errorlist] [--exitcode-suppress=<spec>]
                [--exitcode-suppressions=<file>] [--file-list=<file>]
                [--filesdir] [--force] [--fsigned-char] [--funsigned-char]
                [--help] [-I<dir>] [--includes-file=<file>]
                [--config-exclude=<dir>] [--config-excludes-file=<file>]
                [--include=<file>] [-i<dir>] [--inconclusive] [--inline-suppr]
                [-j<jobs>] [-l<load>] [--language=<language>] [--library=<cfg>]
                [--max-configs=<limit>] [--max-ctu-depth=<limit>]
                [--platform=<type>] [--quiet] [--relative-paths=<paths>]
                [--report-progress] [--report-type=<type>] [--rule=<rule>]
                [--rule-file=<file>] [--showtime=<mode>] [--std=<id>]
                [--suppress=<spec>] [--suppressions-list=<file>]
                [--suppress-xml=<.xml file>] [--template='<text>'] [--verbose]
                [--version] [--xml] [--xml-version=<version>]] [file or path]
                ...

and yeah, that ending is fr fr just [file or path] followed by ... β€” meaning you can yeet as many files or paths at it as you want πŸ’…


✨ DESCRIPTION ✨

okay so cppcheck is a command-line tool whose entire main character job is trying to detect bugs that your C/C++ compiler doesn't see. like, your compiler already did its thing and clocked out, and cppcheck is over here finding the stuff it missed. πŸ”₯

it's versatile β€” no cap β€” and it can check non-standard code, including:

  • various compiler extensions
  • inline assembly code
  • etc. (yes, the manpage literally says "etc.", iconic)

its internal preprocessor can handle includes, macros, and several preprocessor commands. so it's not just skimming your files, it's actually processing them properly 🧚

and here's the bestie part: while cppcheck is highly configurable (like, extremely, you'll see), you can literally just start using it by giving it a path to your source code. that's the whole entry requirement. no config file, no setup arc, just point and go ✨

ngl the "just give it a path" part is the moment this tool ate and left no crumbs β€” everything else is optional seasoning πŸ“

(more coming in part 2, don't go anywhere bestie πŸ’œ)

✨ OPTIONS ✨

Analyze given C/C++ files for common errors. That's the whole vibe of this bad boy πŸ’…

  • -CC β€” Do not remove comments during preprocessing (requires -E). Yes, that's two C's, bestie, not a typo 🫢
  • --check-config β€” Check Cppcheck configuration. The normal code analysis is disabled by this flag. So like, it's just doing a lil vibe check on the config and nothing else ✨
  • --check-library β€” Show information messages when library files have incomplete info. Very "hey queen, your library's missing a few brain cells" energy πŸŽ€
  • -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. So you're basically telling it "only look here, bestie" 😌
  • -U<id> β€” By default Cppcheck checks all configurations. Use '-U' to explicitly hide certain #ifdef <id> code paths from checking. Example: '-UDEBUG'. It's giving "nothing to see here, move along" πŸ’€
  • -E β€” Print preprocessor output on stdout and don't do any further processing. Just the preprocessor, no thoughts, head empty 🌸
  • --disable=<id> β€” Disable individual checks. Please refer to the documentation of --enable=<id> for further details. (Spoiler: it's literally the next option, keep scrolling πŸ“)
  • --enable=<id> β€” Enable additional checks. The available ids are:
    • all β€” Enable all checks. It is recommended to only use --enable=all when the whole program is scanned, because this enables unusedFunction. Main character energy, but like, it needs the whole squad present πŸ‘‘
    • warning β€” Enable warning messages
    • style β€” Enable all coding style checks. All messages with the severities 'style', 'performance' and 'portability' are enabled.
    • performance β€” Enable performance messages
    • portability β€” Enable portability messages
    • information β€” Enable information messages
    • unusedFunction β€” Check for unused functions. It is recommend to only enable this when the whole program is scanned. (Yes it says "recommend", we're keeping it fr)
    • missingInclude β€” Warn if there are missing includes

By default none of the additional checks are enabled. Several ids can be given if you separate them with commas, e.g. --enable=style,unusedFunction. See also --std. Commas are the moment, ok? πŸ’…

  • --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. Like… rude of the OS but okay 😭
  • --errorlist β€” Print a list of all possible error messages in XML format. The full menu of everything that could ever go wrong, iconic ✨
  • --exitcode-suppress=<spec> β€” Used to specify an error ID which should not result in a non-zero exitcode.
  • --exitcode-suppressions=<file> β€” Used when certain messages should be displayed but should not cause a non-zero exitcode. So it still shows up, it just doesn't throw hands at your exit code 😌
  • --file-list=<file> β€” 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. Stdin girlies rise up 🧚
  • --filesdir β€” Print the built-in FILESDIR. That's it. That's the whole job πŸ¦‹
  • -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-configs=, the last option is the one that is effective. Last one wins, periodt ⭐
  • --fsigned-char β€” Treat char type as signed. This overrides previous --platform options and is overridden by following ones. Order matters, babes 🌈
  • --funsigned-char β€” Treat char type as unsigned. This overrides previous --platform options and is overridden by following ones. Same deal, opposite vibes πŸ”₯
  • -h, --help β€” Print help text. When in doubt, ask for help πŸ’–
  • -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. First come, first searched, no cap πŸŽ€
  • --includes-file=<file> β€” 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.
  • --config-exclude=<dir> β€” Path (prefix) to be excluded from configuration checking. Preprocessor configurations defined in headers (but not sources) matching the prefix will not be considered for evaluation of configuration alternatives. So it's a little VIP velvet rope for configs 🫢
  • --config-exclude-file=<file> β€” A file that contains a list of config-excludes. Bulk velvet rope, we love to see it πŸ’œ
  • --include=<file> β€” Force inclusion of a file before the checked file. Can be used for example when checking the Linux kernel, where autoconf.h needs to be included for every file compiled. Works the same way as the GCC -include option. Very "you WILL meet my friend first" energy 😀
  • -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. Ignore list behavior, we stan 🚫
  • --inconclusive β€” Allow that Cppcheck reports even though the analysis is inconclusive. There are false positives with this option. Each result must be carefully investigated before you know if it is good or bad. Lowkey risky bestie β€” receipts must be checked before you fight πŸ’€
  • --inline-suppr β€” Enable inline suppressions. Use them by placing comments in the form: // cppcheck-suppress memleak before the line to suppress. A little note-to-self in your code, adorable πŸ“
  • -j <jobs> β€” Start <jobs> threads to do the checking work. Multithreaded queen behavior πŸ‘‘
  • -l <load> β€” Specifies that no new threads should be started if there are other threads running and the load average is at least <load> (ignored on non UNIX-like systems). It's giving "read the room" before spawning more threads 😌
  • --language=<language> β€” Forces cppcheck to check all files as the given language. Valid values are: c, c++. Commit to a personality, bestie ✨
  • --library=<cfg> β€” Use library configuration.
  • --max-configs=<limit> β€” 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. Twelve's the limit, then we move on πŸƒβ€β™€οΈ
  • --max-ctu-depth=<limit> β€” Maximum depth in whole program analysis. Default is 2. How deep do we go? Two. Two deep. 🌊
  • --platform=<type> β€” Specifies platform specific types and sizes. The available platforms are:
    • unix32 β€” 32 bit unix variant
    • unix64 β€” 64 bit unix variant
    • win32A β€” 32 bit Windows ASCII character encoding
    • win32W β€” 32 bit Windows UNICODE character encoding
    • win64 β€” 64 bit Windows

By default the platform which was used to compile Cppcheck is used. So it just matches the energy of wherever it was built 🌸

  • -q, --quiet β€” Only print something when there is an error. Silent treatment unless something's actually wrong, we love a low-drama icon 🀫
  • -rp, -rp=<paths>, --relative-paths;, --relative-paths=<paths> β€” Use relative paths in output. When given, <paths> are used as base. You can separate multiple paths by ';'. Otherwise path where source files are searched is used. E.g. if given value is test, when checking test/test.cpp, the path in output will be test.cpp instead of test/test.cpp. The feature uses string comparison to create relative paths, so using e.g. ~ for home folder does not work. It is currently only possible to apply the base paths to files that are on a lower level in the directory tree. Tilde girlies I'm so sorry, it's literally string comparison 😭
  • --report-progress β€” Report progress when checking a file. Live updates, we're locked in 🎬
  • --report-type=<type> β€” Add guideline and classification fields for specified coding standard. The available report types are:
    • normal β€” Default, only show cppcheck error ID and severity)
    • autosar β€” Autosar
    • cert-c-2016 β€” Cert C 2016
    • cert-cpp-2016 β€” Cert C++ 2016
    • misra-c-2012 β€” Misra C 2012
    • misra-c-2023 β€” Misra C 2023
    • misra-c-2025 β€” Misra C 2025
    • misra-cpp-2008 β€” Misra C++ 2008
    • misra-cpp-2023 β€” Misra C++ 2023

(And yeah, that stray ) on normal is in the original, we're keeping it exactly, no cap πŸ’…)

  • --rule=<rule> β€” Match regular expression to create your own checks. E.g. rule "/ 0" can be used to check division by zero. This command is only available if cppcheck was compiled with HAVE_RULES=yes. DIY checks, main character energy ✨
  • --rule-file=<file> β€” Use given rule XML file. See https://sourceforge.net/projects/cppcheck/files/Articles/ for more info about the syntax. This command is only available if cppcheck was compiled with HAVE_RULES=yes. Same HAVE_RULES=yes caveat, don't come for me 🫢
  • --showtime=<mode> β€” Show timing information. The available mode are:
    • none β€” Show nothing (default)
    • file β€” Show for each processed file
    • file-total β€” Show total time only for each processed file
    • file-total… ok wait, that's file-total. Next:
    • summary β€” Show a summary at the end
    • top5_file β€” Show the top 5 for each processed file
    • top5_summary β€” Show the top 5 summary at the end

(Yep, "the available mode are" β€” original grammar, we keep it πŸ™ˆ)

  • --std=<id> β€” Set standard. The available options are:
    • c89 β€” C code is C89 compatible
    • c99 β€” C code is C99 compatible
    • c11 β€” C code is C11 compatible (default)
    • c++03 β€” C++ code is C++03 compatible
    • c++11 β€” C++ code is C++11 compatible
    • c++14 β€” C++ code is C++14 compatible
    • c++17 β€” C++ code is C++17 compatible
    • c++20 β€” C++ code is C++20 compatible (default)

Two defaults, one for C and one for C++, we contain multitudes 🌈

  • --suppress=<spec> β€” 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 ?. Wildcards in the filename, we're flexible like that πŸ¦‹
  • --suppressions-list=<file> β€” Suppress warnings listed in the file. Each suppression is in the format of <spec> above. Same spec, just in a file, iconique πŸŽ€
  • --suppress-xml=<.xml file> β€” Use suppressions defined in xml as described in the manual. XML girlies, this one's for you πŸ’œ
  • --template='<text>' β€” Format the error messages. E.g. '{file}:{line},{severity},{id},{message}' or '{file}({line}):({severity}) {message}'. Pre-defined templates: gcc, vs. Make it look however you want, it's your world ⭐
  • -v, --verbose β€” More detailed error reports. The tea is PIPING hot and fully explained β˜•
  • --version β€” Print out version information. Who are you? What's your number? πŸ’–
  • --xml β€” Write results in XML to error stream. Structured chaos, but make it XML 🌸
  • --xml-version=<version> β€” Select the XML file version. Also implies --xml. Currently only version 2 is available. The default version is 2. One version to rule them all πŸ‘‘

πŸ‘‘ AUTHOR πŸ‘‘

The program was written by Daniel MarjamÀki and Cppcheck team. See AUTHORS file for list of team members. Shoutout to the whole squad, fr fr 🫢

πŸ¦‹ SEE ALSO πŸ¦‹

Full list of features: https://sourceforge.net/p/cppcheck/wiki/Home/ β€” go read it, it's giving lore πŸ“š

πŸ’… AUTHOR πŸ’…

  • Reijo Tomperi <aggro80@users.sourceforge.net> β€” Wrote this manpage for the Debian system. The original manpage author, absolute legend, we thank them for their service πŸŽ€

okay so legal stuff time, bestie, but it's actually kinda cute because it's a gift economy moment πŸ’–

  • Copyright Β© 2009 - 2016 Reijo Tomperi β€” like, the whole thing is his, periodt πŸ‘‘
  • This manual page was written for the Debian system (but may be used by others) β€” so it's a Debian girlie first and foremost, but she's not gatekeeping, anyone can borrow her 🫢
  • 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 Foundation. so yeah, remix it, share it, whatever, just keep it under the GPL vibe 🌈
  • On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-3 β€” that's the whole lore, go read it if you're the type who reads the terms (iconic behavior honestly) πŸ“–

and that's a wrap on the whole cppcheck page, bestie!! πŸ’… you now know every flag, every default, every exit code, and every little caveat. go forth and lint. no cap, you're gonna slay it βœ¨πŸ¦‹

✧ο½₯゚: * this page ships as cppcheck, dated 09/20/2026, and files itself under CPPCHECK(1) β€” she's iconic, she's documented, she's legally licensed, iykyk πŸ’œ πŸŽ€ ✧ο½₯゚:

πŸ“¦ where this page comes from