diff --git a/cli/cppcheckexecutor.cpp b/cli/cppcheckexecutor.cpp index 20726ca54..fa4f31a47 100644 --- a/cli/cppcheckexecutor.cpp +++ b/cli/cppcheckexecutor.cpp @@ -191,10 +191,10 @@ int CppCheckExecutor::check(int argc, const char* const argv[]) returnValue = executor.check(); } - if (!settings.checkConfiguration) { - if (!settings._errorsOnly) - reportUnmatchedSuppressions(settings.nomsg.getUnmatchedGlobalSuppressions()); + if (settings.isEnabled("information") || settings.checkConfiguration) + reportUnmatchedSuppressions(settings.nomsg.getUnmatchedGlobalSuppressions()); + if (!settings.checkConfiguration) { cppCheck.tooManyConfigsError("",0U); if (settings.isEnabled("missingInclude") && Preprocessor::missingIncludeFlag) { diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index 9d8b41bed..052728df5 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -215,7 +215,7 @@ unsigned int CppCheck::processFile(const std::string& filename) internalError(filename, e.errorMessage); } - if (!_settings._errorsOnly) + if (_settings.isEnabled("information") || _settings.checkConfiguration) reportUnmatchedSuppressions(_settings.nomsg.getUnmatchedLocalSuppressions(filename)); _errorList.clear(); diff --git a/test/testsuppressions.cpp b/test/testsuppressions.cpp index e98d5e513..2a1452a2f 100644 --- a/test/testsuppressions.cpp +++ b/test/testsuppressions.cpp @@ -121,6 +121,7 @@ private: CppCheck cppCheck(*this, true); Settings& settings = cppCheck.settings(); settings._inlineSuppressions = true; + settings.addEnabled("information"); if (!suppression.empty()) { std::string r = settings.nomsg.addSuppressionLine(suppression); ASSERT_EQUALS("", r); @@ -141,6 +142,7 @@ private: Settings settings; settings._jobs = 1; settings._inlineSuppressions = true; + settings.addEnabled("information"); if (!suppression.empty()) { std::string r = settings.nomsg.addSuppressionLine(suppression); ASSERT_EQUALS("", r); @@ -162,6 +164,7 @@ private: CppCheck cppCheck(*this, true); Settings& settings = cppCheck.settings(); settings._inlineSuppressions = true; + settings.addEnabled("information"); if (!suppression.empty()) settings.nomsg.addSuppressionLine(suppression);