errmsg: the "unused function" message shall not take any Tokenizer nor Token parameters

This commit is contained in:
Daniel Marjamäki 2009-01-11 08:10:51 +00:00
parent 94667320e8
commit 9d8af10583
4 changed files with 15 additions and 8 deletions

View File

@ -156,7 +156,7 @@ void CheckFunctionUsage::check()
filename = ""; filename = "";
else else
filename = func.filename; filename = func.filename;
_errorLogger->reportErr(ErrorMessage::unusedFunction(0, 0, filename, it->first)); _errorLogger->reportErr(ErrorMessage::unusedFunction(filename, it->first));
} }
else if (! func.usedOtherFile) else if (! func.usedOtherFile)
{ {

View File

@ -111,9 +111,9 @@ public:
return true; return true;
} }
static std::string unusedFunction(const Tokenizer *tokenizer, const Token *Location, const std::string &filename, const std::string &funcname) static std::string unusedFunction(const std::string &filename, const std::string &funcname)
{ {
return msg1(tokenizer, Location) + "[" + filename + "]: The function '" + funcname + "' is never used"; return "[" + filename + "]: The function '" + funcname + "' is never used";
} }
static bool unusedFunction(const Settings &s) static bool unusedFunction(const Settings &s)
{ {

View File

@ -186,15 +186,22 @@ std::string Message::msg(bool code) const
void Message::generateCode(std::ostream &ostr) const void Message::generateCode(std::ostream &ostr) const
{ {
bool loc = bool(_msg.substr(0, 4) != "[%1]");
// Error message.. // Error message..
ostr << " static std::string " << _funcname << "(const Tokenizer *tokenizer, const Token *Location"; ostr << " static std::string " << _funcname << "(";
if (loc)
ostr << "const Tokenizer *tokenizer, const Token *Location";
if (! _par1.empty()) if (! _par1.empty())
ostr << ", const std::string &" << _par1; ostr << (loc ? ", " : "") << "const std::string &" << _par1;
if (! _par2.empty()) if (! _par2.empty())
ostr << ", const std::string &" << _par2; ostr << ", const std::string &" << _par2;
ostr << ")\n"; ostr << ")\n";
ostr << " {\n"; ostr << " {\n";
ostr << " return msg1(tokenizer, Location) + " << msg(true) << ";\n"; ostr << " return ";
if (loc)
ostr << "msg1(tokenizer, Location) + ";
ostr << msg(true) << ";\n";
ostr << " }\n"; ostr << " }\n";
// Settings.. // Settings..