add documentation for --suppress= option
This commit is contained in:
parent
22210e0255
commit
ec4e0c8bf5
|
@ -671,11 +671,12 @@ void CmdLineParser::PrintHelp()
|
||||||
" --rule-file=<file> Use given rule file. For more information, see: \n"
|
" --rule-file=<file> Use given rule file. For more information, see: \n"
|
||||||
" https://sourceforge.net/projects/cppcheck/files/Articles/\n"
|
" https://sourceforge.net/projects/cppcheck/files/Articles/\n"
|
||||||
" -s, --style Deprecated, use --enable=style\n"
|
" -s, --style Deprecated, use --enable=style\n"
|
||||||
" --suppressions-list=<file>\n"
|
" --suppress=<spec> Suppress a specific warning. The format of <spec> is:\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"
|
|
||||||
" [error id]:[filename]:[line]\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"
|
" --template '<text>' Format the error messages. E.g.\n"
|
||||||
" '{file}:{line},{severity},{id},{message}' or\n"
|
" '{file}:{line},{severity},{id},{message}' or\n"
|
||||||
" '{file}({line}):({severity}) {message}'\n"
|
" '{file}({line}):({severity}) {message}'\n"
|
||||||
|
|
|
@ -120,6 +120,7 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/
|
||||||
<arg choice="opt"><option>--rule=<rule></option></arg>
|
<arg choice="opt"><option>--rule=<rule></option></arg>
|
||||||
<arg choice="opt"><option>--rule-file=<file></option></arg>
|
<arg choice="opt"><option>--rule-file=<file></option></arg>
|
||||||
<arg choice="opt"><option>--style</option></arg>
|
<arg choice="opt"><option>--style</option></arg>
|
||||||
|
<arg choice="opt"><option>--suppress=<spec></option></arg>
|
||||||
<arg choice="opt"><option>--suppressions-list=<file></option></arg>
|
<arg choice="opt"><option>--suppressions-list=<file></option></arg>
|
||||||
<arg choice="opt"><option>--template '<text>'</option></arg>
|
<arg choice="opt"><option>--template '<text>'</option></arg>
|
||||||
<arg choice="opt"><option>--verbose</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>
|
<para>Deprecated, use --enable=style</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>--suppress=<spec></option></term>
|
||||||
|
<listitem>
|
||||||
|
<para>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 ?.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>--suppressions-list=<file></option></term>
|
<term><option>--suppressions-list=<file></option></term>
|
||||||
<listitem>
|
<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].
|
<para>Suppress warnings listed in the file.
|
||||||
You can use --template or --xml to see the error id.
|
Each suppression is in the format of <spec> above.</para>
|
||||||
The filename may contain the wildcard characters * or ?.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
|
|
@ -374,7 +374,8 @@ gui/test.cpp,16,error,mismatchAllocDealloc,Mismatching allocation and deallocati
|
||||||
<title>Suppressions</title>
|
<title>Suppressions</title>
|
||||||
|
|
||||||
<para>If you want to filter out certain errors you can suppress these.
|
<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]
|
<programlisting>[error id]:[filename]:[line]
|
||||||
[error id]:[filename2]
|
[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
|
* or ?, which match any sequence of characters or any single character
|
||||||
respectively.</para>
|
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>
|
<para>Here is an example:</para>
|
||||||
|
|
||||||
<programlisting>memleak:file1.cpp
|
<programlisting>memleak:file1.cpp
|
||||||
|
|
Loading…
Reference in New Issue