diff --git a/man/manual.docbook b/man/manual.docbook
index 1d0cc089e..4b7bc6019 100644
--- a/man/manual.docbook
+++ b/man/manual.docbook
@@ -362,7 +362,7 @@ cppcheck -DA --force file.c
<errors>
<error id="someError" severity="error" msg="short error text"
verbose="long error text" inconclusive="true" cwe="312">
- <location file="file.c" line="1"/>
+ <location file0="file.c" file="file.h" line="1"/>
</error>
</errors>
</results>
@@ -448,6 +448,14 @@ cppcheck -DA --force file.c
+
+ file0
+
+
+ name of the source file (optional)
+
+
+
line
@@ -808,7 +816,7 @@ Checking pen1.c...
default="value". Specifying -1 as the argument
number is going to apply a check to all arguments of that function. The specifications
for individual arguments override this setting.
-
+
Uninitialized memory
@@ -826,16 +834,19 @@ Checking pen1.c...
Cppcheck assumes that it is fine to pass
uninitialized variables to functions:
- # cppcheck uninit.c
+ # cppcheck uninit.c
Checking uninit.c...
If you provide a configuration file then Cppcheck detects
the bug:
- # cppcheck --library=windows.cfg uninit.c
+ # cppcheck --library=windows.cfg uninit.c
Checking uninit.c...
[uninit.c:5]: (error) Uninitialized variable: buffer2
+ Note that this implies for pointers that the memory they point
+ at has to be initialized, too.
+
Here is the minimal windows.cfg:
<?xml version="1.0"?>
@@ -865,16 +876,20 @@ Checking uninit.c...
let's assume it's bad. Cppcheck assumes that it's ok to pass NULL to
functions so no error is reported:
- # cppcheck null.c
+ # cppcheck null.c
Checking null.c...
- If you provide a windows configuration file then
+ If you provide a configuration file then
Cppcheck detects the bug:
- cppcheck --library=windows.cfg null.c
+ cppcheck --library=windows.cfg null.c
Checking null.c...
[null.c:3]: (error) Null pointer dereference
+ Note that this implies <not-uninit> as
+ far as values are concerned. Uninitialized memory might still be passed
+ do the function.
+
Here is a minimal windows.cfg file:
<?xml version="1.0"?>
@@ -902,7 +917,7 @@ Checking null.c...
No error is reported for that:
- # cppcheck formatstring.c
+ # cppcheck formatstring.c
Checking formatstring.c...
A configuration file can be created that says that the string is a
@@ -918,7 +933,7 @@ Checking null.c...
</function>
</def>Now Cppcheck will report an error:
- cppcheck --library=test.cfg formatstring.c
+ cppcheck --library=test.cfg formatstring.c
Checking formatstring.c...
[formatstring.c:3]: (error) do_something format string requires 2 parameters but only 1 is given.
@@ -947,7 +962,7 @@ Checking formatstring.c...
No error is reported for that:
- # cppcheck valuerange.c
+ # cppcheck valuerange.c
Checking valuerange.c...
A configuration file can be created that says that 1024 is out of
@@ -962,7 +977,7 @@ Checking valuerange.c...
</function>
</def>Now Cppcheck will report an error:
- cppcheck --library=test.cfg range.c
+ cppcheck --library=test.cfg range.c
Checking range.c...
[range.c:3]: (error) Invalid do_something() argument nr 1. The value is 1024 but the valid values are '0-1023'.
@@ -990,7 +1005,7 @@ Checking range.c...
No error is reported for that:
- # cppcheck minsize.c
+ # cppcheck minsize.c
Checking minsize.c...
A configuration file can for instance be created that says that
@@ -1075,13 +1090,13 @@ Checking minsize.c...
In theory, if ZeroMemory terminates the program
then there is no bug. Cppcheck therefore reports no error:
- # cppcheck noreturn.c
+ # cppcheck noreturn.c
Checking noreturn.c...
However if you use --check-library and
--enable=information you'll get this:
- # cppcheck --check-library --enable=information noreturn.c
+ # cppcheck --check-library --enable=information noreturn.c
Checking noreturn.c...
[noreturn.c:7]: (information) --check-library: Function ZeroMemory() should have <noreturn> configuration
@@ -1089,7 +1104,7 @@ Checking noreturn.c...
If a proper windows.cfg is provided, the bug is
detected:
- # cppcheck --library=windows.cfg noreturn.c
+ # cppcheck --library=windows.cfg noreturn.c
Checking noreturn.c...
[noreturn.c:8]: (error) Uninitialized variable: data
@@ -1119,13 +1134,13 @@ Checking noreturn.c...
assigning the result to one of the parameters passed to it, nothing bad
would happen:
- # cppcheck useretval.c
+ # cppcheck useretval.c
Checking useretval.c...
If a proper lib.cfg is provided, the bug is
detected:
- # cppcheck --library=lib.cfg --enable=warning useretval.c
+ # cppcheck --library=lib.cfg --enable=warning useretval.c
Checking useretval.c...
[noreturn.c:3]: (warning) Return value of function strcmp() is not used.
@@ -1206,7 +1221,7 @@ Checking useretval.c...
No message about variable 'a' being unused is printed:
- # cppcheck --enable=style unusedvar.cpp
+ # cppcheck --enable=style unusedvar.cpp
Checking unusedvar.cpp...
If uint16_t is defined in a library as follows, the result
@@ -1221,7 +1236,7 @@ Checking unusedvar.cpp...
the "sign" attribute are "s" (signed) and "u" (unsigned). Both
attributes are optional. Using this library, cppcheck prints:
- # cppcheck --library=lib.cfg --enable=style unusedvar.cpp
+ # cppcheck --library=lib.cfg --enable=style unusedvar.cpp
Checking unusedvar.cpp...
[unusedvar.cpp:2]: (style) Unused variable: a