Skip to content

Commit 35dc158

Browse files
committed
Fix unused filename parameter in reportProgress TODO
1 parent 478055e commit 35dc158

File tree

9 files changed

+13
-24
lines changed

9 files changed

+13
-24
lines changed

cli/cmdlineparser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ namespace {
136136
(void) metric;
137137
}
138138

139-
void reportProgress(const std::string & /*filename*/, const char /*stage*/[], const std::size_t /*value*/) override
139+
void reportProgress(const char /*stage*/[], const std::size_t /*value*/) override
140140
{}
141141
};
142142
}

cli/cppcheckexecutor.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ namespace {
323323
/** xml output of errors */
324324
void reportErr(const ErrorMessage &msg) override;
325325

326-
void reportProgress(const std::string &filename, const char stage[], std::size_t value) override;
326+
void reportProgress(const char stage[], std::size_t value) override;
327327

328328
/**
329329
* Reference to current settings; set while check() is running for reportError().
@@ -618,11 +618,8 @@ void StdLogger::reportOut(const std::string &outmsg, Color c)
618618
std::cout << c << ansiToOEM(outmsg, true) << Color::Reset << std::endl;
619619
}
620620

621-
// TODO: remove filename parameter?
622-
void StdLogger::reportProgress(const std::string &filename, const char stage[], const std::size_t value)
621+
void StdLogger::reportProgress(const char stage[], const std::size_t value)
623622
{
624-
(void)filename;
625-
626623
if (!mLatestProgressOutputTime)
627624
return;
628625

democlient/democlient.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ class CppcheckExecutor : public ErrorLogger {
8383
}
8484
void reportMetric(const std::string & /*metric*/) override {}
8585

86-
void reportProgress(const std::string& /*filename*/,
87-
const char /*stage*/[],
88-
const std::size_t /*value*/) override {
86+
void reportProgress(const char /*stage*/[], const std::size_t /*value*/) override {
8987
if (std::time(nullptr) >= stoptime) {
9088
std::cout << "Time to analyse the code exceeded 2 seconds. Terminating.\n\n";
9189
Settings::terminate();

lib/cppcheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,9 @@ class CppCheck::CppCheckLogger : public ErrorLogger
263263
mErrorLogger.reportMetric(metric);
264264
}
265265

266-
void reportProgress(const std::string &filename, const char stage[], const std::size_t value) override
266+
void reportProgress(const char stage[], const std::size_t value) override
267267
{
268-
mErrorLogger.reportProgress(filename, stage, value);
268+
mErrorLogger.reportProgress(stage, value);
269269
}
270270

271271
ErrorLogger &mErrorLogger;

lib/errorlogger.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,10 @@ class CPPCHECKLIB ErrorLogger {
249249

250250
/**
251251
* Report progress to client
252-
* @param filename main file that is checked
253252
* @param stage for example preprocess / tokenize / simplify / check
254253
* @param value progress value (0-100)
255254
*/
256-
virtual void reportProgress(const std::string &filename, const char stage[], const std::size_t value) {
257-
(void)filename;
255+
virtual void reportProgress(const char stage[], const std::size_t value) {
258256
(void)stage;
259257
(void)value;
260258
}

lib/symboldatabase.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,7 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
202202
for (const Token *tok = mTokenizer.tokens(); tok; tok = tok ? tok->next() : nullptr) {
203203
// #5593 suggested to add here:
204204
if (doProgress)
205-
mErrorLogger.reportProgress(mTokenizer.list.getSourceFilePath(),
206-
"SymbolDatabase",
207-
tok->progressValue());
205+
mErrorLogger.reportProgress("SymbolDatabase", tok->progressValue());
208206
// Locate next class
209207
if ((tok->isCpp() && tok->isKeyword() &&
210208
((Token::Match(tok, "class|struct|union|namespace ::| %name% final| {|:|::|<") &&

lib/templatesimplifier.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3218,7 +3218,7 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
32183218

32193219
Token * const tok2 = instantiation.token();
32203220
if ((mSettings.reportProgress != -1) && !mTokenList.getFiles().empty())
3221-
mErrorLogger.reportProgress(mTokenList.getFiles()[0], "TemplateSimplifier::simplifyTemplateInstantiations()", tok2->progressValue());
3221+
mErrorLogger.reportProgress("TemplateSimplifier::simplifyTemplateInstantiations()", tok2->progressValue());
32223222

32233223
if (maxtime > 0 && std::time(nullptr) > maxtime) {
32243224
if (mSettings.debugwarnings) {
@@ -3294,7 +3294,7 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
32943294
if (!instantiated && specialized) {
32953295
auto * tok2 = const_cast<Token *>(templateDeclaration.nameToken());
32963296
if ((mSettings.reportProgress != -1) && !mTokenList.getFiles().empty())
3297-
mErrorLogger.reportProgress(mTokenList.getFiles()[0], "TemplateSimplifier::simplifyTemplateInstantiations()", tok2->progressValue());
3297+
mErrorLogger.reportProgress("TemplateSimplifier::simplifyTemplateInstantiations()", tok2->progressValue());
32983298

32993299
if (maxtime > 0 && std::time(nullptr) > maxtime) {
33003300
if (mSettings.debugwarnings) {

lib/tokenize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,7 @@ void Tokenizer::simplifyTypedefCpp()
11371137

11381138
for (Token *tok = list.front(); tok; tok = tok->next()) {
11391139
if (doProgress)
1140-
mErrorLogger.reportProgress(list.getFiles()[0], "Tokenize (typedef)", tok->progressValue());
1140+
mErrorLogger.reportProgress("Tokenize (typedef)", tok->progressValue());
11411141

11421142
if (Settings::terminated())
11431143
return;
@@ -2884,7 +2884,7 @@ bool Tokenizer::simplifyUsing()
28842884

28852885
for (Token *tok = list.front(); tok; tok = tok->next()) {
28862886
if (doProgress)
2887-
mErrorLogger.reportProgress(list.getFiles()[0], "Tokenize (using)", tok->progressValue());
2887+
mErrorLogger.reportProgress("Tokenize (using)", tok->progressValue());
28882888

28892889
if (Settings::terminated())
28902890
return substitute;

oss-fuzz/main.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ class DummyErrorLogger : public ErrorLogger {
4040
public:
4141
void reportOut(const std::string& /*outmsg*/, Color /*c*/) override {}
4242
void reportErr(const ErrorMessage& /*msg*/) override {}
43-
void reportProgress(const std::string& /*filename*/,
44-
const char /*stage*/[],
45-
const std::size_t /*value*/) override {}
43+
void reportProgress(const char /*stage*/[], const std::size_t /*value*/) override {}
4644
void reportMetric(const std::string & /*metric*/) override {}
4745
};
4846

0 commit comments

Comments
 (0)