diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index 48592a3e5c0..e82fefca559 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -136,7 +136,7 @@ namespace { (void) metric; } - void reportProgress(const std::string & /*filename*/, const char /*stage*/[], const std::size_t /*value*/) override + void reportProgress(const char /*stage*/[], const std::size_t /*value*/) override {} }; } diff --git a/cli/cppcheckexecutor.cpp b/cli/cppcheckexecutor.cpp index 184cd00cd2f..de2ba47487d 100644 --- a/cli/cppcheckexecutor.cpp +++ b/cli/cppcheckexecutor.cpp @@ -323,7 +323,7 @@ namespace { /** xml output of errors */ void reportErr(const ErrorMessage &msg) override; - void reportProgress(const std::string &filename, const char stage[], std::size_t value) override; + void reportProgress(const char stage[], std::size_t value) override; /** * Reference to current settings; set while check() is running for reportError(). @@ -618,11 +618,8 @@ void StdLogger::reportOut(const std::string &outmsg, Color c) std::cout << c << ansiToOEM(outmsg, true) << Color::Reset << std::endl; } -// TODO: remove filename parameter? -void StdLogger::reportProgress(const std::string &filename, const char stage[], const std::size_t value) +void StdLogger::reportProgress(const char stage[], const std::size_t value) { - (void)filename; - if (!mLatestProgressOutputTime) return; diff --git a/democlient/democlient.cpp b/democlient/democlient.cpp index c0601d6d434..a43e94f81c8 100644 --- a/democlient/democlient.cpp +++ b/democlient/democlient.cpp @@ -83,9 +83,7 @@ class CppcheckExecutor : public ErrorLogger { } void reportMetric(const std::string & /*metric*/) override {} - void reportProgress(const std::string& /*filename*/, - const char /*stage*/[], - const std::size_t /*value*/) override { + void reportProgress(const char /*stage*/[], const std::size_t /*value*/) override { if (std::time(nullptr) >= stoptime) { std::cout << "Time to analyse the code exceeded 2 seconds. Terminating.\n\n"; Settings::terminate(); diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index ad46f2651cd..140417fe582 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -263,9 +263,9 @@ class CppCheck::CppCheckLogger : public ErrorLogger mErrorLogger.reportMetric(metric); } - void reportProgress(const std::string &filename, const char stage[], const std::size_t value) override + void reportProgress(const char stage[], const std::size_t value) override { - mErrorLogger.reportProgress(filename, stage, value); + mErrorLogger.reportProgress(stage, value); } ErrorLogger &mErrorLogger; diff --git a/lib/errorlogger.h b/lib/errorlogger.h index 5101f765fad..822d13ce2f1 100644 --- a/lib/errorlogger.h +++ b/lib/errorlogger.h @@ -249,12 +249,10 @@ class CPPCHECKLIB ErrorLogger { /** * Report progress to client - * @param filename main file that is checked * @param stage for example preprocess / tokenize / simplify / check * @param value progress value (0-100) */ - virtual void reportProgress(const std::string &filename, const char stage[], const std::size_t value) { - (void)filename; + virtual void reportProgress(const char stage[], const std::size_t value) { (void)stage; (void)value; } diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index e05001b6896..d0007b6abd3 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -202,9 +202,7 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes() for (const Token *tok = mTokenizer.tokens(); tok; tok = tok ? tok->next() : nullptr) { // #5593 suggested to add here: if (doProgress) - mErrorLogger.reportProgress(mTokenizer.list.getSourceFilePath(), - "SymbolDatabase", - tok->progressValue()); + mErrorLogger.reportProgress("SymbolDatabase", tok->progressValue()); // Locate next class if ((tok->isCpp() && tok->isKeyword() && ((Token::Match(tok, "class|struct|union|namespace ::| %name% final| {|:|::|<") && diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index 18cec14c171..7dbde6f592f 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -3218,7 +3218,7 @@ bool TemplateSimplifier::simplifyTemplateInstantiations( Token * const tok2 = instantiation.token(); if ((mSettings.reportProgress != -1) && !mTokenList.getFiles().empty()) - mErrorLogger.reportProgress(mTokenList.getFiles()[0], "TemplateSimplifier::simplifyTemplateInstantiations()", tok2->progressValue()); + mErrorLogger.reportProgress("TemplateSimplifier::simplifyTemplateInstantiations()", tok2->progressValue()); if (maxtime > 0 && std::time(nullptr) > maxtime) { if (mSettings.debugwarnings) { @@ -3294,7 +3294,7 @@ bool TemplateSimplifier::simplifyTemplateInstantiations( if (!instantiated && specialized) { auto * tok2 = const_cast(templateDeclaration.nameToken()); if ((mSettings.reportProgress != -1) && !mTokenList.getFiles().empty()) - mErrorLogger.reportProgress(mTokenList.getFiles()[0], "TemplateSimplifier::simplifyTemplateInstantiations()", tok2->progressValue()); + mErrorLogger.reportProgress("TemplateSimplifier::simplifyTemplateInstantiations()", tok2->progressValue()); if (maxtime > 0 && std::time(nullptr) > maxtime) { if (mSettings.debugwarnings) { diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index ea911b1acbe..6c932a06c83 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -1137,7 +1137,7 @@ void Tokenizer::simplifyTypedefCpp() for (Token *tok = list.front(); tok; tok = tok->next()) { if (doProgress) - mErrorLogger.reportProgress(list.getFiles()[0], "Tokenize (typedef)", tok->progressValue()); + mErrorLogger.reportProgress("Tokenize (typedef)", tok->progressValue()); if (Settings::terminated()) return; @@ -2884,7 +2884,7 @@ bool Tokenizer::simplifyUsing() for (Token *tok = list.front(); tok; tok = tok->next()) { if (doProgress) - mErrorLogger.reportProgress(list.getFiles()[0], "Tokenize (using)", tok->progressValue()); + mErrorLogger.reportProgress("Tokenize (using)", tok->progressValue()); if (Settings::terminated()) return substitute; diff --git a/oss-fuzz/main.cpp b/oss-fuzz/main.cpp index bcd7a6c37c4..4afe98da611 100644 --- a/oss-fuzz/main.cpp +++ b/oss-fuzz/main.cpp @@ -40,9 +40,7 @@ class DummyErrorLogger : public ErrorLogger { public: void reportOut(const std::string& /*outmsg*/, Color /*c*/) override {} void reportErr(const ErrorMessage& /*msg*/) override {} - void reportProgress(const std::string& /*filename*/, - const char /*stage*/[], - const std::size_t /*value*/) override {} + void reportProgress(const char /*stage*/[], const std::size_t /*value*/) override {} void reportMetric(const std::string & /*metric*/) override {} };