Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Allow wrapper function generation for functional macros #2578
base: main
Are you sure you want to change the base?
Allow wrapper function generation for functional macros #2578
Changes from all commits
2ad5e7c
b43c620
5ca0f26
a5463fc
3b1372c
54d1ad7
10a0ac7
26f18f5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
is this really necessary? It might sound lazy but to be honest it might be easier to just let the user type whatever they want as a type and propagate those strings until they are written to the wrapper code file. This also gives you the "advantage" of supporting any type the user wants as long as it is defined in the headers.
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.
Well, we need do do some kind of parsing because we need to generate not only a function definition but also the function body where we call the macro. I don't believe there is a nice way to create the macro invocation without separating the argument types from the definition and removing the return type, but maybe I'm missing something?
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.
I am actually a bit stuck on this. I am trying to support calling these macros with C types, which can't be referenced from build scripts:
I want to be able to specify that the
ACCESS_INNER
macro takes amy_type
. To do that I was trying to switch everything over to just accept strings, but inFunction::parse
I need to generate aFunction
object which eventually needs aTypeKind
for the return type and the argument types.So my question is, is there a way to construct a
Function
that doesn't require me to parse the types, so I can just pass the strings through?Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Check warning on line 657 in bindgen-tests/tests/tests.rs
GitHub Actions / rustfmt-clippy