Closed
Description
opened on Mar 9, 2019
Input C/C++ Header
Input is the c-ares header ares.h.
Relevant fragment is:
CARES_EXTERN int ares_library_init_mem(int flags,
void *(*amalloc)(size_t size),
void (*afree)(void *ptr),
void *(*arealloc)(void *ptr, size_t size));
Bindgen Invocation
bindgen --blacklist-type="__.*" \
--blacklist-type="ares_socket_t" \
--blacklist-type="fd_set" \
--blacklist-type="hostent" \
--blacklist-type="iovec" \
--blacklist-type="sockaddr" \
--blacklist-type="sa_family_t" \
--blacklist-type="socklen_t" \
--blacklist-type="timeval" \
--whitelist-function="ares.*" \
--whitelist-type="ares.*" \
--whitelist-type="apattern" \
--opaque-type="in_addr_t" \
--no-layout-tests \
--output=src/ffi.rs \
c-ares/ares.h
Actual Results
Output like this:
extern "C" {
pub fn ares_library_init_mem(
flags: ::std::os::raw::c_int,
amalloc: ::std::option::Option<
unsafe extern "C" fn(flags: usize) -> *mut ::std::os::raw::c_void,
>,
afree: ::std::option::Option<unsafe extern "C" fn(flags: *mut ::std::os::raw::c_void)>,
arealloc: ::std::option::Option<
unsafe extern "C" fn(
flags: *mut ::std::os::raw::c_void,
amalloc: usize,
) -> *mut ::std::os::raw::c_void,
>,
) -> ::std::os::raw::c_int;
}
Expected Results
As you can see, the names of the parameters for the callback functions are wrong - they should be size
, then ptr
, then ptr
and size
. But instead they are flags
, then flags
, and then flags
and amalloc
.
That is, the parameter names for the surrounding function have been injected into the callbacks!
This is a regression at 1092778 - prior to that, the output was as expected. @flowbish.
Activity