From abd536b84c5519742fa5cd003bf7fbd04e510138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=E4ki?= Date: Sat, 2 Feb 2013 15:46:29 +0100 Subject: [PATCH] Null pointer: Changed 'possible null pointer dereference - otherwise condition is redundant' to warning --- lib/checknullpointer.cpp | 10 +++++++--- test/testnullpointer.cpp | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/checknullpointer.cpp b/lib/checknullpointer.cpp index e1f6303c9..0a3beb70d 100644 --- a/lib/checknullpointer.cpp +++ b/lib/checknullpointer.cpp @@ -1104,9 +1104,13 @@ void CheckNullPointer::nullPointerByCheckAndDeRef() void CheckNullPointer::nullPointer() { nullPointerLinkedList(); - nullPointerStructByDeRefAndChec(); - nullPointerByDeRefAndChec(); - nullPointerByCheckAndDeRef(); + + if (_settings->isEnabled("warning")) { + nullPointerStructByDeRefAndChec(); + nullPointerByDeRefAndChec(); + nullPointerByCheckAndDeRef(); + } + nullPointerDefaultArgument(); } diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp index eb6384786..56ca6233b 100644 --- a/test/testnullpointer.cpp +++ b/test/testnullpointer.cpp @@ -81,7 +81,7 @@ private: errout.str(""); Settings settings; - settings.addEnabled("style"); + settings.addEnabled("warning"); settings.inconclusive = inconclusive; // Tokenize..