Skip to content
Merged
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
6 changes: 3 additions & 3 deletions cli/cppcheckexecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,13 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck)
unsigned int returnValue = 0;
if (settings.useSingleJob()) {
// Single process
SingleExecutor executor(cppcheck, mFiles, settings, *this);
SingleExecutor executor(cppcheck, mFiles, settings, settings.nomsg, *this);
returnValue = executor.check();
} else {
#if defined(THREADING_MODEL_THREAD)
ThreadExecutor executor(mFiles, settings, *this);
ThreadExecutor executor(mFiles, settings, settings.nomsg, *this);
#elif defined(THREADING_MODEL_FORK)
ProcessExecutor executor(mFiles, settings, *this);
ProcessExecutor executor(mFiles, settings, settings.nomsg, *this);
#endif
returnValue = executor.check();
}
Expand Down
6 changes: 3 additions & 3 deletions cli/executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
#include <sstream> // IWYU pragma: keep
#include <utility>

Executor::Executor(const std::map<std::string, std::size_t> &files, Settings &settings, ErrorLogger &errorLogger)
: mFiles(files), mSettings(settings), mErrorLogger(errorLogger)
Executor::Executor(const std::map<std::string, std::size_t> &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger)
: mFiles(files), mSettings(settings), mSuppressions(suppressions), mErrorLogger(errorLogger)
{}

Executor::~Executor()
{}

