Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ErrorMessage parsing of XML Symbol Names #7277

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jsmith-wolve-external
Copy link

@jsmith-wolve-external jsmith-wolve-external commented Feb 3, 2025

XML-cached errors containing multiple symbol names are not stored correctly in the internal string data member with newline delimiters. This results in the symbol names becoming concatenated. In turn, suppressing them does not work when those cached files from the build directory are used instead of full analysis.

XML-cached errors containing multiple symbol names are not stored correctly in the internal string data member with newline delimiters.
This results in the symbol names becoming concatenated. As a result, suppressing them breaks when those cached files are used instead of full analysis.
@firewave
Copy link
Collaborator

firewave commented Feb 3, 2025

Thanks for your contribution.

This lacks tests. I think you "just" need to extend the tests added in #7142.

@firewave
Copy link
Collaborator

firewave commented Feb 3, 2025

Since this involves the builddir we also need to add a Python test which generates cached data with such messages. It is possible that a case involving this already exists and it still fails with the changes in #7079 but I do not remember such. I have not checked all failures in that other PR yet because there are still open known issues related to it.

How did you come across this? Is there a message with multiple symbols in Cppcheck already (I did not check yet) or did you add one by yourself?

@jsmith-wolve-external
Copy link
Author

jsmith-wolve-external commented Feb 3, 2025

Working on adding a python test as well to the other_test.py file, unless you would like it placed somewhere else.

Came across this when I added a XML suppression file to an existing workflow that had a build-dir already. I suppressed errors for duplicate members by exact symbol name and the first pass with cppcheck showed them properly hidden. However, on a subsequent run, the errors re-appeared in unchanged files. After looking at it closer, I noticed the symbol field seemed weirdly concatenated (ex: "MyFirstClassMyFunctionMySecondClass") which would explain the suppressions not getting applied. Applying this change to the 2.16 version of the code base shows the behavior fixed.

One ID for an error that can have multiple symbols is "duplInheritedMember".

@firewave
Copy link
Collaborator

firewave commented Feb 3, 2025

Working on adding a python test as well to the other_test.py file, unless you would like it placed somewhere else.

No, that is the current grab bag for random tests.

I suppressed errors for duplicate members by exact symbol name and the first pass with cppcheck showed them properly hidden.

Right, suppressions can have symbols. I had a quick look and it seemed you cannot set those externally so I did have a deeper look. It is possible those are currently not tested at all. But that does not need to be resolved in this PR.

@firewave
Copy link
Collaborator

I suppressed errors for duplicate members by exact symbol name and the first pass with cppcheck showed them properly hidden.

Right, suppressions can have symbols. I had a quick look and it seemed you cannot set those externally so I did have a deeper look. It is possible those are currently not tested at all. But that does not need to be resolved in this PR.

FYI after #5647 has been merged I might be looking into this (or at least writing some tests) in my ongoing suppression work.

Copy link
Owner

@danmar danmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix looks fine but I want some testing.. as you already have discussed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants