Skip to content
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

Merged
merged 11 commits into from
Jan 7, 2022

Conversation

jimklimov
Copy link
Member

@jimklimov jimklimov commented Dec 23, 2021

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, to typedef ... 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.

@jimklimov jimklimov added CI Entries related to continuous integration infrastructure (historically also recipes like Makefiles) refactor/fightwarn PR or issue proposal to improve code maintainability without functional changes, or to fix warnings USB labels Dec 23, 2021
@lgtm-com

This comment has been minimized.

@jimklimov
Copy link
Member Author

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.

@jimklimov
Copy link
Member Author

jimklimov commented Dec 25, 2021

PR rebased over the less significant change set, now merged into target branch.

@lgtm-com
Copy link

lgtm-com bot commented Dec 25, 2021

This pull request introduces 20 alerts when merging 357dee6 into f71c188 - view on LGTM.com

new alerts:

  • 20 for Comparison result is always the same

@lgtm-com
Copy link

lgtm-com bot commented Dec 25, 2021

This pull request introduces 20 alerts when merging b75d66f into f71c188 - view on LGTM.com

new alerts:

  • 20 for Comparison result is always the same

@jimklimov jimklimov merged commit ebb9c0d into networkupstools:libusb-1.0 Jan 7, 2022
@jimklimov jimklimov deleted the fightwarn-libusb-1.0 branch January 7, 2022 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Entries related to continuous integration infrastructure (historically also recipes like Makefiles) refactor/fightwarn PR or issue proposal to improve code maintainability without functional changes, or to fix warnings USB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant