diff --git a/cli/processexecutor.cpp b/cli/processexecutor.cpp index b839e179750..da3cbb09712 100644 --- a/cli/processexecutor.cpp +++ b/cli/processexecutor.cpp @@ -463,8 +463,8 @@ void ProcessExecutor::reportInternalChildErr(const std::string &childname, const const ErrorMessage errmsg(std::move(locations), "", Severity::error, - "Internal error: " + msg, "cppcheckError", + "Internal error: " + msg, Certainty::normal); if (!mSuppressions.nomsg.isSuppressed(errmsg, {})) diff --git a/gui/checkthread.cpp b/gui/checkthread.cpp index 6c83d0006a8..4f0ad5913dd 100644 --- a/gui/checkthread.cpp +++ b/gui/checkthread.cpp @@ -426,7 +426,7 @@ void CheckThread::parseClangErrors(const QString &tool, const QString &file0, QS const std::string f0 = file0.toStdString(); const std::string msg = e.message.toStdString(); const std::string id = e.errorId.toStdString(); - ErrorMessage errmsg(std::move(callstack), f0, e.severity, msg, id, Certainty::normal); + ErrorMessage errmsg(std::move(callstack), f0, e.severity, id, msg, Certainty::normal); mResult.reportErr(errmsg); } } diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index a43d5b26ee8..4c82397023e 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -1045,8 +1045,8 @@ bool CheckBufferOverrun::analyseWholeProgram1(const std::mapfile0, Severity::error, + "ctuOneDefinitionRuleViolation", "$symbol:" + nameLoc.className + "\nThe one definition rule is violated, different classes/structs have the same name '$symbol'", - "ctuOneDefinitionRuleViolation", CWE_ONE_DEFINITION_RULE, Certainty::normal); errorLogger.reportErr(errmsg); diff --git a/lib/checknullpointer.cpp b/lib/checknullpointer.cpp index 0214eceedd1..92c83ee27a4 100644 --- a/lib/checknullpointer.cpp +++ b/lib/checknullpointer.cpp @@ -693,8 +693,8 @@ bool CheckNullPointer::analyseWholeProgram(const CTU::FileInfo &ctu, const std:: ErrorMessage errmsg(std::move(locationList), fi->file0, warning ? Severity::warning : Severity::error, - message, std::move(id), + message, CWE_NULL_POINTER_DEREFERENCE, Certainty::normal); errorLogger.reportErr(errmsg); diff --git a/lib/checkuninitvar.cpp b/lib/checkuninitvar.cpp index d0217f9c075..374d9b999c5 100644 --- a/lib/checkuninitvar.cpp +++ b/lib/checkuninitvar.cpp @@ -1789,8 +1789,8 @@ bool CheckUninitVar::analyseWholeProgram(const CTU::FileInfo &ctu, const std::li const ErrorMessage errmsg(std::move(locationList), fi->file0, Severity::error, - "Using argument " + unsafeUsage.myArgumentName + " that points at uninitialized variable " + functionCall->callArgumentExpression, "ctuuninitvar", + "Using argument " + unsafeUsage.myArgumentName + " that points at uninitialized variable " + functionCall->callArgumentExpression, CWE_USE_OF_UNINITIALIZED_VARIABLE, Certainty::normal); errorLogger.reportErr(errmsg); diff --git a/lib/checkunusedfunctions.cpp b/lib/checkunusedfunctions.cpp index 55547b8e2d3..6c7c2ba0ee3 100644 --- a/lib/checkunusedfunctions.cpp +++ b/lib/checkunusedfunctions.cpp @@ -351,7 +351,7 @@ void CheckUnusedFunctions::staticFunctionError(ErrorLogger& errorLogger, locationList.back().fileIndex = fileIndex; } - const ErrorMessage errmsg(std::move(locationList), "", Severity::style, "$symbol:" + funcname + "\nThe function '$symbol' should have static linkage since it is not used outside of its translation unit.", "staticFunction", Certainty::normal); + const ErrorMessage errmsg(std::move(locationList), "", Severity::style, "staticFunction", "$symbol:" + funcname + "\nThe function '$symbol' should have static linkage since it is not used outside of its translation unit.", Certainty::normal); errorLogger.reportErr(errmsg); } @@ -413,7 +413,7 @@ void CheckUnusedFunctions::unusedFunctionError(ErrorLogger& errorLogger, locationList.back().fileIndex = fileIndex; } - const ErrorMessage errmsg(std::move(locationList), "", Severity::style, "$symbol:" + funcname + "\nThe function '$symbol' is never used.", "unusedFunction", CWE561, Certainty::normal); + const ErrorMessage errmsg(std::move(locationList), "", Severity::style, "unusedFunction", "$symbol:" + funcname + "\nThe function '$symbol' is never used.", CWE561, Certainty::normal); errorLogger.reportErr(errmsg); } diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index ad46f2651cd..4c3721e6e05 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -598,8 +598,8 @@ static bool reportClangErrors(std::istream &is, const std::functionexitcode(); @@ -1243,8 +1243,8 @@ unsigned int CppCheck::checkFile(const FileWithDetails& file, const std::string ErrorMessage errmsg({std::move(loc1)}, file.spath(), Severity::error, - o.msg, "preprocessorErrorDirective", + o.msg, Certainty::normal); mErrorLogger.reportErr(errmsg); } @@ -1273,8 +1273,8 @@ unsigned int CppCheck::checkFile(const FileWithDetails& file, const std::string ErrorMessage errmsg({std::move(loc)}, std::move(locFile), Severity::information, - msg, "noValidConfiguration", + msg, Certainty::normal); mErrorLogger.reportErr(errmsg); } @@ -1335,8 +1335,8 @@ void CppCheck::internalError(const std::string &filename, const std::string &msg ErrorMessage errmsg({std::move(loc1)}, "", Severity::error, - fullmsg, "internalError", + fullmsg, Certainty::normal); mErrorLogger.reportErr(errmsg); @@ -1370,8 +1370,8 @@ void CppCheck::checkNormalTokens(const Tokenizer &tokenizer, AnalyzerInformation ErrorMessage errmsg({std::move(loc)}, "", Severity::debug, - "Checks maximum time exceeded", "checksMaxTime", + "Checks maximum time exceeded", Certainty::normal); mErrorLogger.reportErr(errmsg); } @@ -1601,8 +1601,8 @@ void CppCheck::executeRules(const std::string &tokenlist, const TokenList &list) const ErrorMessage errmsg({}, "", Severity::error, - msg, "pcre_compile", + msg, Certainty::normal); mErrorLogger.reportErr(errmsg); @@ -1622,8 +1622,8 @@ void CppCheck::executeRules(const std::string &tokenlist, const TokenList &list) const ErrorMessage errmsg({}, "", Severity::error, - msg, "pcre_study", + msg, Certainty::normal); mErrorLogger.reportErr(errmsg); @@ -1645,8 +1645,8 @@ void CppCheck::executeRules(const std::string &tokenlist, const TokenList &list) const ErrorMessage errmsg({}, "", Severity::error, - std::string("pcre_exec failed: ") + errorMessage, "pcre_exec", + std::string("pcre_exec failed: ") + errorMessage, Certainty::normal); mErrorLogger.reportErr(errmsg); @@ -1681,8 +1681,8 @@ void CppCheck::executeRules(const std::string &tokenlist, const TokenList &list) const ErrorMessage errmsg({std::move(loc)}, list.getSourceFilePath(), rule.severity, - !rule.summary.empty() ? rule.summary : "found '" + str.substr(pos1, pos2 - pos1) + "'", rule.id, + !rule.summary.empty() ? rule.summary : "found '" + str.substr(pos1, pos2 - pos1) + "'", Certainty::normal); // Report error @@ -1890,8 +1890,9 @@ void CppCheck::tooManyConfigsError(const std::string &file, const int numberOfCo ErrorMessage errmsg(std::move(loclist), "", Severity::information, + "toomanyconfigs", msg.str(), - "toomanyconfigs", CWE398, + CWE398, Certainty::normal); mErrorLogger.reportErr(errmsg); @@ -1912,8 +1913,8 @@ void CppCheck::purgedConfigurationMessage(const std::string &file, const std::st ErrorMessage errmsg(std::move(loclist), "", Severity::information, - "The configuration '" + configuration + "' was not checked because its code equals another one.", "purgedConfiguration", + "The configuration '" + configuration + "' was not checked because its code equals another one.", Certainty::normal); mErrorLogger.reportErr(errmsg); diff --git a/lib/errorlogger.cpp b/lib/errorlogger.cpp index 9fe160364e9..5a35ad79c31 100644 --- a/lib/errorlogger.cpp +++ b/lib/errorlogger.cpp @@ -60,8 +60,7 @@ ErrorMessage::ErrorMessage() : severity(Severity::none), cwe(0U), certainty(Certainty::normal), hash(0) {} -// TODO: id and msg are swapped compared to other calls -ErrorMessage::ErrorMessage(std::list callStack, std::string file1, Severity severity, const std::string &msg, std::string id, Certainty certainty) : +ErrorMessage::ErrorMessage(std::list callStack, std::string file1, Severity severity, std::string id, const std::string &msg, Certainty certainty) : callStack(std::move(callStack)), // locations for this error message id(std::move(id)), // set the message id file0(std::move(file1)), @@ -74,9 +73,7 @@ ErrorMessage::ErrorMessage(std::list callStack, std::string file1, setmsg(msg); } - -// TODO: id and msg are swapped compared to other calls -ErrorMessage::ErrorMessage(std::list callStack, std::string file1, Severity severity, const std::string &msg, std::string id, const CWE &cwe, Certainty certainty) : +ErrorMessage::ErrorMessage(std::list callStack, std::string file1, Severity severity, std::string id, const std::string &msg,const CWE &cwe, Certainty certainty) : callStack(std::move(callStack)), // locations for this error message id(std::move(id)), // set the message id file0(std::move(file1)), @@ -262,8 +259,8 @@ ErrorMessage ErrorMessage::fromInternalError(const InternalError &internalError, ErrorMessage errmsg(std::move(locationList), tokenList ? tokenList->getSourceFilePath() : filename, Severity::error, - (msg.empty() ? "" : (msg + ": ")) + internalError.errorMessage, internalError.id, + (msg.empty() ? "" : (msg + ": ")) + internalError.errorMessage, Certainty::normal); // TODO: find a better way if (!internalError.details.empty()) diff --git a/lib/errorlogger.h b/lib/errorlogger.h index 5101f765fad..54fd4b7c744 100644 --- a/lib/errorlogger.h +++ b/lib/errorlogger.h @@ -103,13 +103,14 @@ class CPPCHECKLIB ErrorMessage { ErrorMessage(std::list callStack, std::string file1, Severity severity, + std::string id, const std::string &msg, - std::string id, Certainty certainty); + Certainty certainty); ErrorMessage(std::list callStack, std::string file1, Severity severity, - const std::string &msg, std::string id, + const std::string &msg, const CWE &cwe, Certainty certainty); ErrorMessage(const std::list& callstack, diff --git a/lib/forwardanalyzer.cpp b/lib/forwardanalyzer.cpp index ebdfc70a50d..0376f3285f6 100644 --- a/lib/forwardanalyzer.cpp +++ b/lib/forwardanalyzer.cpp @@ -872,7 +872,7 @@ namespace { void reportError(Severity severity, const std::string& id, const std::string& msg) { ErrorMessage::FileLocation loc(tokenList.getSourceFilePath(), 0, 0); - const ErrorMessage errmsg({std::move(loc)}, tokenList.getSourceFilePath(), severity, msg, id, Certainty::normal); + const ErrorMessage errmsg({std::move(loc)}, tokenList.getSourceFilePath(), severity, id, msg, Certainty::normal); errorLogger.reportErr(errmsg); } diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index f7ccc9c0dc5..f12bb0db162 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -902,8 +902,8 @@ void Preprocessor::error(const std::string &filename, unsigned int linenr, const mErrorLogger.reportErr(ErrorMessage(std::move(locationList), mFile0, Severity::error, - msg, "preprocessorErrorDirective", + msg, Certainty::normal)); } @@ -918,10 +918,10 @@ void Preprocessor::missingInclude(const std::string &filename, unsigned int line locationList.emplace_back(filename, linenr, 0); } ErrorMessage errmsg(std::move(locationList), mFile0, Severity::information, + (headerType==SystemHeader) ? "missingIncludeSystem" : "missingInclude", (headerType==SystemHeader) ? "Include file: <" + header + "> not found. Please note: Cppcheck does not need standard library headers to get proper results." : "Include file: \"" + header + "\" not found.", - (headerType==SystemHeader) ? "missingIncludeSystem" : "missingInclude", Certainty::normal); mErrorLogger.reportErr(errmsg); } diff --git a/lib/suppressions.cpp b/lib/suppressions.cpp index a7c30580700..710ae13a6b2 100644 --- a/lib/suppressions.cpp +++ b/lib/suppressions.cpp @@ -687,7 +687,7 @@ bool SuppressionList::reportUnmatchedSuppressions(const std::list callStack; if (!s.fileName.empty()) callStack.emplace_back(s.fileName, s.lineNumber, 0); - errorLogger.reportErr(::ErrorMessage(std::move(callStack), "", Severity::information, "Unmatched suppression: " + s.errorId, "unmatchedSuppression", Certainty::normal)); + errorLogger.reportErr(::ErrorMessage(std::move(callStack), "", Severity::information, "unmatchedSuppression", "Unmatched suppression: " + s.errorId, Certainty::normal)); err = true; } return err; diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index 18cec14c171..6a6428f66a3 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -3226,8 +3226,8 @@ bool TemplateSimplifier::simplifyTemplateInstantiations( ErrorMessage errmsg({std::move(loc)}, "", Severity::debug, - "Template instantiation maximum time exceeded", "templateMaxTime", + "Template instantiation maximum time exceeded", Certainty::normal); mErrorLogger.reportErr(errmsg); } @@ -3302,8 +3302,8 @@ bool TemplateSimplifier::simplifyTemplateInstantiations( ErrorMessage errmsg({std::move(loc)}, "", Severity::debug, - "Template instantiation maximum time exceeded", "templateMaxTime", + "Template instantiation maximum time exceeded", Certainty::normal); mErrorLogger.reportErr(errmsg); } diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index ea911b1acbe..470c7c04429 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -1148,8 +1148,8 @@ void Tokenizer::simplifyTypedefCpp() ErrorMessage errmsg({std::move(loc)}, "", Severity::debug, - "Typedef simplification instantiation maximum time exceeded", "typedefMaxTime", + "Typedef simplification instantiation maximum time exceeded", Certainty::normal); mErrorLogger.reportErr(errmsg); } diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 1d9b7f98d64..806c54617d9 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -147,8 +147,8 @@ static void bailoutInternal(const std::string& type, ErrorMessage errmsg({std::move(loc)}, tokenlist.getSourceFilePath(), Severity::debug, - (file.empty() ? "" : location) + function + " bailout: " + what, type, + (file.empty() ? "" : location) + function + " bailout: " + what, Certainty::normal); errorLogger.reportErr(errmsg); } @@ -3553,8 +3553,8 @@ static void valueFlowConditionExpressions(const TokenList& tokenlist, {std::move(loc)}, tokenlist.getSourceFilePath(), Severity::debug, - "Analysis of condition expressions is disabled. Use --check-level=exhaustive to enable it.", "normalCheckLevelConditionExpressions", + "Analysis of condition expressions is disabled. Use --check-level=exhaustive to enable it.", Certainty::normal); errorLogger.reportErr(errmsg); } @@ -7360,8 +7360,8 @@ struct ValueFlowPassRunner { ErrorMessage errmsg({std::move(loc)}, "", Severity::debug, - "ValueFlow maximum iterations exceeded", "valueFlowMaxIterations", + "ValueFlow maximum iterations exceeded", Certainty::normal); state.errorLogger.reportErr(errmsg); } @@ -7421,9 +7421,9 @@ struct ValueFlowPassRunner { const ErrorMessage errmsg(std::move(callstack), state.tokenlist.getSourceFilePath(), Severity::information, + "checkLevelNormal", // TODO: use more specific ID "Limiting ValueFlow analysis in function '" + functionName + "' since it is too complex. " "Please specify --check-level=exhaustive to perform full analysis.", - "checkLevelNormal", // TODO: use more specific ID Certainty::normal); state.errorLogger.reportErr(errmsg); } diff --git a/test/testerrorlogger.cpp b/test/testerrorlogger.cpp index aa4d2f3e223..3422a542b0f 100644 --- a/test/testerrorlogger.cpp +++ b/test/testerrorlogger.cpp @@ -246,7 +246,7 @@ class TestErrorLogger : public TestFixture { void ErrorMessageConstruct() const { std::list locs(1, fooCpp5); - ErrorMessage msg(std::move(locs), "", Severity::error, "Programming error.", "errorId", Certainty::normal); + ErrorMessage msg(std::move(locs), "", Severity::error, "errorId", "Programming error.", Certainty::normal); ASSERT_EQUALS(1, msg.callStack.size()); ASSERT_EQUALS("Programming error.", msg.shortMessage()); ASSERT_EQUALS("Programming error.", msg.verboseMessage()); @@ -256,7 +256,7 @@ class TestErrorLogger : public TestFixture { void ErrorMessageConstructLocations() const { std::list locs = { fooCpp5, barCpp8 }; - ErrorMessage msg(std::move(locs), "", Severity::error, "Programming error.", "errorId", Certainty::normal); + ErrorMessage msg(std::move(locs), "", Severity::error, "errorId", "Programming error.", Certainty::normal); ASSERT_EQUALS(2, msg.callStack.size()); ASSERT_EQUALS("Programming error.", msg.shortMessage()); ASSERT_EQUALS("Programming error.", msg.verboseMessage()); @@ -266,7 +266,7 @@ class TestErrorLogger : public TestFixture { void ErrorMessageVerbose() const { std::list locs(1, fooCpp5); - ErrorMessage msg(std::move(locs), "", Severity::error, "Programming error.\nVerbose error", "errorId", Certainty::normal); + ErrorMessage msg(std::move(locs), "", Severity::error, "errorId", "Programming error.\nVerbose error", Certainty::normal); ASSERT_EQUALS(1, msg.callStack.size()); ASSERT_EQUALS("Programming error.", msg.shortMessage()); ASSERT_EQUALS("Verbose error", msg.verboseMessage()); @@ -276,7 +276,7 @@ class TestErrorLogger : public TestFixture { void ErrorMessageVerboseLocations() const { std::list locs = { fooCpp5, barCpp8 }; - ErrorMessage msg(std::move(locs), "", Severity::error, "Programming error.\nVerbose error", "errorId", Certainty::normal); + ErrorMessage msg(std::move(locs), "", Severity::error, "errorId", "Programming error.\nVerbose error", Certainty::normal); ASSERT_EQUALS(2, msg.callStack.size()); ASSERT_EQUALS("Programming error.", msg.shortMessage()); ASSERT_EQUALS("Verbose error", msg.verboseMessage()); @@ -322,7 +322,7 @@ class TestErrorLogger : public TestFixture { std::list locs = { fooCpp5 }; const auto mapping = createGuidelineMapping(reportType); - ErrorMessage msg(std::move(locs), emptyString, severity, "", errorId, Certainty::normal); + ErrorMessage msg(std::move(locs), emptyString, severity, errorId, "", Certainty::normal); msg.guideline = getGuideline(msg.id, reportType, mapping, msg.severity); msg.classification = getClassification(msg.guideline, reportType); @@ -344,7 +344,7 @@ class TestErrorLogger : public TestFixture { void CustomFormat() const { std::list locs(1, fooCpp5); - ErrorMessage msg(std::move(locs), "", Severity::error, "Programming error.\nVerbose error", "errorId", Certainty::normal); + ErrorMessage msg(std::move(locs), "", Severity::error, "errorId", "Programming error.\nVerbose error", Certainty::normal); ASSERT_EQUALS(1, msg.callStack.size()); ASSERT_EQUALS("Programming error.", msg.shortMessage()); ASSERT_EQUALS("Verbose error", msg.verboseMessage()); @@ -354,7 +354,7 @@ class TestErrorLogger : public TestFixture { void CustomFormat2() const { std::list locs(1, fooCpp5); - ErrorMessage msg(std::move(locs), "", Severity::error, "Programming error.\nVerbose error", "errorId", Certainty::normal); + ErrorMessage msg(std::move(locs), "", Severity::error, "errorId", "Programming error.\nVerbose error", Certainty::normal); ASSERT_EQUALS(1, msg.callStack.size()); ASSERT_EQUALS("Programming error.", msg.shortMessage()); ASSERT_EQUALS("Verbose error", msg.verboseMessage()); @@ -365,7 +365,7 @@ class TestErrorLogger : public TestFixture { void CustomFormatLocations() const { // Check that first location from location stack is used in template std::list locs = { fooCpp5, barCpp8 }; - ErrorMessage msg(std::move(locs), "", Severity::error, "Programming error.\nVerbose error", "errorId", Certainty::normal); + ErrorMessage msg(std::move(locs), "", Severity::error, "errorId", "Programming error.\nVerbose error", Certainty::normal); ASSERT_EQUALS(2, msg.callStack.size()); ASSERT_EQUALS("Programming error.", msg.shortMessage()); ASSERT_EQUALS("Verbose error", msg.verboseMessage()); @@ -375,7 +375,7 @@ class TestErrorLogger : public TestFixture { void ToXmlV2() const { std::list locs(1, fooCpp5); - ErrorMessage msg(std::move(locs), "", Severity::error, "Programming error.\nVerbose error", "errorId", Certainty::normal); + ErrorMessage msg(std::move(locs), "", Severity::error, "errorId", "Programming error.\nVerbose error", Certainty::normal); std::string header("\n\n"); header += " ", msg.toXML()); } @@ -403,7 +403,7 @@ class TestErrorLogger : public TestFixture { dir4loc.setfile("dir4\\a.cpp"); std::list locs = { dir4loc, dir3loc, dir2loc, dir1loc, fooCpp5, barCpp8_i }; - ErrorMessage msg(std::move(locs), "", Severity::error, "Programming error.\nVerbose error", "errorId", Certainty::normal); + ErrorMessage msg(std::move(locs), "", Severity::error, "errorId", "Programming error.\nVerbose error", Certainty::normal); std::string message; message += " \n"; message += " \n"; @@ -418,16 +418,16 @@ class TestErrorLogger : public TestFixture { void ToXmlV2Encoding() const { { - ErrorMessage msg({}, "", Severity::error, "Programming error.\nComparing \"\203\" with \"\003\"", "errorId", Certainty::normal); + ErrorMessage msg({}, "", Severity::error, "errorId", "Programming error.\nComparing \"\203\" with \"\003\"", Certainty::normal); const std::string expected(" "); ASSERT_EQUALS(expected, msg.toXML()); } { const char code1[]="äöü"; const char code2[]="\x12\x00\x00\x01"; - ErrorMessage msg1({}, "", Severity::error, std::string("Programming error.\nReading \"")+code1+"\"", "errorId", Certainty::normal); + ErrorMessage msg1({}, "", Severity::error, "errorId", std::string("Programming error.\nReading \"")+code1+"\"", Certainty::normal); ASSERT_EQUALS(" ", msg1.toXML()); - ErrorMessage msg2({}, "", Severity::error, std::string("Programming error.\nReading \"")+code2+"\"", "errorId", Certainty::normal); + ErrorMessage msg2({}, "", Severity::error, "errorId", std::string("Programming error.\nReading \"")+code2+"\"", Certainty::normal); ASSERT_EQUALS(" ", msg2.toXML()); } } @@ -481,7 +481,7 @@ class TestErrorLogger : public TestFixture { std::list locs(1, fooCpp5); // Inconclusive error message - ErrorMessage msg(std::move(locs), "", Severity::error, "Programming error", "errorId", Certainty::inconclusive); + ErrorMessage msg(std::move(locs), "", Severity::error, "errorId", "Programming error", Certainty::inconclusive); // xml version 2 error message ASSERT_EQUALS(" \n" @@ -492,7 +492,7 @@ class TestErrorLogger : public TestFixture { void SerializeInconclusiveMessage() const { // Inconclusive error message - ErrorMessage msg({}, "", Severity::error, "Programming error", "errorId", Certainty::inconclusive); + ErrorMessage msg({}, "", Severity::error, "errorId", "Programming error", Certainty::inconclusive); msg.file0 = "test.cpp"; const std::string msg_str = msg.serialize(); @@ -590,7 +590,7 @@ class TestErrorLogger : public TestFixture { } void SerializeSanitize() const { - ErrorMessage msg({}, "", Severity::error, std::string("Illegal character in \"foo\001bar\""), "errorId", Certainty::normal); + ErrorMessage msg({}, "", Severity::error, "errorId", std::string("Illegal character in \"foo\001bar\""), Certainty::normal); msg.file0 = "1.c"; const std::string msg_str = msg.serialize(); @@ -619,7 +619,7 @@ class TestErrorLogger : public TestFixture { ErrorMessage::FileLocation loc1(":/,;", "abcd:/,", 654, 33); loc1.setfile("[]:;,()"); - ErrorMessage msg({std::move(loc1)}, "", Severity::error, "Programming error", "errorId", Certainty::inconclusive); + ErrorMessage msg({std::move(loc1)}, "", Severity::error, "errorId", "Programming error", Certainty::inconclusive); const std::string msg_str = msg.serialize(); ASSERT_EQUALS("7 errorId" @@ -645,7 +645,7 @@ class TestErrorLogger : public TestFixture { } void SerializeAndDeserialize() const { - ErrorMessage msg({}, "", Severity::warning, "$symbol:var\nmessage $symbol", "id", Certainty::normal); + ErrorMessage msg({}, "", Severity::warning, "id", "$symbol:var\nmessage $symbol", Certainty::normal); msg.remark = "some remark"; ErrorMessage msg2; diff --git a/test/testexecutor.cpp b/test/testexecutor.cpp index 4f952a4004d..8f7a13f582c 100644 --- a/test/testexecutor.cpp +++ b/test/testexecutor.cpp @@ -68,7 +68,7 @@ class TestExecutor : public TestFixture { DummyExecutor executor(files, fileSettings, settings, supprs, *this); ErrorMessage::FileLocation loc1("test.c", 1, 2); - ErrorMessage msg({std::move(loc1)}, "test.c", Severity::error, "error", "id", Certainty::normal); + ErrorMessage msg({std::move(loc1)}, "test.c", Severity::error, "id", "error", Certainty::normal); ASSERT(executor.hasToLog_(msg)); ASSERT(!executor.hasToLog_(msg)); diff --git a/test/testsuppressions.cpp b/test/testsuppressions.cpp index b9ad2122839..bfd5ece0299 100644 --- a/test/testsuppressions.cpp +++ b/test/testsuppressions.cpp @@ -1717,7 +1717,7 @@ class TestSuppressions : public TestFixture { void suppressionFromErrorMessage() const { { - const ErrorMessage msg({}, "test1.cpp", Severity::information, "msg", "id", Certainty::inconclusive); + const ErrorMessage msg({}, "test1.cpp", Severity::information, "id", "msg", Certainty::inconclusive); const auto msg_s = SuppressionList::ErrorMessage::fromErrorMessage(msg, {"m1", "m2"}); ASSERT_EQUALS("test1.cpp", msg_s.getFileName()); ASSERT_EQUALS(SuppressionList::Suppression::NO_LINE, msg_s.lineNumber); @@ -1733,7 +1733,7 @@ class TestSuppressions : public TestFixture { { std::list loc; loc.emplace_back("test1.cpp", 1, 1); - const ErrorMessage msg(std::move(loc), "test1.cpp", Severity::information, "msg", "id", Certainty::normal); + const ErrorMessage msg(std::move(loc), "test1.cpp", Severity::information, "id", "msg", Certainty::normal); const auto msg_s = SuppressionList::ErrorMessage::fromErrorMessage(msg, {}); ASSERT_EQUALS("test1.cpp", msg_s.getFileName()); ASSERT_EQUALS(1, msg_s.lineNumber); @@ -1743,7 +1743,7 @@ class TestSuppressions : public TestFixture { loc.emplace_back("test1.cpp", 1, 1); loc.emplace_back("test2.cpp", 2, 2); loc.emplace_back("test3.cpp", 3, 3); - const ErrorMessage msg(std::move(loc), "test1.cpp", Severity::information, "msg", "id", Certainty::normal); + const ErrorMessage msg(std::move(loc), "test1.cpp", Severity::information, "id", "msg", Certainty::normal); const auto msg_s = SuppressionList::ErrorMessage::fromErrorMessage(msg, {}); ASSERT_EQUALS("test3.cpp", msg_s.getFileName()); ASSERT_EQUALS(3, msg_s.lineNumber);