From 493cfa5df2c908e8719dbf263e65ed54382d1c9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 2 Aug 2011 17:20:13 +0200 Subject: [PATCH] Null pointer: Added todo test case to better handle dereference in condition --- test/testnullpointer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp index a747bddaa..0e6e6b1a6 100644 --- a/test/testnullpointer.cpp +++ b/test/testnullpointer.cpp @@ -429,6 +429,13 @@ private: "}\n"); ASSERT_EQUALS("[test.cpp:3]: (error) Possible null pointer dereference: p - otherwise it is redundant to check if p is null at line 4\n", errout.str()); + check("void foo(char *p)\n" + "{\n" + " if (*p == 0) { }\n" + " if (!p) { }\n" + "}\n"); + TODO_ASSERT_EQUALS("[test.cpp:3]: (error) Possible null pointer dereference: p - otherwise it is redundant to check if p is null at line 4\n", "", errout.str()); + // no error check("void foo()\n" "{\n"