-
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
core: resolve circular dependency #16458
Conversation
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.
Nice cleanup!
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.
Pleas don't merge too quick, I'd like to take a closer look.
Yea Murdock has found some isssues. |
I'm not in favour of shuffling the headers around like this. How about just forward declaring msg_t? The only reason thread.h needs msg_t is a single pointer. -> #16477 |
This seems cleaner than #16477 (and needs a rebase). |
That doesn't solve the issue that |
@chrysn For this to be compatible with rust, |
Rust has no difference between type names and named structs, and it looks at all the headers at once, so I don't think it makes any difference. Bindings already look like this: #[repr(C)]
pub struct _thread {
pub sp: *mut c_char,
pub status: thread_status_t,
// ...
}
pub type thread_t = _thread; where |
The issue is that with this PR, |
The Rust bindings (of riot-sys) are always automatically regenerated
from the used RIOT code. When `struct _thread` goes away, there will not
be a `_thread` any more in riot-sys.
Aaah I see -- riot-wrappers uses `_thread`. That's unfortunate, it
shouldn't have been doing this. (In general, riot-sys contains a lot of
symbols that one should rather not use -- basically everything there is
no RIOT documentation for. That's the nature of going from an
unnamespaced language to a namespaced one).
Fix coming, sorry for both the bug and me not getting it originally.
|
Please rebase onto (I prefer merging in, but was told GitHub doesn't
handle this workflow) #17514 once
that's merged. (Let's hope there are a few fast ones in the CI queue).
[edit: You can also just `cargo update` locally in the failing test to verify it passes now]
|
_thread shouldn't have been used being an imlementationn detail; this caused trouble with [16458]. [16458]: RIOT-OS/RIOT#16458 (comment)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
Huh, what happened here? Seems somewhat important! |
I still think this should go in |
use `thread_t` instead of `struct _thread`
Dependency graph before: +-------------------------------------+ | | | V +----------+ +-------+ +---------+ | thread.h | -----> | msg.h | ------> | sched.h | +----------+ +-------+ +---------+ ^ | | | +-------------------------------------+ Dependency graph after: +--------------+ | core_types.h | +--------------+ ^ ^ ^ | | | +-------------+ | +--------------+ | | | +----------+ | +---------+ | thread.h | | | sched.h | +----------+ | +---------+ | ^ +-------+ | | msg.h |--------------+ +-------+
Rebased and reordered the commits so that the addition of missing |
Did we have another issue with circular dependency since #16174? |
We eventually have worked around the issue. But generally, circular dependencies in C headers are a bit messy, so this may be useful later down the road. Maybe close this for now and pick this up again when someone bumps their feet on this again? |
Closed.
Thanks for your proposal @maribu! :) |
Contribution description
Dependency graph before:
Dependency graph after:
Testing procedure
This PR doesn't change code. It only relocates it. Hence, binaries shouldn't change.
Issues/PRs references
This circular dependency became an issue in #16174