From 220effee6ad9960cb979c4aa56a15a8ed485fca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 12 Jul 2022 23:07:57 +0200 Subject: [PATCH] Fixed #11172 (Unmatched suppression for inline suppression even though --suppress=unmatchedSuppression is used) --- cli/cppcheckexecutor.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cli/cppcheckexecutor.cpp b/cli/cppcheckexecutor.cpp index 69aea810c..d2c549cc1 100644 --- a/cli/cppcheckexecutor.cpp +++ b/cli/cppcheckexecutor.cpp @@ -979,7 +979,12 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck) cppcheck.analyseWholeProgram(mSettings->buildDir, mFiles); - if (settings.severity.isEnabled(Severity::information) || settings.checkConfiguration) { + bool suppressUnmatchedSuppressions = false; + for (const Suppressions::Suppression& suppression: settings.nomsg.getSuppressions()) { + if (suppression.errorId == "unmatchedSuppression" && suppression.fileName.empty() && suppression.lineNumber == Suppressions::Suppression::NO_LINE) + suppressUnmatchedSuppressions = true; + } + if (!suppressUnmatchedSuppressions && (settings.severity.isEnabled(Severity::information) || settings.checkConfiguration)) { const bool enableUnusedFunctionCheck = cppcheck.isUnusedFunctionCheckEnabled(); if (settings.jointSuppressionReport) {