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

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

View File

@ -111,9 +111,9 @@ public:
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)
{

View File

@ -161,7 +161,7 @@ std::string Preprocessor::read(std::istream &istr)
code << std::string(1, ch);
// if there has been <backspace><newline> sequences, add extra newlines..
if ( ch == '\n' && newlines > 0 )
if (ch == '\n' && newlines > 0)
{
code << std::string(newlines, '\n');
newlines = 0;

View File

@ -186,15 +186,22 @@ std::string Message::msg(bool code) const
void Message::generateCode(std::ostream &ostr) const
{
bool loc = bool(_msg.substr(0, 4) != "[%1]");
// 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())
ostr << ", const std::string &" << _par1;
ostr << (loc ? ", " : "") << "const std::string &" << _par1;
if (! _par2.empty())
ostr << ", const std::string &" << _par2;
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";
// Settings..