Manual: Described file0 attribute in XML output and the relationship between <not-null/> and <not-uninit/>

This commit is contained in:
PKEuS 2016-07-27 15:50:04 +02:00
parent e2a04c508c
commit dec839ea79
1 changed files with 34 additions and 19 deletions

View File

@ -362,7 +362,7 @@ cppcheck -DA --force file.c</programlisting>
&lt;errors&gt;
&lt;error id="someError" severity="error" msg="short error text"
verbose="long error text" inconclusive="true" cwe="312"&gt;
&lt;location file="file.c" line="1"/&gt;
&lt;location file0="file.c" file="file.h" line="1"/&gt;
&lt;/error&gt;
&lt;/errors&gt;
&lt;/results&gt;</programlisting>
@ -448,6 +448,14 @@ cppcheck -DA --force file.c</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term><sgmltag class="attribute">file0</sgmltag></term>
<listitem>
<para>name of the source file (optional)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><sgmltag class="attribute">line</sgmltag></term>
@ -836,6 +844,9 @@ Checking uninit.c...</programlisting>
Checking uninit.c...
[uninit.c:5]: (error) Uninitialized variable: buffer2</programlisting>
<para>Note that this implies for pointers that the memory they point
at has to be initialized, too.</para>
<para>Here is the minimal <literal>windows.cfg</literal>:</para>
<para><programlisting>&lt;?xml version="1.0"?&gt;
@ -868,13 +879,17 @@ Checking uninit.c...
<programlisting># cppcheck null.c
Checking null.c...</programlisting>
<para>If you provide a windows configuration file then
<para>If you provide a configuration file then
<literal>Cppcheck</literal> detects the bug:</para>
<programlisting>cppcheck --library=windows.cfg null.c
Checking null.c...
[null.c:3]: (error) Null pointer dereference</programlisting>
<para>Note that this implies <literal>&lt;not-uninit&gt;</literal> as
far as values are concerned. Uninitialized memory might still be passed
do the function.</para>
<para>Here is a minimal <literal>windows.cfg</literal> file:</para>
<programlisting>&lt;?xml version="1.0"?&gt;