Skip to content

Commit b929737

Browse files
committed
fixed #14248 - suppressions with subpath not reported as unmatched
1 parent 7c36fae commit b929737

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

lib/suppressions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ std::list<SuppressionList::Suppression> SuppressionList::getUnmatchedLocalSuppre
569569
continue;
570570
if (s.errorId == ID_CHECKERSREPORT)
571571
continue;
572-
if (!s.isLocal() || s.fileName != file.spath())
572+
if (!s.isLocal() || !PathMatch::match(s.fileName, file.spath()))
573573
continue;
574574
result.push_back(s);
575575
}

test/cli/other_test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3844,5 +3844,10 @@ def test_unmatched_file(tmp_path):
38443844
ret, stdout, stderr = cppcheck(args)
38453845
assert stdout == ''
38463846
assert stderr.splitlines() == [
3847+
'lib/test.c:-1:0: information: Unmatched suppression: error [unmatchedSuppression]',
3848+
'lib/test.c:-1:0: information: Unmatched suppression: error2 [unmatchedSuppression]',
3849+
'lib/test.c:-1:0: information: Unmatched suppression: error3 [unmatchedSuppression]',
3850+
'lib/test.c:-1:0: information: Unmatched suppression: error5 [unmatchedSuppression]',
3851+
'lib/test.c:-1:0: information: Unmatched suppression: error6 [unmatchedSuppression]'
38473852
]
38483853
assert ret == 0, stdout

0 commit comments

Comments
 (0)