cppcheck icon indicating copy to clipboard operation
cppcheck copied to clipboard

Fix ErrorMessage parsing of XML Symbol Names

Open jsmith-wolve-external opened this issue 11 months ago • 5 comments

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.

jsmith-wolve-external avatar Feb 03 '25 16:02 jsmith-wolve-external

Thanks for your contribution.

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

firewave avatar Feb 03 '25 16:02 firewave

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?

firewave avatar Feb 03 '25 19:02 firewave

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

jsmith-wolve-external avatar Feb 03 '25 20:02 jsmith-wolve-external

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 avatar Feb 03 '25 22:02 firewave

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.

firewave avatar Feb 13 '25 18:02 firewave