diff --git a/src/checkfunctionusage.cpp b/src/checkfunctionusage.cpp index cd37b4860..d58758d40 100644 --- a/src/checkfunctionusage.cpp +++ b/src/checkfunctionusage.cpp @@ -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) { diff --git a/src/errormessage.h b/src/errormessage.h index 9ca0991bd..5aab4f9d8 100644 --- a/src/errormessage.h +++ b/src/errormessage.h @@ -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) { diff --git a/src/preprocessor.cpp b/src/preprocessor.cpp index 97c3c27c4..47544ae7f 100644 --- a/src/preprocessor.cpp +++ b/src/preprocessor.cpp @@ -161,7 +161,7 @@ std::string Preprocessor::read(std::istream &istr) code << std::string(1, ch); // if there has been sequences, add extra newlines.. - if ( ch == '\n' && newlines > 0 ) + if (ch == '\n' && newlines > 0) { code << std::string(newlines, '\n'); newlines = 0; diff --git a/tools/errmsg.cpp b/tools/errmsg.cpp index ec0436d16..0e4356f0a 100644 --- a/tools/errmsg.cpp +++ b/tools/errmsg.cpp @@ -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..