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

Gather comments from headers #141

Merged
merged 8 commits into from
Mar 1, 2023
Merged

Conversation

CGMossa
Copy link
Member

@CGMossa CGMossa commented Feb 27, 2023

Adding these lines to the clang-call enables getting some comments.

This is not much, but it is something. Maybe it will be more useful later

@CGMossa
Copy link
Member Author

CGMossa commented Feb 27, 2023

/bindings

@CGMossa
Copy link
Member Author

CGMossa commented Feb 27, 2023

I urge you to take a cursory look at one of the binding files, and just click the load diff even though it is massive.

This is ready for review. I just don't know who cares enough to approve / disapprove of this.

@multimeric
Copy link
Member

Ooh, I like this. Two points of feedback. One, I note that almost all of the doc comments have a leading space that at least visually looks annoying. If rustdoc is not stripping out this space then it's probably annoying enough to fix. The other thing is just that I'd like to see an extendr build run using these bindings just to run it through the tests and linting etc. Otherwise it looks good and I think it would be valuable for sure.

@CGMossa
Copy link
Member Author

CGMossa commented Feb 27, 2023

There is an option to use rustfmt for the generated binding. Issue is it is completely broken for these headers.
Instead, I opted to use an introspection thing, called ParseCallbacks, that allows one to edit what bindgen does in a trait-way.
I implemented a parse_comment-method;

I have investigated this to see if we had something for #139, but this parse-callback just provides you with this information as it goes through, the name of the macro, and the tokens of the macro, and you ought to do something else with it. There is no return nothing. But that's an aside.

@CGMossa
Copy link
Member Author

CGMossa commented Feb 27, 2023

/bindings

@CGMossa
Copy link
Member Author

CGMossa commented Feb 27, 2023

For the other point, see extendr/extendr#497, once it finishes whatever it needs to do.

@CGMossa
Copy link
Member Author

CGMossa commented Feb 27, 2023

/bindgen

@CGMossa
Copy link
Member Author

CGMossa commented Feb 28, 2023

Okay, so the answer is, that this [redacted].clang_arg("-fretain-comments-from-system-headers") is the problem.
I don't know why, and I cannot check this with a Mac machine.
I guess it could be a todo for someone with a Mac.

@CGMossa
Copy link
Member Author

CGMossa commented Feb 28, 2023

/bindings

@CGMossa
Copy link
Member Author

CGMossa commented Feb 28, 2023

Alright; I'm re-running everything, but it already worked out, and I've addressed comments from you @multimeric.
PS: I wrote this message on the wrong PR.
But this one is ready for round two.

Copy link
Member

@multimeric multimeric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Copy link
Contributor

@yutannihilation yutannihilation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

build.rs Outdated Show resolved Hide resolved
@CGMossa
Copy link
Member Author

CGMossa commented Mar 1, 2023 via email

@multimeric
Copy link
Member

So you removed it because it was causing the build to fail on Mac? What value did it provide? I'm sure it's fine to leave for later.

@CGMossa
Copy link
Member Author

CGMossa commented Mar 1, 2023 via email

Co-authored-by: Hiroaki Yutani <[email protected]>
@multimeric multimeric merged commit 02d1427 into master Mar 1, 2023
@multimeric
Copy link
Member

Urgh I just remembered the changelog. Please add a PR updating it too.

@yutannihilation
Copy link
Contributor

Thanks! Putting it behind #[cfg(not(target_os = "macos"))] can be an option, but I'm fine with either.

@CGMossa CGMossa deleted the gather_comments_from_headers branch October 6, 2023 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants