Assign different IDs for different nullPointer messages (#6166)
This commit is contained in:
parent
0b81a267f4
commit
d45021673e
|
@ -467,7 +467,7 @@ void CheckNullPointer::nullPointerError(const Token *tok, const std::string &var
|
||||||
{
|
{
|
||||||
if (defaultArg) {
|
if (defaultArg) {
|
||||||
if (_settings->isEnabled("warning"))
|
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
|
} else
|
||||||
reportError(tok, Severity::error, "nullPointer", "Possible null pointer dereference: " + varname, 0U, inconclusive);
|
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(tok);
|
||||||
callstack.push_back(nullCheck);
|
callstack.push_back(nullCheck);
|
||||||
const std::string errmsg("Possible null pointer dereference: " + varname + " - otherwise it is redundant to check it against null.");
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,9 @@ private:
|
||||||
/** Get error messages. Used by --errorlist */
|
/** Get error messages. Used by --errorlist */
|
||||||
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const {
|
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const {
|
||||||
CheckNullPointer c(0, settings, errorLogger);
|
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 */
|
/** Name of check */
|
||||||
|
|
Loading…
Reference in New Issue