-
Notifications
You must be signed in to change notification settings - Fork 2k
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
sock_async: fix cyclic include problem #12921
Conversation
@kaspar030 can you have a look please. This somewhat breaks the "one header for everything" idea we had in #11723, but I don't really see another way to resolve the cyclic dependencies. |
LLVM doesn't like re-definitions of types :-(. Any idea how to solve this, or should we just deactivate that warning? |
I do not get the warning when compiling
for the sections with the redefinitions? |
If you tried the most current version of this PR, this does not surprise me... see my changes to |
@fjmolinas you have to revert the last commit to get the effect I was describing. |
I had removed |
@miri64 I tried to look into the discussion in #11723 and to me it seems the idea was to keep the changes restricted and not mix into existing headers. To me adding the |
I think @kaspar030 and I discussed this mostly offline, so its not surprising to not have it there. Basically we wanted to isolate |
BTW you have to build for a board (e.g. for |
Used |
AHA! that was it, thanks! Test is still passing. RIOT_CI_BUILD=1 BUILD_IN_DOCKER=1 TOOLCHAIN=llvm BOARD=iotlab-m3 make -C
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test is still working, usage has been explained. Ignoring typdef redefinition
has been limited to the async
files and the sock files. I don't think there is another way around this issue.
AFAIKT
the single file approach to contain async
code is still respected.
@kaspar030 might want to take another look, but otherwise ACK on my side. feel free to squash.
May I squash? |
Yes. |
Typically a stack needs to add the callback for a sock as a member of its respective `sock` type so `sock_types.h` needs to include `net/sock/async.h` at the moment. As those however include `net/sock/<prot>.h`, which in turn include `sock_types.h`, we create a cyclic dependency. This fix resolves this cyclic dependency, by putting the callback definitions in its own header that then in turn can be also included by `sock_types.h`.
net/sock/async/types.h included by net/sock.h needs to re-typedef the the sock types to prevent cyclic includes.
180e613
to
3896145
Compare
Done. |
GO! |
Contribution description
Typically a stack needs to add the callback for a sock as a member of its respective
sock
type sosock_types.h
needs to includenet/sock/async.h
at the moment. As those however includenet/sock/<prot>.h
, which in turn includesock_types.h
, we create a cyclic dependency.This fix resolves this cyclic dependency, by putting the callback definitions in its own header that then in turn can be also included by
sock_types.h
.Testing procedure
tests/gnrc_sock_async
should still work and runmake -C tests/gnrc_sock_async flash test
Issues/PRs references
Required for #12601, #12602, and #12907 to work.