diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index 1789ec624..06453c214 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -532,7 +532,7 @@ bool CppCheck::parseFromArgs(int argc, const char* const argv[]) oss << "Cppcheck - A tool for static C/C++ code analysis\n" "\n" "Syntax:\n" - " cppcheck [--append=file] [--enable=] [--error-exitcode=[n]]\n" + " cppcheck [--append=file] [-D] [--enable=] [--error-exitcode=[n]]\n" " [--exitcode-suppressions file] [--file-list=file.txt] [--force]\n" " [--help] [-Idir] [--inline-suppr] [-j [jobs]] [--quiet] [--style]\n" " [--suppressions file.txt] [--verbose] [--version] [--xml]\n" @@ -543,6 +543,10 @@ bool CppCheck::parseFromArgs(int argc, const char* const argv[]) "Options:\n" " --append=file This allows you to provide information about\n" " functions by providing an implementation for these.\n" + " -D By default Cppcheck checks all configurations.\n" + " Use -D to limit the checking. When -D is used the\n" + " checking is limited to the given configuration.\n" + " Example: -DDEBUG=1 -D__cplusplus\n" " --enable=id Enable specific checks. The available ids are:\n" " * all - enable all checks\n" " * exceptNew - exception safety when using new\n" diff --git a/man/manual.docbook b/man/manual.docbook index 81ff1c408..2c0d8db9c 100644 --- a/man/manual.docbook +++ b/man/manual.docbook @@ -155,6 +155,23 @@ Checking path/file2.cpp... + + Preprocessor configurations + + By default Cppcheck will check all preprocessor configurations + (except those that has #error in them). This is the recommended + behaviour. + + But if you want to manually limit the checking you can do so with + -D. + + For example, if you want to limit the checking so the only + configuration to check should be "DEBUG=1;__cplusplus" then something like + this can be used: + + cppcheck -DDEBUG=1 -D__cplusplus path + + XML output