Fixed #7455 (Suppressions: not working well with windows path separators)

This commit is contained in:
Daniel Marjamäki 2016-05-23 15:38:47 +02:00
parent 9ea9ae6b87
commit 37afc57a2a
2 changed files with 5 additions and 2 deletions

View File

@ -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<std::string, std::map<unsigned int, bool> >::iterator f = _files.find(file);
std::map<std::string, std::map<unsigned int, bool> >::iterator f = _files.find(Path::fromNativeSeparators(file));
if (f != _files.end()) {
std::map<unsigned int, bool>::iterator l = f->second.find(0U);
if (l != f->second.end()) {
@ -268,7 +268,7 @@ std::list<Suppressions::SuppressionEntry> Suppressions::getUnmatchedLocalSuppres
if (!unusedFunctionChecking && i->first == "unusedFunction")
continue;
std::map<std::string, std::map<unsigned int, bool> >::const_iterator f = i->second._files.find(file);
std::map<std::string, std::map<unsigned int, bool> >::const_iterator f = i->second._files.find(Path::fromNativeSeparators(file));
if (f != i->second._files.end()) {
for (std::map<unsigned int, bool>::const_iterator l = f->second.begin(); l != f->second.end(); ++l) {
if (!l->second) {

View File

@ -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"