diff --git a/Makefile b/Makefile
index cacc49f5f..0e2f27822 100644
--- a/Makefile
+++ b/Makefile
@@ -133,7 +133,7 @@ cppcheck: $(LIBOBJ) $(CLIOBJ) $(EXTOBJ)
all: cppcheck testrunner
testrunner: $(TESTOBJ) $(LIBOBJ) $(EXTOBJ) cli/threadexecutor.o cli/cmdlineparser.o cli/cppcheckexecutor.o cli/filelister.o cli/pathmatch.o
- $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o testrunner $(TESTOBJ) $(LIBOBJ) $(EXTOBJ) cli/threadexecutor.o cli/cmdlineparser.o cli/filelister.o cli/pathmatch.o $(LDFLAGS)
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o testrunner $(TESTOBJ) $(LIBOBJ) $(EXTOBJ) cli/threadexecutor.o cli/cppcheckexecutor.o cli/cmdlineparser.o cli/filelister.o cli/pathmatch.o $(LDFLAGS)
test: all
./testrunner
@@ -247,7 +247,7 @@ cli/main.o: cli/main.cpp cli/cppcheckexecutor.h lib/errorlogger.h lib/settings.h
cli/pathmatch.o: cli/pathmatch.cpp cli/pathmatch.h
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_CLI} -c -o cli/pathmatch.o cli/pathmatch.cpp
-cli/threadexecutor.o: cli/threadexecutor.cpp cli/threadexecutor.h lib/settings.h lib/errorlogger.h lib/cppcheck.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h
+cli/threadexecutor.o: cli/threadexecutor.cpp cli/cppcheckexecutor.h lib/errorlogger.h lib/settings.h cli/threadexecutor.h lib/cppcheck.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_CLI} -c -o cli/threadexecutor.o cli/threadexecutor.cpp
test/options.o: test/options.cpp test/options.h
diff --git a/cli/cppcheckexecutor.cpp b/cli/cppcheckexecutor.cpp
index cf8e97729..8e42a96cf 100644
--- a/cli/cppcheckexecutor.cpp
+++ b/cli/cppcheckexecutor.cpp
@@ -165,7 +165,8 @@ int CppCheckExecutor::check(int argc, const char* const argv[])
{
processedsize += _filesizes[_filenames[c]];
}
- reportStatus(c + 1, _filenames.size(), processedsize, totalfilesize);
+ if (!_settings._errorsOnly)
+ reportStatus(c + 1, _filenames.size(), processedsize, totalfilesize);
}
}
else if (!ThreadExecutor::isEnabled())
@@ -234,7 +235,7 @@ void CppCheckExecutor::reportProgress(const std::string &filename, const char st
void CppCheckExecutor::reportStatus(unsigned int fileindex, unsigned int filecount, long sizedone, long sizetotal)
{
- if (filecount > 1 && !_settings._errorsOnly)
+ if (filecount > 1)
{
std::ostringstream oss;
oss << fileindex << "/" << filecount
diff --git a/cli/cppcheckexecutor.h b/cli/cppcheckexecutor.h
index d13f248f7..b507917b6 100644
--- a/cli/cppcheckexecutor.h
+++ b/cli/cppcheckexecutor.h
@@ -72,7 +72,15 @@ public:
void reportProgress(const std::string &filename, const char stage[], const unsigned int value);
- virtual void reportStatus(unsigned int fileindex, unsigned int filecount, long sizedone, long sizetotal);
+ /**
+ * Information about how many files have been checked
+ *
+ * @param fileindex This many files have been checked.
+ * @param filecount This many files there are in total.
+ * @param sizedone The sum of sizes of the files checked.
+ * @param sizetotal The total sizes of the files.
+ */
+ static void reportStatus(unsigned int fileindex, unsigned int filecount, long sizedone, long sizetotal);
protected:
diff --git a/cli/threadexecutor.cpp b/cli/threadexecutor.cpp
index 6d22ea2fc..287c3d03a 100644
--- a/cli/threadexecutor.cpp
+++ b/cli/threadexecutor.cpp
@@ -16,6 +16,7 @@
* along with this program. If not, see .
*/
+#include "cppcheckexecutor.h"
#include "threadexecutor.h"
#include "cppcheck.h"
#include
@@ -243,7 +244,8 @@ unsigned int ThreadExecutor::check()
_fileCount++;
processedsize += size;
- _errorLogger.reportStatus(_fileCount, _filenames.size(), processedsize, totalfilesize);
+ if (!_settings._errorsOnly)
+ CppCheckExecutor::reportStatus(_fileCount, _filenames.size(), processedsize, totalfilesize);
close(*rp);
rp = rpipes.erase(rp);
@@ -323,11 +325,6 @@ void ThreadExecutor::reportErr(const ErrorLogger::ErrorMessage &msg)
writeToPipe('2', msg.serialize());
}
-void ThreadExecutor::reportStatus(unsigned int /*fileindex*/, unsigned int /*filecount*/, long /*sizedone*/, long /*sizetotal*/)
-{
- // Not used
-}
-
#else
unsigned int ThreadExecutor::check()
{
@@ -343,8 +340,4 @@ void ThreadExecutor::reportErr(const ErrorLogger::ErrorMessage &/*msg*/)
}
-void ThreadExecutor::reportStatus(unsigned int /*fileindex*/, unsigned int /*filecount*/, long /*sizedone*/, long /*sizetotal*/)
-{
-
-}
#endif
diff --git a/cli/threadexecutor.h b/cli/threadexecutor.h
index acb590f62..8a29c6068 100644
--- a/cli/threadexecutor.h
+++ b/cli/threadexecutor.h
@@ -44,7 +44,7 @@ public:
unsigned int check();
virtual void reportOut(const std::string &outmsg);
virtual void reportErr(const ErrorLogger::ErrorMessage &msg);
- virtual void reportStatus(unsigned int fileindex, unsigned int filecount, long sizedone, long sizetotal);
+
/**
* @brief Add content to a file, to be used in unit testing.
*
diff --git a/gui/threadresult.cpp b/gui/threadresult.cpp
index 369a20e56..dc1545800 100644
--- a/gui/threadresult.cpp
+++ b/gui/threadresult.cpp
@@ -91,15 +91,6 @@ QString ThreadResult::GetNextFile()
return mFiles.takeFirst();
}
-
-void ThreadResult::reportStatus(unsigned int fileindex, unsigned int filecount, FileLister::filesize_t sizedone, FileLister::filesize_t sizetotal)
-{
- Q_UNUSED(fileindex);
- Q_UNUSED(filecount);
- Q_UNUSED(sizedone);
- Q_UNUSED(sizetotal);
-}
-
void ThreadResult::SetFiles(const QStringList &files)
{
QMutexLocker locker(&mutex);
diff --git a/gui/threadresult.h b/gui/threadresult.h
index 996d998f5..1ec853085 100644
--- a/gui/threadresult.h
+++ b/gui/threadresult.h
@@ -71,7 +71,7 @@ public:
*/
void reportOut(const std::string &outmsg);
void reportErr(const ErrorLogger::ErrorMessage &msg);
- void reportStatus(unsigned int fileindex, unsigned int filecount, FileLister::filesize_t sizedone, FileLister::filesize_t sizetotal);
+
public slots:
/**
diff --git a/lib/errorlogger.h b/lib/errorlogger.h
index bfbde8caa..ced5ed633 100644
--- a/lib/errorlogger.h
+++ b/lib/errorlogger.h
@@ -272,16 +272,6 @@ public:
*/
virtual void reportErr(const ErrorLogger::ErrorMessage &msg) = 0;
- /**
- * Information about how many files have been checked
- *
- * @param fileindex This many files have been checked.
- * @param filecount This many files there are in total.
- * @param sizedone The sum of sizes of the files checked.
- * @param sizetotal The total sizes of the files.
- */
- virtual void reportStatus(unsigned int fileindex, unsigned int filecount, long sizedone, long sizetotal) = 0;
-
/**
* Report progress to client
* @param filename main file that is checked
diff --git a/test/testother.cpp b/test/testother.cpp
index ee46ad0af..21f296301 100644
--- a/test/testother.cpp
+++ b/test/testother.cpp
@@ -179,10 +179,6 @@ private:
if (!msg._callStack.empty() && !_settings.nomsg.isSuppressed(msg._id, msg._callStack.begin()->getfile(), msg._callStack.begin()->line))
_next->reportErr(msg);
}
- virtual void reportStatus(unsigned int fileindex, unsigned int filecount, long sizedone, long sizetotal)
- {
- _next->reportStatus(fileindex, filecount, sizedone, sizetotal);
- }
private:
Settings &_settings;
ErrorLogger *_next;
diff --git a/test/testsuppressions.cpp b/test/testsuppressions.cpp
index 7a71ed5f9..2570321db 100644
--- a/test/testsuppressions.cpp
+++ b/test/testsuppressions.cpp
@@ -19,6 +19,7 @@
#include "cppcheck.h"
#include "settings.h"
#include "testsuite.h"
+#include "cppcheckexecutor.h"
#include "threadexecutor.h"
#include
diff --git a/test/testthreadexecutor.cpp b/test/testthreadexecutor.cpp
index e6d14e482..cf374b0d1 100644
--- a/test/testthreadexecutor.cpp
+++ b/test/testthreadexecutor.cpp
@@ -24,6 +24,7 @@
#include "cppcheck.h"
#include "testsuite.h"
#include "threadexecutor.h"
+#include "cppcheckexecutor.h"
#include
#include