Merge pull request #2727 from jpyllman/fix_simplifypath
fix use simplifyPath() to make sure file name is same as in the checks
This commit is contained in:
commit
87643ea882
@ -373,6 +373,7 @@ void Suppressions::dump(std::ostream & out) const
|
|||||||
|
|
||||||
std::list<Suppressions::Suppression> Suppressions::getUnmatchedLocalSuppressions(const std::string &file, const bool unusedFunctionChecking) const
|
std::list<Suppressions::Suppression> Suppressions::getUnmatchedLocalSuppressions(const std::string &file, const bool unusedFunctionChecking) const
|
||||||
{
|
{
|
||||||
|
std::string tmpFile = Path::simplifyPath(file);
|
||||||
std::list<Suppression> result;
|
std::list<Suppression> result;
|
||||||
for (const Suppression &s : mSuppressions) {
|
for (const Suppression &s : mSuppressions) {
|
||||||
if (s.matched)
|
if (s.matched)
|
||||||
@ -381,7 +382,7 @@ std::list<Suppressions::Suppression> Suppressions::getUnmatchedLocalSuppressions
|
|||||||
continue;
|
continue;
|
||||||
if (!unusedFunctionChecking && s.errorId == "unusedFunction")
|
if (!unusedFunctionChecking && s.errorId == "unusedFunction")
|
||||||
continue;
|
continue;
|
||||||
if (file.empty() || !s.isLocal() || s.fileName != file)
|
if (tmpFile.empty() || !s.isLocal() || s.fileName != tmpFile)
|
||||||
continue;
|
continue;
|
||||||
result.push_back(s);
|
result.push_back(s);
|
||||||
}
|
}
|
||||||
|
@ -19,3 +19,8 @@ def test_unmatched_suppression():
|
|||||||
ret, stdout, stderr = cppcheck(['--inline-suppr', '--enable=information', '--error-exitcode=1', 'proj-inline-suppress/2.c'])
|
ret, stdout, stderr = cppcheck(['--inline-suppr', '--enable=information', '--error-exitcode=1', 'proj-inline-suppress/2.c'])
|
||||||
assert ret == 1
|
assert ret == 1
|
||||||
assert 'Unmatched suppression: some_warning_id' in stderr
|
assert 'Unmatched suppression: some_warning_id' in stderr
|
||||||
|
|
||||||
|
def test_unmatched_suppression_path_with_extra_stuf():
|
||||||
|
ret, stdout, stderr = cppcheck(['--inline-suppr', '--enable=information', '--error-exitcode=1', './proj-inline-suppress/2.c'])
|
||||||
|
assert ret == 1
|
||||||
|
assert 'Unmatched suppression: some_warning_id' in stderr
|
||||||
|
Loading…
x
Reference in New Issue
Block a user