Clarify 'invalidFunctionArg' messages

This commit is contained in:
Daniel Marjamäki 2017-05-23 11:57:25 +02:00
parent f7cda81c0c
commit d3d3d31613
1 changed files with 14 additions and 6 deletions

View File

@ -133,12 +133,20 @@ void CheckFunctions::invalidFunctionArgError(const Token *tok, const std::string
errmsg << " The value is " << invalidValue->intvalue << " but the valid values are '" << validstr << "'.";
else
errmsg << " The value is 0 or 1 (boolean) but the valid values are '" << validstr << "'.";
reportError(tok,
(!invalidValue || !invalidValue->condition) ? Severity::error : Severity::warning,
"invalidFunctionArg",
errmsg.str(),
CWE628,
invalidValue && invalidValue->inconclusive);
if (invalidValue)
reportError(getErrorPath(tok, invalidValue, "Invalid argument"),
invalidValue->errorSeverity() ? Severity::error : Severity::warning,
"invalidFunctionArg",
errmsg.str(),
CWE628,
invalidValue->inconclusive);
else
reportError(tok,
Severity::error,
"invalidFunctionArg",
errmsg.str(),
CWE628,
false);
}
void CheckFunctions::invalidFunctionArgBoolError(const Token *tok, const std::string &functionName, int argnr)