From ec4e0c8bf5dba7803c0ebf8313827794d905a674 Mon Sep 17 00:00:00 2001 From: Greg Hewgill Date: Wed, 23 Feb 2011 20:59:30 +1300 Subject: [PATCH] add documentation for --suppress= option --- cli/cmdlineparser.cpp | 9 +++++---- man/cppcheck.1.xml | 14 +++++++++++--- man/manual.docbook | 8 +++++++- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index a0732eee8..f77395a12 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -671,11 +671,12 @@ void CmdLineParser::PrintHelp() " --rule-file= Use given rule file. For more information, see: \n" " https://sourceforge.net/projects/cppcheck/files/Articles/\n" " -s, --style Deprecated, use --enable=style\n" - " --suppressions-list=\n" - " Suppress warnings listed in the file. Filename and line\n" - " are optional in the suppression file. The format of the\n" - " single line in the suppression file is:\n" + " --suppress= Suppress a specific warning. The format of is:\n" " [error id]:[filename]:[line]\n" + " The [filename] and [line] are optional.\n" + " --suppressions-list=\n" + " Suppress warnings listed in the file. Each suppression\n" + " is in the same format as above.\n" " --template '' Format the error messages. E.g.\n" " '{file}:{line},{severity},{id},{message}' or\n" " '{file}({line}):({severity}) {message}'\n" diff --git a/man/cppcheck.1.xml b/man/cppcheck.1.xml index 9332a09ae..d0aae70a0 100644 --- a/man/cppcheck.1.xml +++ b/man/cppcheck.1.xml @@ -120,6 +120,7 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/ + @@ -303,12 +304,19 @@ Directory name is matched to all parts of the path. Deprecated, use --enable=style + + + + Suppress a specific warning. The format of <spec> is: [error id]:[filename]:[line]. + The [filename] and [line] are optional. + [filename] may contain the wildcard characters * or ?. + + - 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. - The filename may contain the wildcard characters * or ?. + Suppress warnings listed in the file. + Each suppression is in the format of <spec> above. diff --git a/man/manual.docbook b/man/manual.docbook index 07285513a..c3c16bb61 100644 --- a/man/manual.docbook +++ b/man/manual.docbook @@ -374,7 +374,8 @@ gui/test.cpp,16,error,mismatchAllocDealloc,Mismatching allocation and deallocati Suppressions If you want to filter out certain errors you can suppress these. - First you need to create a suppressions file. The format is: + The --suppress= command line option is used to specify + suppressions on the command line. The format is one of: [error id]:[filename]:[line] [error id]:[filename2] @@ -389,6 +390,11 @@ gui/test.cpp,16,error,mismatchAllocDealloc,Mismatching allocation and deallocati * or ?, which match any sequence of characters or any single character respectively. + cppcheck --suppress=memleak:file1.cpp src/ + + If you have more than a couple of suppressions, create a suppressions + file with one line per suppression as above. + Here is an example: memleak:file1.cpp