Skip to content

Commit 365fed1

Browse files
committed
Changed ErrorMessage constructor parameter order
1 parent 478055e commit 365fed1

14 files changed

Lines changed: 47 additions & 47 deletions

cli/processexecutor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,8 @@ void ProcessExecutor::reportInternalChildErr(const std::string &childname, const
463463
const ErrorMessage errmsg(std::move(locations),
464464
"",
465465
Severity::error,
466-
"Internal error: " + msg,
467466
"cppcheckError",
467+
"Internal error: " + msg,
468468
Certainty::normal);
469469

470470
if (!mSuppressions.nomsg.isSuppressed(errmsg, {}))

lib/checkunusedfunctions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ void CheckUnusedFunctions::staticFunctionError(ErrorLogger& errorLogger,
351351
locationList.back().fileIndex = fileIndex;
352352
}
353353

354-
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);
354+
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);
355355
errorLogger.reportErr(errmsg);
356356
}
357357

lib/cppcheck.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,8 @@ static bool reportClangErrors(std::istream &is, const std::function<void(const E
598598
ErrorMessage errmsg({std::move(loc)},
599599
std::move(locFile),
600600
Severity::error,
601-
msg,
602601
"syntaxError",
602+
msg,
603603
Certainty::normal);
604604

605605
if (line.compare(pos3, 10, ": warning:") == 0) {
@@ -984,8 +984,8 @@ unsigned int CppCheck::checkFile(const FileWithDetails& file, const std::string
984984
ErrorMessage errmsg({std::move(loc1)},
985985
"", // TODO: is this correct?
986986
Severity::error,
987-
output.msg,
988987
"syntaxError",
988+
output.msg,
989989
Certainty::normal);
990990
mErrorLogger.reportErr(errmsg);
991991
return mLogger->exitcode();
@@ -1243,8 +1243,8 @@ unsigned int CppCheck::checkFile(const FileWithDetails& file, const std::string
12431243
ErrorMessage errmsg({std::move(loc1)},
12441244
file.spath(),
12451245
Severity::error,
1246-
o.msg,
12471246
"preprocessorErrorDirective",
1247+
o.msg,
12481248
Certainty::normal);
12491249
mErrorLogger.reportErr(errmsg);
12501250
}
@@ -1273,8 +1273,8 @@ unsigned int CppCheck::checkFile(const FileWithDetails& file, const std::string
12731273
ErrorMessage errmsg({std::move(loc)},
12741274
std::move(locFile),
12751275
Severity::information,
1276-
msg,
12771276
"noValidConfiguration",
1277+
msg,
12781278
Certainty::normal);
12791279
mErrorLogger.reportErr(errmsg);
12801280
}
@@ -1335,8 +1335,8 @@ void CppCheck::internalError(const std::string &filename, const std::string &msg
13351335
ErrorMessage errmsg({std::move(loc1)},
13361336
"",
13371337
Severity::error,
1338-
fullmsg,
13391338
"internalError",
1339+
fullmsg,
13401340
Certainty::normal);
13411341

13421342
mErrorLogger.reportErr(errmsg);
@@ -1370,8 +1370,8 @@ void CppCheck::checkNormalTokens(const Tokenizer &tokenizer, AnalyzerInformation
13701370
ErrorMessage errmsg({std::move(loc)},
13711371
"",
13721372
Severity::debug,
1373-
"Checks maximum time exceeded",
13741373
"checksMaxTime",
1374+
"Checks maximum time exceeded",
13751375
Certainty::normal);
13761376
mErrorLogger.reportErr(errmsg);
13771377
}
@@ -1912,8 +1912,8 @@ void CppCheck::purgedConfigurationMessage(const std::string &file, const std::st
19121912
ErrorMessage errmsg(std::move(loclist),
19131913
"",
19141914
Severity::information,
1915-
"The configuration '" + configuration + "' was not checked because its code equals another one.",
19161915
"purgedConfiguration",
1916+
"The configuration '" + configuration + "' was not checked because its code equals another one.",
19171917
Certainty::normal);
19181918

19191919
mErrorLogger.reportErr(errmsg);

lib/errorlogger.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ ErrorMessage::ErrorMessage()
6060
: severity(Severity::none), cwe(0U), certainty(Certainty::normal), hash(0)
6161
{}
6262

63-
// TODO: id and msg are swapped compared to other calls
64-
ErrorMessage::ErrorMessage(std::list<FileLocation> callStack, std::string file1, Severity severity, const std::string &msg, std::string id, Certainty certainty) :
63+
ErrorMessage::ErrorMessage(std::list<FileLocation> callStack, std::string file1, Severity severity, std::string id, const std::string &msg, Certainty certainty) :
6564
callStack(std::move(callStack)), // locations for this error message
6665
id(std::move(id)), // set the message id
6766
file0(std::move(file1)),
@@ -262,8 +261,8 @@ ErrorMessage ErrorMessage::fromInternalError(const InternalError &internalError,
262261
ErrorMessage errmsg(std::move(locationList),
263262
tokenList ? tokenList->getSourceFilePath() : filename,
264263
Severity::error,
265-
(msg.empty() ? "" : (msg + ": ")) + internalError.errorMessage,
266264
internalError.id,
265+
(msg.empty() ? "" : (msg + ": ")) + internalError.errorMessage,
267266
Certainty::normal);
268267
// TODO: find a better way
269268
if (!internalError.details.empty())

lib/errorlogger.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ class CPPCHECKLIB ErrorMessage {
103103
ErrorMessage(std::list<FileLocation> callStack,
104104
std::string file1,
105105
Severity severity,
106+
std::string id,
106107
const std::string &msg,
107-
std::string id, Certainty certainty);
108+
Certainty certainty);
108109
ErrorMessage(std::list<FileLocation> callStack,
109110
std::string file1,
110111
Severity severity,

lib/forwardanalyzer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ namespace {
872872

873873
void reportError(Severity severity, const std::string& id, const std::string& msg) {
874874
ErrorMessage::FileLocation loc(tokenList.getSourceFilePath(), 0, 0);
875-
const ErrorMessage errmsg({std::move(loc)}, tokenList.getSourceFilePath(), severity, msg, id, Certainty::normal);
875+
const ErrorMessage errmsg({std::move(loc)}, tokenList.getSourceFilePath(), severity, id, msg, Certainty::normal);
876876
errorLogger.reportErr(errmsg);
877877
}
878878

lib/preprocessor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,8 +902,8 @@ void Preprocessor::error(const std::string &filename, unsigned int linenr, const
902902
mErrorLogger.reportErr(ErrorMessage(std::move(locationList),
903903
mFile0,
904904
Severity::error,
905-
msg,
906905
"preprocessorErrorDirective",
906+
msg,
907907
Certainty::normal));
908908
}
909909

@@ -918,10 +918,10 @@ void Preprocessor::missingInclude(const std::string &filename, unsigned int line
918918
locationList.emplace_back(filename, linenr, 0);
919919
}
920920
ErrorMessage errmsg(std::move(locationList), mFile0, Severity::information,
921+
(headerType==SystemHeader) ? "missingIncludeSystem" : "missingInclude",
921922
(headerType==SystemHeader) ?
922923
"Include file: <" + header + "> not found. Please note: Cppcheck does not need standard library headers to get proper results." :
923924
"Include file: \"" + header + "\" not found.",
924-
(headerType==SystemHeader) ? "missingIncludeSystem" : "missingInclude",
925925
Certainty::normal);
926926
mErrorLogger.reportErr(errmsg);
927927
}

lib/suppressions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ bool SuppressionList::reportUnmatchedSuppressions(const std::list<SuppressionLis
687687
std::list<::ErrorMessage::FileLocation> callStack;
688688
if (!s.fileName.empty())
689689
callStack.emplace_back(s.fileName, s.lineNumber, 0);
690-
errorLogger.reportErr(::ErrorMessage(std::move(callStack), "", Severity::information, "Unmatched suppression: " + s.errorId, "unmatchedSuppression", Certainty::normal));
690+
errorLogger.reportErr(::ErrorMessage(std::move(callStack), "", Severity::information, "unmatchedSuppression", "Unmatched suppression: " + s.errorId, Certainty::normal));
691691
err = true;
692692
}
693693
return err;

lib/templatesimplifier.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3226,8 +3226,8 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
32263226
ErrorMessage errmsg({std::move(loc)},
32273227
"",
32283228
Severity::debug,
3229-
"Template instantiation maximum time exceeded",
32303229
"templateMaxTime",
3230+
"Template instantiation maximum time exceeded",
32313231
Certainty::normal);
32323232
mErrorLogger.reportErr(errmsg);
32333233
}
@@ -3302,8 +3302,8 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
33023302
ErrorMessage errmsg({std::move(loc)},
33033303
"",
33043304
Severity::debug,
3305-
"Template instantiation maximum time exceeded",
33063305
"templateMaxTime",
3306+
"Template instantiation maximum time exceeded",
33073307
Certainty::normal);
33083308
mErrorLogger.reportErr(errmsg);
33093309
}

lib/tokenize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1148,8 +1148,8 @@ void Tokenizer::simplifyTypedefCpp()
11481148
ErrorMessage errmsg({std::move(loc)},
11491149
"",
11501150
Severity::debug,
1151-
"Typedef simplification instantiation maximum time exceeded",
11521151
"typedefMaxTime",
1152+
"Typedef simplification instantiation maximum time exceeded",
11531153
Certainty::normal);
11541154
mErrorLogger.reportErr(errmsg);
11551155
}

0 commit comments

Comments
 (0)