Inline suppressions for Cppcheck are possibly harmful #4419
the-risk-taker
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Cppcheck has some nasty implications when encountering "breaking" issues like
syntaxError
- resulting in not performing analysis on every translation unit with "breaking" code. Which, as a result causes us to potentially have undetected problems in the code. Specially if somebody do:Then, when we run the analysis we think that everything is ok, because Cppcheck does not report anything, but under the hood the analysis is not performed at all.
As an example project:
With CMake:
And program:
Calling:
we get:
which is fine - we see that the issue in in the lib, but then we probably do:
and finally we get:
thinking that it's all fine but it's not.
I know that this is the Cppcheck issue not json code problem - but if here, in CI, similar steps as above are done, then probably the Cppcheck analysis is broken 🧐
After slightly breaking the code (removing the comma near the suppress comment - which is wrong, but keeps Cppcheck going) I get more expected results:
I went to the Cppcheck to submit the issue but already somebody has done that: https://trac.cppcheck.net/ticket/12923
Beta Was this translation helpful? Give feedback.
All reactions