Cppcheck: change severity from information to error for internalError (#5133)

This commit is contained in:
Daniel Marjamäki 2023-06-08 23:31:36 +02:00 committed by GitHub
parent 3630ba9a3d
commit b086873599
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 22 deletions

View File

@ -960,14 +960,11 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
} catch (const InternalError &e) { } catch (const InternalError &e) {
std::list<ErrorMessage::FileLocation> locationList; std::list<ErrorMessage::FileLocation> locationList;
if (e.token) { if (e.token) {
ErrorMessage::FileLocation loc(e.token, &tokenizer.list); locationList.emplace_back(e.token, &tokenizer.list);
locationList.push_back(std::move(loc));
} else { } else {
ErrorMessage::FileLocation loc2(filename, 0, 0); locationList.emplace_back(filename, 0, 0);
locationList.push_back(std::move(loc2));
if (filename != tokenizer.list.getSourceFilePath()) { if (filename != tokenizer.list.getSourceFilePath()) {
ErrorMessage::FileLocation loc(tokenizer.list.getSourceFilePath(), 0, 0); locationList.emplace_back(tokenizer.list.getSourceFilePath(), 0, 0);
locationList.push_back(std::move(loc));
} }
} }
ErrorMessage errmsg(std::move(locationList), ErrorMessage errmsg(std::move(locationList),
@ -1038,25 +1035,19 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
void CppCheck::internalError(const std::string &filename, const std::string &msg) void CppCheck::internalError(const std::string &filename, const std::string &msg)
{ {
const std::string fixedpath = Path::toNativeSeparators(filename); const std::string fullmsg("Bailing out from checking since there was an internal error: " + msg);
const std::string fullmsg("Bailing out from checking " + fixedpath + " since there was an internal error: " + msg);
if (mSettings.severity.isEnabled(Severity::information)) { const ErrorMessage::FileLocation loc1(filename, 0, 0);
const ErrorMessage::FileLocation loc1(filename, 0, 0); std::list<ErrorMessage::FileLocation> callstack(1, loc1);
std::list<ErrorMessage::FileLocation> callstack(1, loc1);
ErrorMessage errmsg(callstack, ErrorMessage errmsg(callstack,
emptyString, emptyString,
Severity::information, Severity::error,
fullmsg, fullmsg,
"internalError", "internalError",
Certainty::normal); Certainty::normal);
mErrorLogger.reportErr(errmsg); mErrorLogger.reportErr(errmsg);
} else {
// Report on stdout
mErrorLogger.reportOut(fullmsg);
}
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------