-
Notifications
You must be signed in to change notification settings - Fork 272
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
Overview: initialize color variables #916
Conversation
While this might not be necessary technically, cppcheck complained: overviewscintilla.c:800:53: note: Calling function 'overview_scintilla_get_overlay_color', 2nd argument '&color' value is <Uninit> overview_scintilla_get_overlay_color (self, &color); ^ overviewscintilla.c:1146:11: note: Uninitialized variable: color
Newer cppcheck versions (probably 1.89 which is in Debian Sid since a few days) complained about it and so the nightly builds broke. |
Maybe it's a bug in cppcheck? |
But or not I think setting a variable to a default is a good thing. |
It would appear to be a correct warning, there is nothing to tell cppcheck that argument 2 is an out only argument so it has to assume the value is used in the function and hence an uninitialised value is being passed. |
I haven't done a proper survey, but I'd wager if we did, we'd find hundreds if not thousands of uninitialized variables in Geany and GP's code.
If it did proper analysis (ie. look into callee) it would see it's passed to In any case, I'm fine with this PR if it shuts up |
|
I don't mind much. |
I agree to this and vote for merging it. |
It looks like maybe it was fixed in danmar/cppcheck#2167, but I haven't tested it. |
@elextr got a point, it's actually technically correct to say the value may not be initialized because of those checks, and it seem impossible for a tool to infer that those checks will succeed, even if we know they will -- unless something else went terribly bad and we're fubar. So although I initially blamed that on cppcheck, I guess it's fair and this PR makes sense. |
Depending on whether they're actually enabled, of course. |
While this might not be necessary technically, cppcheck complained:
overviewscintilla.c:800:53: note: Calling function 'overview_scintilla_get_overlay_color', 2nd argument '&color' value is
overview_scintilla_get_overlay_color (self, &color);
^
overviewscintilla.c:1146:11: note: Uninitialized variable: color