-
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
Mishandle of variadic function with wrapped static functions #2498
Comments
@Urgau I couldn't find a way to forward a call to a variadic function in C. For now I opened a PR that will skip any variadic functions that are also static if the |
Neither could I. However in my situation and I suppose many others, those variadic static inline are just helpers that call an underline int vlc_stream_vaControl(stream_t *s, int query, va_list args);
static inline int vlc_stream_Control(stream_t *s, int query, ...)
{
va_list ap;
int ret;
va_start(ap, query);
ret = vlc_stream_vaControl(s, query, ap);
va_end(ap);
return ret;
} If we could have a way to "generate" this intermediate code, maybe with a callback that takes the function name and returns an option of the va_list fn name to delegate to? |
That sounds like something that |
Well, one could append to the C file but than would also mean appending to the Rust file, right? Another example (see below) makes me think that it's a pretty standard thing (for public API, internal APIs generally don't bother that much), but than some adds arguments (here int printf(const char *restrict fmt, ...)
{
int ret;
va_list ap;
va_start(ap, fmt);
ret = vfprintf(stdout, fmt, ap);
va_end(ap);
return ret;
} This makes me thinks that we could take the problem the other way around, I mean start with the (Note that currently the generated So what I'm proposing is to do the following transformation: Input: int vfprintf(FILE *stream, const char *format, va_list ap); Output: int vfprintf__extern(FILE *stream, const char *format, ...)
{
int ret;
va_list ap;
va_start(ap, format);
ret = vfprintf(stream, format, ap);
va_end(ap);
return ret;
} extern "C" {
#[link_name = "vfprintf__extern"]
pub fn vfprintf(stream: *mut FILE, format: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int;
} Would this be acceptable for bindgen to do? (If yes, I could do the implementation work) |
Input C/C++ Header
Bindgen Invocation
Actual Results
and
Expected Results
I expect bindgen to either handle correctly (what ever that would be) or to ignore those bind of functions.
cc @pvdrz
The text was updated successfully, but these errors were encountered: