diff options
-rw-r--r-- | libbindgen/src/codegen/mod.rs | 6 | ||||
-rw-r--r-- | libbindgen/tests/expectations/tests/variadic-method.rs | 27 | ||||
-rw-r--r-- | libbindgen/tests/headers/variadic-method.hpp | 6 |
3 files changed, 39 insertions, 0 deletions
diff --git a/libbindgen/src/codegen/mod.rs b/libbindgen/src/codegen/mod.rs index 932e2b75..7451dd11 100644 --- a/libbindgen/src/codegen/mod.rs +++ b/libbindgen/src/codegen/mod.rs @@ -1319,6 +1319,12 @@ impl MethodCodegen for Method { _ => panic!("How in the world?"), }; + // Do not generate variadic methods, since rust does not allow + // implementing them, and we don't do a good job at it anyway. + if signature.is_variadic() { + return; + } + let count = { let mut count = method_names.entry(name.clone()) .or_insert(0); diff --git a/libbindgen/tests/expectations/tests/variadic-method.rs b/libbindgen/tests/expectations/tests/variadic-method.rs new file mode 100644 index 00000000..34301069 --- /dev/null +++ b/libbindgen/tests/expectations/tests/variadic-method.rs @@ -0,0 +1,27 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +extern "C" { + #[link_name = "_Z3fooPKcz"] + pub fn foo(fmt: *const ::std::os::raw::c_char, ...); +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Bar { + pub _address: u8, +} +#[test] +fn bindgen_test_layout_Bar() { + assert_eq!(::std::mem::size_of::<Bar>() , 1usize); + assert_eq!(::std::mem::align_of::<Bar>() , 1usize); +} +extern "C" { + #[link_name = "_ZN3Bar3fooEPKcz"] + pub fn Bar_foo(this: *mut Bar, fmt: *const ::std::os::raw::c_char, ...); +} +impl Clone for Bar { + fn clone(&self) -> Self { *self } +} diff --git a/libbindgen/tests/headers/variadic-method.hpp b/libbindgen/tests/headers/variadic-method.hpp new file mode 100644 index 00000000..78a8eb45 --- /dev/null +++ b/libbindgen/tests/headers/variadic-method.hpp @@ -0,0 +1,6 @@ + +void foo(const char* fmt, ...); + +struct Bar { + void foo(const char* fmt, ...); +}; |