From d76861270abee49688ed6b90fbb0e1a798443d0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 29 Jun 2011 20:23:39 +0200 Subject: [PATCH] Fixed #2797 (Inline suppressions do not handle filenames correctly) --- lib/settings.cpp | 3 ++- test/testsettings.cpp | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/settings.cpp b/lib/settings.cpp index 784b000dc..c51fac185 100644 --- a/lib/settings.cpp +++ b/lib/settings.cpp @@ -17,6 +17,7 @@ */ #include "settings.h" +#include "path.h" #include #include @@ -224,7 +225,7 @@ std::string Settings::Suppressions::FileMatcher::addFile(const std::string &name } else { - _files[name][line] = false; + _files[Path::simplifyPath(name.c_str())][line] = false; } return ""; } diff --git a/test/testsettings.cpp b/test/testsettings.cpp index 078324be2..447d7aa52 100644 --- a/test/testsettings.cpp +++ b/test/testsettings.cpp @@ -37,6 +37,7 @@ private: TEST_CASE(suppressionsDosFormat); // Ticket #1836 TEST_CASE(suppressionsFileNameWithColon); // Ticket #1919 - filename includes colon TEST_CASE(suppressionsGlob); + TEST_CASE(suppressionsFileNameWithExtraPath); } void suppressionsBadId1() @@ -99,6 +100,14 @@ private: ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "abc.cpp", 2)); } } + + void suppressionsFileNameWithExtraPath() + { + // Ticket #2797 + Settings::Suppressions suppressions; + suppressions.addSuppression("errorid", "./a.c", 123); + ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "a.c", 123)); + } }; REGISTER_TEST(TestSettings)