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::string tmpFile = Path::simplifyPath(file);
|
||||
std::list<Suppression> result;
|
||||
for (const Suppression &s : mSuppressions) {
|
||||
if (s.matched)
|
||||
|
@ -381,7 +382,7 @@ std::list<Suppressions::Suppression> Suppressions::getUnmatchedLocalSuppressions
|
|||
continue;
|
||||
if (!unusedFunctionChecking && s.errorId == "unusedFunction")
|
||||
continue;
|
||||
if (file.empty() || !s.isLocal() || s.fileName != file)
|
||||
if (tmpFile.empty() || !s.isLocal() || s.fileName != tmpFile)
|
||||
continue;
|
||||
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'])
|
||||
assert ret == 1
|
||||
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…
Reference in New Issue