Skip to content

Commit 112873e

Browse files
author
Daniel Marjamäki
committed
Revert "Fixed danmar#3450 (CLI --report-progress is currently useless)"
This reverts commit e769fe6.
1 parent e769fe6 commit 112873e

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

cli/cmdlineparser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
412412

413413
// Report progress
414414
else if (strcmp(argv[i], "--report-progress") == 0) {
415-
_settings->reportProgressTime = 10;
415+
_settings->reportProgress = true;
416416
}
417417

418418
// --std

cli/cppcheckexecutor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ int CppCheckExecutor::check(int argc, const char* const argv[])
161161
return EXIT_FAILURE;
162162
}
163163

164-
if (_settings.reportProgressTime > 0)
164+
if (cppCheck.settings().reportProgress)
165165
time1 = std::time(0);
166166

167167
_settings = cppCheck.settings();
@@ -247,12 +247,12 @@ void CppCheckExecutor::reportProgress(const std::string &filename, const char st
247247
{
248248
(void)filename;
249249

250-
if (_settings.reportProgressTime == 0)
250+
if (!time1)
251251
return;
252252

253253
// Report progress messages every 10 seconds
254254
const std::time_t time2 = std::time(NULL);
255-
if (time2 >= (time1 + _settings.reportProgressTime)) {
255+
if (time2 >= (time1 + 10)) {
256256
time1 = time2;
257257

258258
// current time in the format "Www Mmm dd hh:mm:ss yyyy"

lib/settings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Settings::Settings()
4343
inconclusive = false;
4444
experimental = false;
4545
test_2_pass = false;
46-
reportProgressTime = 0;
46+
reportProgress = false;
4747
ifcfg = false;
4848
checkConfiguration = false;
4949

lib/settings.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ class Settings {
156156
/** @brief Experimental 2 pass checking of files */
157157
bool test_2_pass;
158158

159-
/** @brief 0 => don't report progress. 1-.. => report progress every T seconds */
160-
unsigned char reportProgressTime;
159+
/** @brief --report-progress */
160+
bool reportProgress;
161161

162162
/**
163163
* @brief Is there any preprocessor configurations in the source code?

test/testcmdlineparser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ class TestCmdlineParser : public TestFixture {
616616
Settings settings;
617617
CmdLineParser parser(&settings);
618618
ASSERT(parser.ParseFromArgs(3, argv));
619-
ASSERT_EQUALS(10U, settings.reportProgressTime);
619+
ASSERT(settings.reportProgress);
620620
}
621621

622622
void stdposix() {

0 commit comments

Comments
 (0)