Skip to content

Commit 7176632

Browse files
committed
manual: Document suppressions
1 parent b596b0d commit 7176632

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

man/manual.docbook

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ Rule text
816816
these.</para>
817817

818818
<section>
819-
<title>Suppressing a certain error type</title>
819+
<title>Plain text suppressions</title>
820820

821821
<para>You can suppress certain types of errors. The format for such a
822822
suppression is one of:</para>
@@ -869,6 +869,25 @@ uninitvar</programlisting>
869869
</section>
870870
</section>
871871

872+
<section>
873+
<title>XML suppressions</title>
874+
875+
<para>You can specify suppressions in a XML file. Example file:</para>
876+
877+
<programlisting>&lt;?xml version="1.0"?&gt;
878+
&lt;suppressions&gt;
879+
&lt;suppression&gt;
880+
&lt;id&gt;uninitvar&lt;/id&gt;
881+
&lt;fileName&gt;src/file1.c&lt;/fileName&gt;
882+
&lt;lineNumber&gt;10&lt;/lineNumber&gt;
883+
&lt;symbolName&gt;var&lt;/symbolName&gt;
884+
&lt;/suppression&gt;
885+
&lt;/suppressions&gt;</programlisting>
886+
887+
<para>The xml format is extensible and may be extended with further
888+
attributes in the future.</para>
889+
</section>
890+
872891
<section>
873892
<title>Inline suppressions</title>
874893

@@ -902,6 +921,17 @@ Checking test.c...
902921
No error is reported when invoking cppcheck this way:</para>
903922

904923
<programlisting>cppcheck --inline-suppr test.c</programlisting>
924+
925+
<para>you can specify that the inline suppression only applies to a
926+
specific symbol:</para>
927+
928+
<programlisting>// cppcheck-suppress arrayIndexOutOfBounds symbolName=arr</programlisting>
929+
930+
<para> You can write comments for the suppress, however is recommended
931+
to use ; or // to specify where they start:</para>
932+
933+
<programlisting>// cppcheck-suppress arrayIndexOutOfBounds ; some comment
934+
// cppcheck-suppress arrayIndexOutOfBounds // some comment</programlisting>
905935
</section>
906936
</chapter>
907937

0 commit comments

Comments
 (0)