-
Notifications
You must be signed in to change notification settings - Fork 715
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
Wrap va_list
function as variadic function
#2502
Conversation
a5f3535
to
fb2f0b9
Compare
☔ The latest upstream changes (presumably 4f9fcbf) made this pull request unmergeable. Please resolve the merge conflicts. |
@pvdrz Would you be able to give me pre-review? |
I think it would be best if this is not done for every single function that takes trait ParseCallbacks {
...
fn wrap_as_variadic_fn(&mut self, name: &str) -> Option<String> {
None
}
} That would mean that the user can decide which functions should be wrapped and would be their responsibility to check the signature instead of us. For example, if int foo(int flags, ...) {
int ret;
va_list ap;
va_start(ap, flags);
ret = vfoo(flags, ap);
va_end(ap);
return ret;
} extern "C" {
pub fn foo(flags: ::std::os::raw::c_int, ...) -> ::std::os::raw::c_int;
} What do you think? |
Sure, this seems like a good idea. I will do the necessary work and make the PR ready for review. Btw, my logic works with any function that has 1 (and only 1) |
97a4292
to
c9f17d7
Compare
va_list
functions into variadic oneva_list
function as variadic function
@pvdrz As discussed I've added Btw, I ended up only changing the name of the Rust function because changing the other one felt unnecessary complicated and also it's the only one that matters (the other one are implementation details). |
@pvdrz Let me know if there is something I can do to help with the review ;-) |
Hey :) I have this on my todo list but I only will be able to review it later this week. Thanks for the patience |
bindgen-tests/tests/expectations/tests/generated/wrap_static_fns.c
Outdated
Show resolved
Hide resolved
439bc76
to
fcae20e
Compare
@pvdrz The PR is ready for review. (btw, do you want pings from 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.
This looks good to me. The only two extra things I'd ask you to do are:
- Check how
wrap-static-fns
is tested inbindgen-integration
and update the tests to include this new feature. - Add the changes to the changelog.
@pvdrz I've updated as requested the PR (bindgen-integration + changelog). |
Hey! the test suite broke due to an unrelated issue that has already been fixed in the main branch, could you rebase your PR against it so we can be sure the tests are passing? |
3501fe9
to
8e8ebdc
Compare
I've rebased, the tests suite now passes (had to add an exception for |
☔ The latest upstream changes (presumably 4faa366) made this pull request unmergeable. Please resolve the merge conflicts. |
Opening a draft before doing more to get opinion on it.This PR add a way to wrap
va_list
function as variadic function. See below for an example.Input:
Output:
Related to #2498
cc @pvdrz