astyle formatting

[ci skip]
This commit is contained in:
Daniel Marjamäki 2020-05-23 07:30:22 +02:00
parent 5c3474ec5c
commit 4e2f8d5d48
3 changed files with 65 additions and 65 deletions

View File

@ -1153,11 +1153,11 @@ void CppCheck::executeRules(const std::string &tokenlist, const Tokenizer &token
if (pcreCompileErrorStr) {
const std::string msg = "pcre_compile failed: " + std::string(pcreCompileErrorStr);
const ErrorMessage errmsg(std::list<ErrorMessage::FileLocation>(),
emptyString,
Severity::error,
msg,
"pcre_compile",
false);
emptyString,
Severity::error,
msg,
"pcre_compile",
false);
reportErr(errmsg);
}
@ -1174,11 +1174,11 @@ void CppCheck::executeRules(const std::string &tokenlist, const Tokenizer &token
if (pcreStudyErrorStr) {
const std::string msg = "pcre_study failed: " + std::string(pcreStudyErrorStr);
const ErrorMessage errmsg(std::list<ErrorMessage::FileLocation>(),
emptyString,
Severity::error,
msg,
"pcre_study",
false);
emptyString,
Severity::error,
msg,
"pcre_study",
false);
reportErr(errmsg);
// 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);
if (!errorMessage.empty()) {
const ErrorMessage errmsg(std::list<ErrorMessage::FileLocation>(),
emptyString,
Severity::error,
std::string("pcre_exec failed: ") + errorMessage,
"pcre_exec",
false);
emptyString,
Severity::error,
std::string("pcre_exec failed: ") + errorMessage,
"pcre_exec",
false);
reportErr(errmsg);
}

View File

@ -20,45 +20,45 @@
std::string Severity::toString(Severity::SeverityType severity)
{
switch (severity) {
case none:
return "";
case error:
return "error";
case warning:
return "warning";
case style:
return "style";
case performance:
return "performance";
case portability:
return "portability";
case information:
return "information";
case debug:
return "debug";
}
throw InternalError(nullptr, "Unknown severity");
switch (severity) {
case none:
return "";
case error:
return "error";
case warning:
return "warning";
case style:
return "style";
case performance:
return "performance";
case portability:
return "portability";
case information:
return "information";
case debug:
return "debug";
}
throw InternalError(nullptr, "Unknown severity");
}
Severity::SeverityType Severity::fromString(const std::string& severity)
{
if (severity.empty())
return none;
if (severity == "none")
return none;
if (severity == "error")
return error;
if (severity == "warning")
return warning;
if (severity == "style")
return style;
if (severity == "performance")
return performance;
if (severity == "portability")
return portability;
if (severity == "information")
return information;
if (severity == "debug")
return debug;
return none;
if (severity.empty())
return none;
if (severity == "none")
return none;
if (severity == "error")
return error;
if (severity == "warning")
return warning;
if (severity == "style")
return style;
if (severity == "performance")
return performance;
if (severity == "portability")
return portability;
if (severity == "information")
return information;
if (severity == "debug")
return debug;
return none;
}

View File

@ -1424,12 +1424,12 @@ static void checkContract(Data &data, const Token *tok, const Function *function
const std::string functionName = contractIt->first;
const std::string functionExpects = contractIt->second;
ErrorMessage errmsg(callstack,
&data.tokenizer->list,
Severity::SeverityType::error,
id,
"Function '" + function->name() + "' is called, can not determine that its contract '" + functionExpects + "' is always met.",
CWE(0),
false);
&data.tokenizer->list,
Severity::SeverityType::error,
id,
"Function '" + function->name() + "' is called, can not determine that its contract '" + functionExpects + "' is always met.",
CWE(0),
false);
errmsg.incomplete = bailoutValue;
errmsg.function = functionName;
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 std::string functionExpects = contractIt->second;
ErrorMessage errmsg(callstack,
&data.tokenizer->list,
Severity::SeverityType::error,
id,
"Function '" + function->name() + "' is called, can not determine that its contract is always met.",
CWE(0),
false);
&data.tokenizer->list,
Severity::SeverityType::error,
id,
"Function '" + function->name() + "' is called, can not determine that its contract is always met.",
CWE(0),
false);
errmsg.incomplete = true;
data.errorLogger->reportErr(errmsg);
}