Skip to content
Closed
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
2 changes: 1 addition & 1 deletion cli/cmdlineparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{}
};
}
Expand Down
7 changes: 2 additions & 5 deletions cli/cppcheckexecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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().
Expand Down Expand Up @@ -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;

Expand Down
4 changes: 1 addition & 3 deletions democlient/democlient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions lib/cppcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions lib/errorlogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 1 addition & 3 deletions lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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| {|:|::|<") &&
Expand Down
4 changes: 2 additions & 2 deletions lib/templatesimplifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -3294,7 +3294,7 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
if (!instantiated && specialized) {
auto * tok2 = const_cast<Token *>(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) {
Expand Down
4 changes: 2 additions & 2 deletions lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions oss-fuzz/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
};

Expand Down