bool Executor::hasToLog(const ErrorMessage &msg)
{
if (!mSettings.nomsg.isSuppressed(msg))
if (!mSuppressions.isSuppressed(msg))
{
std::string errmsg = msg.toString(mSettings.verbose);

Expand Down
6 changes: 4 additions & 2 deletions cli/executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
class Settings;
class ErrorLogger;
class ErrorMessage;
class Suppressions;

/// @addtogroup CLI
/// @{
Expand All @@ -38,7 +39,7 @@ class ErrorMessage;
*/
class Executor {
public:
Executor(const std::map<std::string, std::size_t> &files, Settings &settings, ErrorLogger &errorLogger);
Executor(const std::map<std::string, std::size_t> &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger);
virtual ~Executor();

Executor(const Executor &) = delete;
Expand All @@ -65,7 +66,8 @@ class Executor {
bool hasToLog(const ErrorMessage &msg);

const std::map<std::string, std::size_t> &mFiles;
Settings &mSettings;
const Settings &mSettings;
Suppressions &mSuppressions;
ErrorLogger &mErrorLogger;

private:
Expand Down
6 changes: 3 additions & 3 deletions cli/processexecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ enum class Color;
using std::memset;


ProcessExecutor::ProcessExecutor(const std::map<std::string, std::size_t> &files, Settings &settings, ErrorLogger &errorLogger)
: Executor(files, settings, errorLogger)
ProcessExecutor::ProcessExecutor(const std::map<std::string, std::size_t> &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger)
: Executor(files, settings, suppressions, errorLogger)
{
assert(mSettings.jobs > 1);
}
Expand Down Expand Up @@ -391,7 +391,7 @@ void ProcessExecutor::reportInternalChildErr(const std::string &childname, const
"cppcheckError",
Certainty::normal);

if (!mSettings.nomsg.isSuppressed(errmsg))
if (!mSuppressions.isSuppressed(errmsg))
mErrorLogger.reportErr(errmsg);
}

Expand Down
3 changes: 2 additions & 1 deletion cli/processexecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

class Settings;
class ErrorLogger;
class Suppressions;

/// @addtogroup CLI
/// @{
Expand All @@ -37,7 +38,7 @@ class ErrorLogger;
*/
class ProcessExecutor : public Executor {
public:
ProcessExecutor(const std::map<std::string, std::size_t> &files, Settings &settings, ErrorLogger &errorLogger);
ProcessExecutor(const std::map<std::string, std::size_t> &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger);
ProcessExecutor(const ProcessExecutor &) = delete;
~ProcessExecutor() override;
void operator=(const ProcessExecutor &) = delete;
Expand Down
4 changes: 2 additions & 2 deletions cli/singleexecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

class ErrorLogger;

SingleExecutor::SingleExecutor(CppCheck &cppcheck, const std::map<std::string, std::size_t> &files, Settings &settings, ErrorLogger &errorLogger)
: Executor(files, settings, errorLogger)
SingleExecutor::SingleExecutor(CppCheck &cppcheck, const std::map<std::string, std::size_t> &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger)
: Executor(files, settings, suppressions, errorLogger)
, mCppcheck(cppcheck)
{
assert(mSettings.jobs == 1);
Expand Down
3 changes: 2 additions & 1 deletion cli/singleexecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
class ErrorLogger;
class Settings;
class CppCheck;
class Suppressions;

class SingleExecutor : public Executor
{
public:
SingleExecutor(CppCheck &cppcheck, const std::map<std::string, std::size_t> &files, Settings &settings, ErrorLogger &errorLogger);
SingleExecutor(CppCheck &cppcheck, const std::map<std::string, std::size_t> &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger);
SingleExecutor(const SingleExecutor &) = delete;
~SingleExecutor() override;
void operator=(const SingleExecutor &) = delete;
Expand Down
4 changes: 2 additions & 2 deletions cli/threadexecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@

enum class Color;

ThreadExecutor::ThreadExecutor(const std::map<std::string, std::size_t> &files, Settings &settings, ErrorLogger &errorLogger)
: Executor(files, settings, errorLogger)
ThreadExecutor::ThreadExecutor(const std::map<std::string, std::size_t> &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger)
: Executor(files, settings, suppressions, errorLogger)
{
assert(mSettings.jobs > 1);
}
Expand Down
3 changes: 2 additions & 1 deletion cli/threadexecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

class Settings;
class ErrorLogger;
class Suppressions;

/// @addtogroup CLI
/// @{
Expand All @@ -37,7 +38,7 @@ class ErrorLogger;
*/
class ThreadExecutor : public Executor {
public:
ThreadExecutor(const std::map<std::string, std::size_t> &files, Settings &settings, ErrorLogger &errorLogger);
ThreadExecutor(const std::map<std::string, std::size_t> &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger);
ThreadExecutor(const ThreadExecutor &) = delete;
~ThreadExecutor() override;
void operator=(const ThreadExecutor &) = delete;
Expand Down
2 changes: 1 addition & 1 deletion test/testprocessexecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class TestProcessExecutor : public TestFixture {
if (plistOutput)
settings.plistOutput = plistOutput;
// TODO: test with settings.project.fileSettings;
ProcessExecutor executor(filemap, settings, *this);
ProcessExecutor executor(filemap, settings, settings.nomsg, *this);
std::vector<std::unique_ptr<ScopedFile>> scopedfiles;
scopedfiles.reserve(filemap.size());
for (std::map<std::string, std::size_t>::const_iterator i = filemap.cbegin(); i != filemap.cend(); ++i)
Expand Down
2 changes: 1 addition & 1 deletion test/testsingleexecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class TestSingleExecutorBase : public TestFixture {
filemap.clear();

// TODO: test with settings.project.fileSettings;
SingleExecutor executor(cppcheck, filemap, settings, *this);
SingleExecutor executor(cppcheck, filemap, settings, settings.nomsg, *this);
ASSERT_EQUALS(result, executor.check());
}

Expand Down
6 changes: 3 additions & 3 deletions test/testsuppressions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class TestSuppressions : public TestFixture {
if (!suppression.empty()) {
EXPECT_EQ("", settings.nomsg.addSuppressionLine(suppression));
}
SingleExecutor executor(cppCheck, files, settings, *this);
SingleExecutor executor(cppCheck, files, settings, settings.nomsg, *this);
std::vector<std::unique_ptr<ScopedFile>> scopedfiles;
scopedfiles.reserve(files.size());
for (std::map<std::string, std::string>::const_iterator i = f.cbegin(); i != f.cend(); ++i)
Expand All @@ -233,7 +233,7 @@ class TestSuppressions : public TestFixture {
if (!suppression.empty()) {
EXPECT_EQ("", settings.nomsg.addSuppressionLine(suppression));
}
ThreadExecutor executor(files, settings, *this);
ThreadExecutor executor(files, settings, settings.nomsg, *this);
std::vector<std::unique_ptr<ScopedFile>> scopedfiles;
scopedfiles.reserve(files.size());
for (std::map<std::string, std::size_t>::const_iterator i = files.cbegin(); i != files.cend(); ++i)
Expand Down Expand Up @@ -261,7 +261,7 @@ class TestSuppressions : public TestFixture {
if (!suppression.empty()) {
EXPECT_EQ("", settings.nomsg.addSuppressionLine(suppression));
}
ProcessExecutor executor(files, settings, *this);
ProcessExecutor executor(files, settings, settings.nomsg, *this);
std::vector<std::unique_ptr<ScopedFile>> scopedfiles;
scopedfiles.reserve(files.size());
for (std::map<std::string, std::size_t>::const_iterator i = files.cbegin(); i != files.cend(); ++i)
Expand Down
2 changes: 1 addition & 1 deletion test/testthreadexecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class TestThreadExecutor : public TestFixture {
if (plistOutput)
settings1.plistOutput = plistOutput;
// TODO: test with settings.project.fileSettings;
ThreadExecutor executor(filemap, settings1, *this);
ThreadExecutor executor(filemap, settings1, settings1.nomsg, *this);
std::vector<std::unique_ptr<ScopedFile>> scopedfiles;
scopedfiles.reserve(filemap.size());
for (std::map<std::string, std::size_t>::const_iterator i = filemap.cbegin(); i != filemap.cend(); ++i)
Expand Down