Repository navigation
Conversation
…d dir ErrorMessage stores symbol names newline-separated. toXML() writes one <symbol> element per name, but the XML constructor appended them without the separator, so results reloaded from --cppcheck-build-dir had a single concatenated symbol name and symbolName suppressions no longer matched.
Contributor
|
There should probably be a trac ticket for this PR. Please create it, or ask us to create it. Then the PR title should be updated. |
Author
|
I don't have a Trac account, can you please help me create the ticket? EDIT: I also sent you a Trac message to make an account |
Author
|
Trac account created, ticket made, PR title updated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With
--cppcheck-build-dir, a finding suppressed through an XML<symbolName>suppression is suppressed on the first run, but reported again on every rerun of an unchanged file (i.e. whenever results are loaded from the build dir).I don't have a Trac account, so there is no ticket for this yet. Happy to have one filed and linked.
Reproduction
test.cpp:suppr.xml:Reproduces with 2.19.0 and current
main. Onmainit also happens with-j1.Cause
ErrorMessagekeeps its symbol names newline-separated (setmsg()keeps the\nfrom each$symbol:line, giving e.g."Derived\ninit\nBase\n"), andtoXML()writes one<symbol>element per name, so the cached.a1file is correct. However, theErrorMessage(const tinyxml2::XMLElement*)constructor used when loading those results appends the names without the separator (mSymbolNames += e->GetText();), producing"DerivedinitBase".SuppressionList::Suppression::isMatch()splitssymbolNameson\n, so the suppression no longer matches.Fix
Append the
\nseparator for each<symbol>element in the XML constructor.Tests
TestErrorLogger::FromXmlSymbolNames: round trip throughtoXML()and the XML constructor keepssymbolNames()intact (fails without the fix:sym1sym2instead ofsym1\nsym2\n).test/cli/other_test.py:test_suppress_xml_symbolname*, running with and without the build dir,-j1and-j2, twice each. The two cached variants fail without the fix.Ran
testrunner(all pass) plustest/cli/other_test.py,inline-suppress_test.pyandwhole-program_test.pylocally. The only failures were the--ruletests, because my local build has no rules support.