Fixed #4618 (Unmatched suppression: don't show this information message unless --enable=information or --check-cfg is used)

This commit is contained in:
Daniel Marjamäki 2013-05-31 15:20:58 +02:00
parent 065853a59a
commit a7da65a40b
3 changed files with 7 additions and 4 deletions

View File

@ -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) {

View File

@ -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();

View File

@ -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);