From 37afc57a2a051e979b9e4136722897487da1348e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 23 May 2016 15:38:47 +0200 Subject: [PATCH] Fixed #7455 (Suppressions: not working well with windows path separators) --- lib/suppressions.cpp | 4 ++-- test/testsuppressions.cpp | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/suppressions.cpp b/lib/suppressions.cpp index dc38413cd..0fe21f3c5 100644 --- a/lib/suppressions.cpp +++ b/lib/suppressions.cpp @@ -198,7 +198,7 @@ bool Suppressions::FileMatcher::isSuppressed(const std::string &file, unsigned i bool Suppressions::FileMatcher::isSuppressedLocal(const std::string &file, unsigned int line) { - std::map >::iterator f = _files.find(file); + std::map >::iterator f = _files.find(Path::fromNativeSeparators(file)); if (f != _files.end()) { std::map::iterator l = f->second.find(0U); if (l != f->second.end()) { @@ -268,7 +268,7 @@ std::list Suppressions::getUnmatchedLocalSuppres if (!unusedFunctionChecking && i->first == "unusedFunction") continue; - std::map >::const_iterator f = i->second._files.find(file); + std::map >::const_iterator f = i->second._files.find(Path::fromNativeSeparators(file)); if (f != i->second._files.end()) { for (std::map::const_iterator l = f->second.begin(); l != f->second.end(); ++l) { if (!l->second) { diff --git a/test/testsuppressions.cpp b/test/testsuppressions.cpp index 88bf99a79..c3d45439a 100644 --- a/test/testsuppressions.cpp +++ b/test/testsuppressions.cpp @@ -345,6 +345,9 @@ private: Suppressions suppressions; suppressions.addSuppressionLine("*:test\\*"); ASSERT_EQUALS(true, suppressions.isSuppressed("someid", "test/foo/bar.cpp", 142)); + + suppressions.addSuppressionLine("abc:include/1.h"); + ASSERT_EQUALS(true, suppressions.isSuppressed("abc", "include\\1.h", 142)); } void inlinesuppress_unusedFunction() const { // #4210, #4946 - wrong report of "unmatchedSuppression" for "unusedFunction"