-
Notifications
You must be signed in to change notification settings - Fork 698
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Follow proper derive rules for function pointers.
- Loading branch information
Showing
6 changed files
with
97 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* automatically generated by rust-bindgen */ | ||
|
||
|
||
#![allow(non_snake_case)] | ||
|
||
|
||
pub type my_fun_t = | ||
::std::option::Option<unsafe extern "C" fn(arg1: ::std::os::raw::c_int, | ||
arg2: ::std::os::raw::c_int, | ||
arg3: ::std::os::raw::c_int, | ||
arg4: ::std::os::raw::c_int, | ||
arg5: ::std::os::raw::c_int, | ||
arg6: ::std::os::raw::c_int, | ||
arg7: ::std::os::raw::c_int, | ||
arg8: ::std::os::raw::c_int, | ||
arg9: ::std::os::raw::c_int, | ||
arg10: ::std::os::raw::c_int, | ||
arg11: ::std::os::raw::c_int, | ||
arg12: ::std::os::raw::c_int, | ||
arg13: ::std::os::raw::c_int, | ||
arg14: ::std::os::raw::c_int, | ||
arg15: ::std::os::raw::c_int, | ||
arg16: ::std::os::raw::c_int)>; | ||
#[repr(C)] | ||
#[derive(Copy)] | ||
pub struct Foo { | ||
pub callback: my_fun_t, | ||
} | ||
#[test] | ||
fn bindgen_test_layout_Foo() { | ||
assert_eq!(::std::mem::size_of::<Foo>() , 8usize , concat ! ( | ||
"Size of: " , stringify ! ( Foo ) )); | ||
assert_eq! (::std::mem::align_of::<Foo>() , 8usize , concat ! ( | ||
"Alignment of " , stringify ! ( Foo ) )); | ||
assert_eq! (unsafe { | ||
& ( * ( 0 as * const Foo ) ) . callback as * const _ as usize | ||
} , 0usize , concat ! ( | ||
"Alignment of field: " , stringify ! ( Foo ) , "::" , | ||
stringify ! ( callback ) )); | ||
} | ||
impl Clone for Foo { | ||
fn clone(&self) -> Self { *self } | ||
} | ||
impl Default for Foo { | ||
fn default() -> Self { unsafe { ::std::mem::zeroed() } } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
typedef void (*my_fun_t)(int, int, int, int, | ||
int, int, int, int, | ||
int, int, int, int, | ||
int, int, int, int); | ||
|
||
struct Foo { | ||
my_fun_t callback; | ||
}; |