From d45021673e71bafeae113ecdeb7b10e6d20dd4f7 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Thu, 23 Jul 2015 14:39:40 +0200 Subject: [PATCH] Assign different IDs for different nullPointer messages (#6166) --- lib/checknullpointer.cpp | 4 ++-- lib/checknullpointer.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/checknullpointer.cpp b/lib/checknullpointer.cpp index 114807413..220913eb1 100644 --- a/lib/checknullpointer.cpp +++ b/lib/checknullpointer.cpp @@ -467,7 +467,7 @@ void CheckNullPointer::nullPointerError(const Token *tok, const std::string &var { if (defaultArg) { if (_settings->isEnabled("warning")) - reportError(tok, Severity::warning, "nullPointer", "Possible null pointer dereference if the default parameter value is used: " + varname, 0U, inconclusive); + reportError(tok, Severity::warning, "nullPointerDefaultArg", "Possible null pointer dereference if the default parameter value is used: " + varname, 0U, inconclusive); } else reportError(tok, Severity::error, "nullPointer", "Possible null pointer dereference: " + varname, 0U, inconclusive); } @@ -478,5 +478,5 @@ void CheckNullPointer::nullPointerError(const Token *tok, const std::string &var callstack.push_back(tok); callstack.push_back(nullCheck); const std::string errmsg("Possible null pointer dereference: " + varname + " - otherwise it is redundant to check it against null."); - reportError(callstack, Severity::warning, "nullPointer", errmsg, 0U, inconclusive); + reportError(callstack, Severity::warning, "nullPointerRedundantCheck", errmsg, 0U, inconclusive); } diff --git a/lib/checknullpointer.h b/lib/checknullpointer.h index 271c67db6..427e826f7 100644 --- a/lib/checknullpointer.h +++ b/lib/checknullpointer.h @@ -93,7 +93,9 @@ private: /** Get error messages. Used by --errorlist */ void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { CheckNullPointer c(0, settings, errorLogger); - c.nullPointerError(0, "pointer"); + c.nullPointerError(0); + c.nullPointerError(0, "pointer", false, true); + c.nullPointerError(0, "pointer", nullptr); } /** Name of check */