Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Check::Check(const std::string &aname)
instances().insert(it, this);
}

void Check::reportError(const ErrorMessage &errmsg)
void Check::writeToErrorList(const ErrorMessage &errmsg)
{
std::cout << errmsg.toXML() << std::endl;
}
Expand All @@ -67,7 +67,7 @@ void Check::reportError(const std::list<const Token *> &callstack, Severity::Sev
if (mErrorLogger)
mErrorLogger->reportErr(errmsg);
else
reportError(errmsg);
writeToErrorList(errmsg);
}

void Check::reportError(const ErrorPath &errorPath, Severity::SeverityType severity, const char id[], const std::string &msg, const CWE &cwe, Certainty certainty)
Expand All @@ -76,7 +76,7 @@ void Check::reportError(const ErrorPath &errorPath, Severity::SeverityType sever
if (mErrorLogger)
mErrorLogger->reportErr(errmsg);
else
reportError(errmsg);
writeToErrorList(errmsg);
}

bool Check::wrongData(const Token *tok, const char *str)
Expand Down
4 changes: 2 additions & 2 deletions lib/check.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ class CPPCHECKLIB Check {
virtual std::string classInfo() const = 0;

/**
* Write given error to errorlogger or to out stream in xml format.
* Write given error to stdout in xml format.
* This is for for printout out the error list with --errorlist
* @param errmsg Error message to write
*/
static void reportError(const ErrorMessage &errmsg);
static void writeToErrorList(const ErrorMessage &errmsg);

/** Base class used for whole-program analysis */
class CPPCHECKLIB FileInfo {
Expand Down
2 changes: 1 addition & 1 deletion lib/checkmemoryleak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ void CheckMemoryLeak::reportErr(const std::list<const Token *> &callstack, Sever
if (mErrorLogger_)
mErrorLogger_->reportErr(errmsg);
else
Check::reportError(errmsg);
Check::writeToErrorList(errmsg);
}

void CheckMemoryLeak::memleakError(const Token *tok, const std::string &varname) const
Expand Down
2 changes: 1 addition & 1 deletion lib/checkunusedfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ void CheckUnusedFunctions::unusedFunctionError(ErrorLogger * const errorLogger,
if (errorLogger)
errorLogger->reportErr(errmsg);
else
reportError(errmsg);
Check::writeToErrorList(errmsg);
}

Check::FileInfo *CheckUnusedFunctions::getFileInfo(const Tokenizer *tokenizer, const Settings *settings) const
Expand Down
3 changes: 2 additions & 1 deletion lib/errorlogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,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<FileLocation> callStack, std::string file1, Severity::SeverityType severity, const std::string &msg, std::string id, Certainty certainty) :
callStack(std::move(callStack)), // locations for this error message
id(std::move(id)), // set the message id
Expand All @@ -57,7 +58,7 @@ ErrorMessage::ErrorMessage(std::list<FileLocation> callStack, std::string file1,
}



// TODO: id and msg are swapped compared to other calls
ErrorMessage::ErrorMessage(std::list<FileLocation> callStack, std::string file1, Severity::SeverityType severity, const std::string &msg, std::string id, const CWE &cwe, Certainty certainty) :
callStack(std::move(callStack)), // locations for this error message
id(std::move(id)), // set the message id
Expand Down
2 changes: 1 addition & 1 deletion lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10139,7 +10139,7 @@ void Tokenizer::reportError(const std::list<const Token*>& callstack, Severity::
if (mErrorLogger)
mErrorLogger->reportErr(errmsg);
else
Check::reportError(errmsg);
Check::writeToErrorList(errmsg);
}

void Tokenizer::setPodTypes()
Expand Down