I'm looking a bit into https://trac.cppcheck.net/ticket/10489 and I think I found the issue and a very hacky solution, but I'm looking for input for the correct solution.
This is due to the -j 2 flag. If I compare it with a suppressed regular error, I notice that those go through ThreadExecutor::SyncLogForwarder, which somehow synchonizes messages betwee threads (?). missingInclude (and missingSystemInclude) do not go through SyncLogForwarder, and therefore its suppression-match-status gets lost when the thread ends.
I put together kind of a fix, but I think it is just a hack, and I have no idea if i really makes sense. Diff is added (based upon current main, 4ce76d0b).
Basically, I added a virtual function to ErrorLogger so that in Preprocessor::missingInclude I can call that function so the suppression-state get propagated through SyncLogForwarder.
Is this the right direction? What should be the implementations? Should all calls to mSettings.nomsg.isSuppressed(errorMessage) actually be calls to the new function?
Hi,
I'm looking a bit into https://trac.cppcheck.net/ticket/10489 and I think I found the issue and a very hacky solution, but I'm looking for input for the correct solution.
Problem:
with this code
and calling it with
yields
This is due to the
-j 2
flag. If I compare it with a suppressed regular error, I notice that those go throughThreadExecutor::SyncLogForwarder
, which somehow synchonizes messages betwee threads (?).missingInclude
(andmissingSystemInclude
) do not go throughSyncLogForwarder
, and therefore its suppression-match-status gets lost when the thread ends.I put together kind of a fix, but I think it is just a hack, and I have no idea if i really makes sense. Diff is added (based upon current main, 4ce76d0b).
Basically, I added a virtual function to
ErrorLogger
so that inPreprocessor::missingInclude
I can call that function so the suppression-state get propagated throughSyncLogForwarder
.Is this the right direction? What should be the implementations? Should all calls to
mSettings.nomsg.isSuppressed(errorMessage)
actually be calls to the new function?could you please create a github pull request. that is easier to review.
Sure, https://github.com/danmar/cppcheck/pull/4586