add documentation for --suppress= option

This commit is contained in:
Greg Hewgill 2011-02-23 20:59:30 +13:00
parent 22210e0255
commit ec4e0c8bf5
3 changed files with 23 additions and 8 deletions

View File

@ -671,11 +671,12 @@ void CmdLineParser::PrintHelp()
" --rule-file=<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=<file>\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=<spec> Suppress a specific warning. The format of <spec> is:\n"
" [error id]:[filename]:[line]\n"
" The [filename] and [line] are optional.\n"
" --suppressions-list=<file>\n"
" Suppress warnings listed in the file. Each suppression\n"
" is in the same format as <spec> above.\n"
" --template '<text>' Format the error messages. E.g.\n"
" '{file}:{line},{severity},{id},{message}' or\n"
" '{file}({line}):({severity}) {message}'\n"

View File

@ -120,6 +120,7 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/
<arg choice="opt"><option>--rule=&lt;rule&gt;</option></arg>
<arg choice="opt"><option>--rule-file=&lt;file&gt;</option></arg>
<arg choice="opt"><option>--style</option></arg>
<arg choice="opt"><option>--suppress=&lt;spec&gt;</option></arg>
<arg choice="opt"><option>--suppressions-list=&lt;file&gt;</option></arg>
<arg choice="opt"><option>--template '&lt;text&gt;'</option></arg>
<arg choice="opt"><option>--verbose</option></arg>
@ -303,12 +304,19 @@ Directory name is matched to all parts of the path.</para>
<para>Deprecated, use --enable=style</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--suppress=&lt;spec&gt;</option></term>
<listitem>
<para>Suppress a specific warning. The format of &lt;spec&gt; is: [error id]:[filename]:[line].
The [filename] and [line] are optional.
[filename] may contain the wildcard characters * or ?.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--suppressions-list=&lt;file&gt;</option></term>
<listitem>
<para>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 ?.</para>
<para>Suppress warnings listed in the file.
Each suppression is in the format of &lt;spec&gt; above.</para>
</listitem>
</varlistentry>
<varlistentry>

View File

@ -374,7 +374,8 @@ gui/test.cpp,16,error,mismatchAllocDealloc,Mismatching allocation and deallocati
<title>Suppressions</title>
<para>If you want to filter out certain errors you can suppress these.
First you need to create a suppressions file. The format is:</para>
The <literal>--suppress=</literal> command line option is used to specify
suppressions on the command line. The format is one of:</para>
<programlisting>[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.</para>
<programlisting>cppcheck --suppress=memleak:file1.cpp src/</programlisting>
<para>If you have more than a couple of suppressions, create a suppressions
file with one line per suppression as above.</para>
<para>Here is an example:</para>
<programlisting>memleak:file1.cpp