-
-
Notifications
You must be signed in to change notification settings - Fork 349
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
Fightwarn with libusb-1.0 #1240
Fightwarn with libusb-1.0 #1240
Conversation
This comment has been minimized.
This comment has been minimized.
UPDATE: This PR got frankensteined into a mess of changes hard to revise due to a history of merges to keep in sync with master; so I sat to cherry-pick and will now be posting another to increment libusb-1.0 branch with a general fightwarn effort running-up to the "questionable" change noted above, then will rebase this PR on top of that with fewer changes to revise specific to this iteration. |
… int types to backend API dependent "usb_ctrl_*" and "usb_dev_handle" typedefs, then range-check and cast the numbers, and avoid build warnings
c925e71
to
357dee6
Compare
PR rebased over the less significant change set, now merged into target branch. |
This pull request introduces 20 alerts when merging 357dee6 into f71c188 - view on LGTM.com new alerts:
|
…on.h due to lack of WITH_LIBUSB_x_y)
This pull request introduces 20 alerts when merging b75d66f into f71c188 - view on LGTM.com new alerts:
|
This PR updates the libusb-1.0 branch with "fightwarn" considerations (following up from effort in #823 to get the NUT codebase CI-tested and free from more and more classes of warnings, so we can enable non-regression testing for them with future iterations), allowing to proceed with issue #300 to get libusb 1.0 API supported by NUT officially. In fact, this PR would complete the current definition of "medium" level warnings, allowing to set them as default requirement.
One important change here, that was questionable to myself but got "rationalized", is the step back from fixed C-standard fixed-size numeric value types like
size_t
, totypedef ... usb_ctrl_...
with types defined by respective backend API for libusb-1.0, libusb-0.1, libhid, libshut and some drivers. For statically linked drivers this should not matter in fact, and this change does not preclude (and even helps) later efforts to re-define those typedefs identically for all backends, and add more range-checks and casts to make the complete codebase build with that.This PR also reduces duplication of code (libusb 0.1 vs 1.0 definitions were repeated in many drivers and libs) offloading that to usb-common.h
At least, such is the theory - testing against real hardware would be very helpful; if you do - please comment the good, the bad and the ugly outcomes in #300.
Sibling PR #1241 addresses similar refresh for the newer libusb-1.0+0.1 branch, which incorporates and builds upon this one and is planned to become part of NUT master codebase when the dust settles.