manual: Document suppressions
This commit is contained in:
parent
b596b0d549
commit
7176632bc6
|
@ -816,7 +816,7 @@ Rule text
|
||||||
these.</para>
|
these.</para>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<title>Suppressing a certain error type</title>
|
<title>Plain text suppressions</title>
|
||||||
|
|
||||||
<para>You can suppress certain types of errors. The format for such a
|
<para>You can suppress certain types of errors. The format for such a
|
||||||
suppression is one of:</para>
|
suppression is one of:</para>
|
||||||
|
@ -869,6 +869,25 @@ uninitvar</programlisting>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<title>XML suppressions</title>
|
||||||
|
|
||||||
|
<para>You can specify suppressions in a XML file. Example file:</para>
|
||||||
|
|
||||||
|
<programlisting><?xml version="1.0"?>
|
||||||
|
<suppressions>
|
||||||
|
<suppression>
|
||||||
|
<id>uninitvar</id>
|
||||||
|
<fileName>src/file1.c</fileName>
|
||||||
|
<lineNumber>10</lineNumber>
|
||||||
|
<symbolName>var</symbolName>
|
||||||
|
</suppression>
|
||||||
|
</suppressions></programlisting>
|
||||||
|
|
||||||
|
<para>The xml format is extensible and may be extended with further
|
||||||
|
attributes in the future.</para>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<title>Inline suppressions</title>
|
<title>Inline suppressions</title>
|
||||||
|
|
||||||
|
@ -902,6 +921,17 @@ Checking test.c...
|
||||||
No error is reported when invoking cppcheck this way:</para>
|
No error is reported when invoking cppcheck this way:</para>
|
||||||
|
|
||||||
<programlisting>cppcheck --inline-suppr test.c</programlisting>
|
<programlisting>cppcheck --inline-suppr test.c</programlisting>
|
||||||
|
|
||||||
|
<para>you can specify that the inline suppression only applies to a
|
||||||
|
specific symbol:</para>
|
||||||
|
|
||||||
|
<programlisting>// cppcheck-suppress arrayIndexOutOfBounds symbolName=arr</programlisting>
|
||||||
|
|
||||||
|
<para> You can write comments for the suppress, however is recommended
|
||||||
|
to use ; or // to specify where they start:</para>
|
||||||
|
|
||||||
|
<programlisting>// cppcheck-suppress arrayIndexOutOfBounds ; some comment
|
||||||
|
// cppcheck-suppress arrayIndexOutOfBounds // some comment</programlisting>
|
||||||
</section>
|
</section>
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue