-
Notifications
You must be signed in to change notification settings - Fork 262
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
Static analyzer issues #5
Comments
Thanks for your report and the heads-up to use a static analyzer like clang-tidy (edited, was: -format). As for your reports:
i.e. add PS: I checked the entire source with clang-tidy (default, no special setup), and I found some issues. It doesn't look too bad but there are some noteworthy warnings I'll check and take care of. Thanks again. |
Part 3 is fixed in commit 2e6a4eb. |
Regarding part 1:
I can see and fix the issue, but unfortunately my version of clang-tidy (6.0) doesn't issue this warning. I'm using: Pavel, can you please elaborate on how you are calling clang-tidy? |
@Albrecht-S I'm not sure about the flags as I use Qt Creator to develop. It has predefined sets of flags, so I used one of these... |
@shlyakpavel Thanks for your reply anyway. Do you know your clang and clang-tidy versions? |
clang-tidy mask was |
However, I personally prefer to use PVS studio instead of clang-tidy. According to my experience it always finds much more relevant problems than clang-based tools do. They are commercial project but one can ask 'em for a trial license :) |
Apparently PVS Studio has a command line as well, allowing for automation (and avoiding GUI IDEs): |
Regarding part 1:
That is May 2002 code by M.R.Sweet which decodes the output of the XGetImage |
No, I don't think so. I'd rather believe that the correct fix would be to add an initialization in the loop statement at line no. 961 like this one:
This seems to be what is used inside the loop. But I'd need to check this - it's just my impression from looking at the code... @ManoloFLTK Why did you close the issue? By accident? Sorry for mentioning you explicitly and for assigning the issue to you. I'll look into it and see if the above fix is correct. Feel free to unassign yourself. |
@ManoloFLTK Sorry again, your proposal is probably correct since the index_mask value is never used. Still looking into it... |
That must have been an accident, while discovering github. |
See #5 As Manolo pointed out the questionable variable was not used (read) in this case of the switch statement, hence it can be removed.
OK, part 1 is now also fixed in commit 59cd39a. |
Regarding part 2 (uninitialized ints): I opened a new issue (#6) with a more general description of the issue. I'm closing this one now. Thanks for all contributions. |
Could be nice to run a static analyzer after each submission / pr request to master ... |
Applied vsnprintf_v2.patch from STR#3413 which documents the previously undocumented function, so that it shows up here in the doxygen docs: Files -> File List -> vsnprintf.c -> fl_vsnprintf() This commit does not solve STR #3413, just adds the recommended documentation for fl_vsnprintf(). Other functions in src/vsnprintf.c could use docs too. See the bottom of comment #5 in the STR for recommendations to fully solve.
Hello. Have been walking around X11 driver with clang-tidy. I'll comment only the places I suppose to have mistakes
The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage https://github.com/fltk/fltk/blob/master/src/drivers/X11/Fl_X11_Screen_Driver.cxx#L971
Ints are used without initialization here. Looks weird. https://github.com/fltk/fltk/blob/master/src/drivers/X11/Fl_X11_Window_Driver.cxx#L237
P is initialized but never used. It is probably not a bug, but still suspicious. https://github.com/fltk/fltk/blob/master/src/drivers/X11/Fl_X11_Screen_Driver.cxx#L1241
In general, the whole project should be reviewed with a static analyzer as there are 572 problems found with only strict options applied. I guess it is so for the long FLTK history, but still...
The text was updated successfully, but these errors were encountered: