parent
5c3474ec5c
commit
4e2f8d5d48
|
@ -1153,11 +1153,11 @@ void CppCheck::executeRules(const std::string &tokenlist, const Tokenizer &token
|
||||||
if (pcreCompileErrorStr) {
|
if (pcreCompileErrorStr) {
|
||||||
const std::string msg = "pcre_compile failed: " + std::string(pcreCompileErrorStr);
|
const std::string msg = "pcre_compile failed: " + std::string(pcreCompileErrorStr);
|
||||||
const ErrorMessage errmsg(std::list<ErrorMessage::FileLocation>(),
|
const ErrorMessage errmsg(std::list<ErrorMessage::FileLocation>(),
|
||||||
emptyString,
|
emptyString,
|
||||||
Severity::error,
|
Severity::error,
|
||||||
msg,
|
msg,
|
||||||
"pcre_compile",
|
"pcre_compile",
|
||||||
false);
|
false);
|
||||||
|
|
||||||
reportErr(errmsg);
|
reportErr(errmsg);
|
||||||
}
|
}
|
||||||
|
@ -1174,11 +1174,11 @@ void CppCheck::executeRules(const std::string &tokenlist, const Tokenizer &token
|
||||||
if (pcreStudyErrorStr) {
|
if (pcreStudyErrorStr) {
|
||||||
const std::string msg = "pcre_study failed: " + std::string(pcreStudyErrorStr);
|
const std::string msg = "pcre_study failed: " + std::string(pcreStudyErrorStr);
|
||||||
const ErrorMessage errmsg(std::list<ErrorMessage::FileLocation>(),
|
const ErrorMessage errmsg(std::list<ErrorMessage::FileLocation>(),
|
||||||
emptyString,
|
emptyString,
|
||||||
Severity::error,
|
Severity::error,
|
||||||
msg,
|
msg,
|
||||||
"pcre_study",
|
"pcre_study",
|
||||||
false);
|
false);
|
||||||
|
|
||||||
reportErr(errmsg);
|
reportErr(errmsg);
|
||||||
// pcre_compile() worked, but pcre_study() returned an error. Free the resources allocated by pcre_compile().
|
// pcre_compile() worked, but pcre_study() returned an error. Free the resources allocated by pcre_compile().
|
||||||
|
@ -1197,11 +1197,11 @@ void CppCheck::executeRules(const std::string &tokenlist, const Tokenizer &token
|
||||||
const std::string errorMessage = pcreErrorCodeToString(pcreExecRet);
|
const std::string errorMessage = pcreErrorCodeToString(pcreExecRet);
|
||||||
if (!errorMessage.empty()) {
|
if (!errorMessage.empty()) {
|
||||||
const ErrorMessage errmsg(std::list<ErrorMessage::FileLocation>(),
|
const ErrorMessage errmsg(std::list<ErrorMessage::FileLocation>(),
|
||||||
emptyString,
|
emptyString,
|
||||||
Severity::error,
|
Severity::error,
|
||||||
std::string("pcre_exec failed: ") + errorMessage,
|
std::string("pcre_exec failed: ") + errorMessage,
|
||||||
"pcre_exec",
|
"pcre_exec",
|
||||||
false);
|
false);
|
||||||
|
|
||||||
reportErr(errmsg);
|
reportErr(errmsg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,45 +20,45 @@
|
||||||
|
|
||||||
std::string Severity::toString(Severity::SeverityType severity)
|
std::string Severity::toString(Severity::SeverityType severity)
|
||||||
{
|
{
|
||||||
switch (severity) {
|
switch (severity) {
|
||||||
case none:
|
case none:
|
||||||
return "";
|
return "";
|
||||||
case error:
|
case error:
|
||||||
return "error";
|
return "error";
|
||||||
case warning:
|
case warning:
|
||||||
return "warning";
|
return "warning";
|
||||||
case style:
|
case style:
|
||||||
return "style";
|
return "style";
|
||||||
case performance:
|
case performance:
|
||||||
return "performance";
|
return "performance";
|
||||||
case portability:
|
case portability:
|
||||||
return "portability";
|
return "portability";
|
||||||
case information:
|
case information:
|
||||||
return "information";
|
return "information";
|
||||||
case debug:
|
case debug:
|
||||||
return "debug";
|
return "debug";
|
||||||
}
|
}
|
||||||
throw InternalError(nullptr, "Unknown severity");
|
throw InternalError(nullptr, "Unknown severity");
|
||||||
}
|
}
|
||||||
Severity::SeverityType Severity::fromString(const std::string& severity)
|
Severity::SeverityType Severity::fromString(const std::string& severity)
|
||||||
{
|
{
|
||||||
if (severity.empty())
|
if (severity.empty())
|
||||||
return none;
|
return none;
|
||||||
if (severity == "none")
|
if (severity == "none")
|
||||||
return none;
|
return none;
|
||||||
if (severity == "error")
|
if (severity == "error")
|
||||||
return error;
|
return error;
|
||||||
if (severity == "warning")
|
if (severity == "warning")
|
||||||
return warning;
|
return warning;
|
||||||
if (severity == "style")
|
if (severity == "style")
|
||||||
return style;
|
return style;
|
||||||
if (severity == "performance")
|
if (severity == "performance")
|
||||||
return performance;
|
return performance;
|
||||||
if (severity == "portability")
|
if (severity == "portability")
|
||||||
return portability;
|
return portability;
|
||||||
if (severity == "information")
|
if (severity == "information")
|
||||||
return information;
|
return information;
|
||||||
if (severity == "debug")
|
if (severity == "debug")
|
||||||
return debug;
|
return debug;
|
||||||
return none;
|
return none;
|
||||||
}
|
}
|
|
@ -1424,12 +1424,12 @@ static void checkContract(Data &data, const Token *tok, const Function *function
|
||||||
const std::string functionName = contractIt->first;
|
const std::string functionName = contractIt->first;
|
||||||
const std::string functionExpects = contractIt->second;
|
const std::string functionExpects = contractIt->second;
|
||||||
ErrorMessage errmsg(callstack,
|
ErrorMessage errmsg(callstack,
|
||||||
&data.tokenizer->list,
|
&data.tokenizer->list,
|
||||||
Severity::SeverityType::error,
|
Severity::SeverityType::error,
|
||||||
id,
|
id,
|
||||||
"Function '" + function->name() + "' is called, can not determine that its contract '" + functionExpects + "' is always met.",
|
"Function '" + function->name() + "' is called, can not determine that its contract '" + functionExpects + "' is always met.",
|
||||||
CWE(0),
|
CWE(0),
|
||||||
false);
|
false);
|
||||||
errmsg.incomplete = bailoutValue;
|
errmsg.incomplete = bailoutValue;
|
||||||
errmsg.function = functionName;
|
errmsg.function = functionName;
|
||||||
data.errorLogger->reportErr(errmsg);
|
data.errorLogger->reportErr(errmsg);
|
||||||
|
@ -1442,12 +1442,12 @@ static void checkContract(Data &data, const Token *tok, const Function *function
|
||||||
const auto contractIt = data.settings->functionContracts.find(function->fullName());
|
const auto contractIt = data.settings->functionContracts.find(function->fullName());
|
||||||
const std::string functionExpects = contractIt->second;
|
const std::string functionExpects = contractIt->second;
|
||||||
ErrorMessage errmsg(callstack,
|
ErrorMessage errmsg(callstack,
|
||||||
&data.tokenizer->list,
|
&data.tokenizer->list,
|
||||||
Severity::SeverityType::error,
|
Severity::SeverityType::error,
|
||||||
id,
|
id,
|
||||||
"Function '" + function->name() + "' is called, can not determine that its contract is always met.",
|
"Function '" + function->name() + "' is called, can not determine that its contract is always met.",
|
||||||
CWE(0),
|
CWE(0),
|
||||||
false);
|
false);
|
||||||
errmsg.incomplete = true;
|
errmsg.incomplete = true;
|
||||||
data.errorLogger->reportErr(errmsg);
|
data.errorLogger->reportErr(errmsg);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue