diff --git a/man/manual.docbook b/man/manual.docbook index d20d3898d..d73794c84 100644 --- a/man/manual.docbook +++ b/man/manual.docbook @@ -3,9 +3,9 @@ "/usr/share/xml/docbook/schema/dtd/4.4/docbookx.dtd"> - Cppcheck + Cppcheck 1.39 - 2009-11-16 + 2009-12-04 @@ -16,7 +16,7 @@ only detects the types of bugs that the compilers normally fail to detect. The goal is no false positives. - Supported platforms: + Supported code and platforms: @@ -25,15 +25,27 @@ - Cppcheck is supposed to be compilable by any C++ compiler that - handles the latest C++ standard. + Cppcheck should be compilable by any C++ compiler that handles + the latest C++ standard. - Cppcheck is supposed to work on any platform that has sufficient - cpu and memory. + Cppcheck should work on any platform that has sufficient cpu and + memory. + + Accuracy + + Please understand that there are limits of Cppcheck. Cppcheck is + rarely wrong about reported errors. But there are many bugs that it + doesn't detect. + + You will find more bugs in your software by testing your software + carefully, than by using Cppcheck. You will find more bugs in your + software by instrumenting your software, than by using Cppcheck. But + Cppcheck can still detect some of the bugs that you miss when testing and + instrumenting your software. @@ -84,12 +96,12 @@ Checking path/file2.cpp... By default, an error is only reported when Cppcheck is sure there is an - error. When --all is given issues will also be - reported when Cppcheck is unsure. + error. When --enable=possibleError is given issues + will also be reported when Cppcheck is unsure. - The --all flag is useful but makes - Cppcheck more unreliable, you will probably get false - positives. + The --enable=possibleError flag is useful but + makes Cppcheck more unreliable, you will probably get + false positives. Here is a simple code example: @@ -100,7 +112,7 @@ Checking path/file2.cpp... Execute this command: - cppcheck --all file1.cpp + cppcheck --enable=possibleError file1.cpp The output from Cppcheck: @@ -129,7 +141,7 @@ Checking path/file2.cpp... To enable stylistic checks, use the --style flag: - cppcheck --style file1.c + cppcheck --enable=style file1.c The reported error is: @@ -156,6 +168,15 @@ Checking path/file2.cpp... cppcheck --enable=unusedFunctions path +
+ Enable all checks + + To enable all checks your can use the + --enable=all flag: + + cppcheck --enable=all path +
+
Multithreaded checking @@ -320,7 +341,7 @@ uninitvar If you execute: - cppcheck --all file1.cpp + cppcheck --enable=possibleError file1.cpp The result will be: @@ -338,7 +359,7 @@ QPushButton Then execute cppcheck with the --auto-dealloc option: - cppcheck --auto-dealloc qt.lst --all file1.cpp + cppcheck --auto-dealloc qt.lst --enable=possibleError file1.cpp
@@ -359,7 +380,7 @@ QPushButton If you analyse that with Cppcheck it won't find any leaks: - cppcheck --all fred1.cpp + cppcheck --enable=possibleError fred1.cpp You can add some custom leaks checking by providing simple implementations for the allocation and deallocation functions. Write @@ -408,7 +429,7 @@ void DestroyFred(void *p) To enable the exception safety checking you can use --enable: - cppcheck --enable=exceptNew,exceptRealloc fred.cpp + cppcheck --enable=exceptNew --enable=exceptRealloc fred.cpp The output will be: @@ -431,11 +452,10 @@ int a(int sz) Check that with Cppcheck: - cppcheck --enable=exceptNew,exceptRealloc except2.cpp + cppcheck --enable=exceptNew --enable=exceptRealloc except2.cpp The output from Cppcheck is: - [except2.cpp:7]: (error) Throwing exception in invalid state, p points -at deallocated memory + [except2.cpp:7]: (error) Throwing exception in invalid state, p points at deallocated memory