From af49d4ba87a0c3b2d35a549883901cde3bb22219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 10 Apr 2010 15:00:01 +0200 Subject: [PATCH] manual: removed information about possible errors. The inconclusive checks have been disabled. Removed section about --auto-dealloc.. this section is not relevant at the moment. --- man/manual.docbook | 71 +--------------------------------------------- 1 file changed, 1 insertion(+), 70 deletions(-) diff --git a/man/manual.docbook b/man/manual.docbook index 940d2a4c8..c542fcfc8 100644 --- a/man/manual.docbook +++ b/man/manual.docbook @@ -91,37 +91,6 @@ Checking path/file2.cpp... 2/2 files checked 100% done -
- Possible errors - - By default, an error is only reported when - Cppcheck is sure there is an - error. When --enable=possibleError is given issues - will also be reported when Cppcheck is unsure. - - The --enable=possibleError flag is useful but - makes Cppcheck more unreliable, you will probably get - false positives. - - Here is a simple code example: - - void f() -{ - Fred *f = new Fred; -} - - Execute this command: - - cppcheck --enable=possibleError file1.cpp - - The output from Cppcheck: - - [file1.cpp:4]: (possible error) Memory leak: fred - - The "possible" means that the reported message may be wrong (if - Fred has automatic deallocation it is not a memory leak). -
-
Stylistic issues @@ -322,45 +291,7 @@ uninitvar Looking for memory leaks and resource leaks is a key feature of Cppcheck. Cppcheck can detect many common mistakes by default. But through - some tweaking you can both increase the capabilities and also reduce the - amount of false positives. - -
- Automatic deallocation - - A common cause of false positives is when there is automatic - deallocation. Here is an example: - - void Form1::foo() -{ - QPushButton *pb = new QPushButton("OK", this); -} - - Cppcheck can't see where the deallocation is when you have such - code. - - If you execute: - - cppcheck --enable=possibleError file1.cpp - - The result will be: - - [file1.cpp:4]: (possible error) Memory leak: pb - - The "possible" in the error message means that the message may be - a false positive. - - To avoid such false positives, create a textfile and write the - names of the automaticly deallocated classes. - - QLabel -QPushButton - - Then execute cppcheck with the --auto-dealloc - option: - - cppcheck --auto-dealloc qt.lst --enable=possibleError file1.cpp -
+ some tweaking you can improve the checking.
Userdefined allocation/deallocation functions