-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
updated Cppcheck to 2.12.1 / provide more includes to Cppcheck #2785
Conversation
There's several more includes to add but I wanted to keep it to the basics first. I still have to look into the And I will prepare an upstream PR for the warnings in |
Thanks @firewave A couple of initial comments. This isn't a full review, but I like what you're doing here.
|
7741c7e
to
6d318e8
Compare
It is a bit steep though. I will take a look into it. Maybe there is something to improve upstream.
Done. Upstream PR will follow soon. |
6d318e8
to
11d2ceb
Compare
The |
11d2ceb
to
9320300
Compare
This is complete for now. Please have a close look at the I will let it soak for a day before I will flag it as ready so I can have a fresh look at it tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of comments. Your changes to the clipboard code look fine to me. There may be some other dragons in this code, but let's not worry about those now.
@@ -45,6 +45,7 @@ if [ -z "$CPPCHECK_FLAGS" ]; then | |||
CPPCHECK_FLAGS="--quiet --force --std=c11 --std=c++11 --inline-suppr \ | |||
--enable=warning --error-exitcode=1 -i third_party \ | |||
--suppress=uninitMemberVar:ulalaca/ulalaca.cpp \ | |||
--suppress=shiftTooManyBits:libxrdp/xrdp_mppc_enc.c \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I'd prefer to add this inline to the code - see (e.g.) sesman/chansrv/chansrv_fuse.c:2779
for an example. Or is there a good reason why it's better here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No real reason. Possibly because it is several warnings and I suppressed the other ones like this.
sesman/chansrv/clipboard.c
Outdated
if (cptr == NULL) | ||
{ | ||
g_free(g_clip_s2c.data); | ||
g_clip_s2c.data = 0; | ||
|
||
/* cannot add any more data */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this comment to start of block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
d970bd2
to
13a6be0
Compare
To mitigate the performance regression a bit I build Cppcheck with Boost enabled. To make sure it is being rebuild I added There are possible further optimizations like LTO, |
That's a worthwhile optimisation. As it happens cppcheck 2.12.0 has been released today (I've got a watch on the repo for new releases). I've just run 2.12.0 over the existing devel branch and using the existing scripts no new errors were found. Do you want to add 2.12.0 support in to this PR? We can then merge it in one go. |
I also just realized you are not using the matchcompiler. Will add it as well.
Already done. Unfortunately the performance regressions in 2.12 (caused by more coverage in the analysis) are more than doubling the analysis time... |
455a5e2
to
dce3312
Compare
With the matchcompiled code this drops from > 15 minutes to ~9 Minutes. |
@firewave - this PR is still in draft. Are you proposing to move it out of draft? PS: cppcheck 2.12.1 has just bee released, but I don't think it's relevant here. |
Sure. I was still waiting for feedback. Also I saw that you are using merge commits. That would lead to all the individual commits to show up which might not be intended. So far I have mainly worked on projects with "squash merge" and only did the commits so the changes are easier to track. What the desired results of this merge?
I could update. That would also allow me to drop the |
Well, I'm OK with this so I'd be happy to merge it. I can't do that until it's out of draft. By all means update to 2.12.1 if that makes things easier. In terms of commits, are you able to re-arrange to 2 - one for the 2.12.1 update and one for the other changes? If not let me know and we'll work something else out. |
Not easier but will get rid of a unnecessary nit. Will do.
Will do as well. |
3fcda50
to
d6179a8
Compare
Okay - something went wrong with the rebase. Because of the multi-repo stuff my IDE cannot do the Gi>Hub sync/rebase and I have to figure out how to clean this up via the command-line. |
Let me know if you need a hand to sort it out. I'm a bit busy today in the real world, but I should have some time tomorrow. |
- added (temporary) suppression of Cppcheck `shiftTooManyBits` false positives in `libxrdp/xrdp_mppc_enc.c` - added (temporary) suppression of Cppcheck `uninitMemberVar` true positives in `ulalaca/ulalaca.cpp` until fixes land downstream - fix Cppcheck `nullPointerRedundantCheck` in `sesman/chansrv/clipboard.c` - fix Cppcheck `syntaxError` in `fontutils/mkfv1.c` because it doesn't see the `freetype/fterrors.h` header / removed astyle workaround
- build Cppcheck with matchcompiler for improved performance - build Cppcheck with Boost for improved ValueFlow performance
d6179a8
to
8c21428
Compare
Thanks. Turns out I just had to rebase against upstream. |
@firewave - thanks for your contribution! |
@metalefty - do you want this backported to v0.9? |
Yes, let's ship it. |
Done. |
Cppcheck is by design lenient with incorrect and incomplete code. This allows code to be scanned more easily but without all the code provided it might not be possible to detect certain issues. An indicator for this is the
missingInclude
warning.This provides the most common missing headers to the analysis and fixes the additionally detected issues. Unfortunately it causes the time of the analysis to balloon but that is expected.