Add missing dependency tusb.h for tusb_private.h#1977
Conversation
|
fixing code format by changing the code is not accepted, configure your formatter to skip tinyusb src. |
|
Please take a look at the code change. There's an implicit dependency in tusb_private that I simply made explicit. Having build order issues in your .h files isn't preferable @hathach. It will likely cause an issue for someone else in the future. As it is, the tusb code is fragile when it doesn't need to be because the dependency isn't explicit so #include order matters when it shouldn't. In my case, the IDE is simply set to auto format as I go, so adding tusb as a submodule and looking at the code exposes this missing dependency when I open and read tusb.c. |
|
FYI, saw you opened a (very nice) checklist for static analysis. FYI, your cppcheck run is going to fail with this issue unfixed. |
Describe the PR
When working with TinyUSB, my IDE (VSCode) sorted the #includes for tusb_private.h as part of automated code formatting which revealed an implicit dependency on tusb.h via build breaks when tusb_private.h is #included without/before tusb.h.
This PR simply adds the implicit dependency as an explicit dependency, fixing the build break if the #include statements are ordered differently (for example in tusb.c).
Additional context
VSCode auto-formatting changed tusb.c from:
to
which revealed the implicit dependency via a build break.