-
-
Notifications
You must be signed in to change notification settings - Fork 140
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
Generate rust bindings from mlibc headers #989
Conversation
731f1a2
to
f3faec9
Compare
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.
Please split up the PR into at least 2: one for the scripts and one for the rest of the mlibc bug fixes.
scripts/rust-libc-config.yml
Outdated
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.
Probably too awful to do now. But ideally there would be some comments explaining why certain things are ignored.
Rebased onto current master. |
40fe204
to
80b0943
Compare
53bafe4
to
fb73d6f
Compare
39f95b1
to
7a4562f
Compare
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.
Aside from the messy python code I don't see a reason why this can't be merged right now. We could always clean up the script if there's ever motivation to.
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.
this does not appear to be black
-formatted, which, IIRC, we agreed to use for all .py
code?
(overall, generating more code like this is quite a good thing, +1)
Updated the script to be formatted with |
This script and the configuration file supplied are tested to generate valid rust bindings (for rust's libc crate) for unix/linux_like/* targets. This has been tested by building rust's stdlib, alacritty, exa and ripgrep. In the future, it might be a worthwhile idea to run this as a GHA check to catch accidental breakage.
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.
Aesthetically the script looks much better now 🙃 Do still have issues with the code quality but as I mentioned before I'm not of the opinion that should be a blocker for now.
- "B2500000" | ||
- "B3000000" | ||
- "B3500000" | ||
- "B4000000" |
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.
Missing a newline at the end of file. We should fix that at the next opportunity but it's not a blocker for me.
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.
LGTM
This PR adds a script to generate valid, working rust-libc bindings. It parses (installed) mlibc headers using libclang, and then outputs rust bindings. A configuration file is supplied to list stuff that needs to be ignored, either due to being broken, unnecessary or already provided in
unix/mod.rs
orunix/linux_like/mod.rs
.