Add a test for

This commit is contained in:
topecongiro 2017-11-18 15:32:10 +09:00
parent abe6eec910
commit 3de7a56267
2 changed files with 136 additions and 0 deletions

@ -0,0 +1,4 @@
// A stress test against code generated by bindgen.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct emacs_env_25 { pub size : isize , pub private_members : * mut emacs_env_private , pub make_global_ref : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , any_reference : emacs_value ) -> emacs_value > , pub free_global_ref : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , global_reference : emacs_value ) > , pub non_local_exit_check : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env ) -> emacs_funcall_exit > , pub non_local_exit_clear : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env ) > , pub non_local_exit_get : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , non_local_exit_symbol_out : * mut emacs_value , non_local_exit_data_out : * mut emacs_value ) -> emacs_funcall_exit > , pub non_local_exit_signal : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , non_local_exit_symbol : emacs_value , non_local_exit_data : emacs_value ) > , pub non_local_exit_throw : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , tag : emacs_value , value : emacs_value ) > , pub make_function : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , min_arity : isize , max_arity : isize , function : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , nargs : isize , args : * mut emacs_value , arg1 : * mut ::libc :: c_void ) -> emacs_value > , documentation : * const ::libc :: c_char , data : * mut ::libc :: c_void ) -> emacs_value > , pub funcall : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , function : emacs_value , nargs : isize , args : * mut emacs_value ) -> emacs_value > , pub intern : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , symbol_name : * const ::libc :: c_char ) -> emacs_value > , pub type_of : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , value : emacs_value ) -> emacs_value > , pub is_not_nil : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , value : emacs_value ) -> bool > , pub eq : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , a : emacs_value , b : emacs_value ) -> bool > , pub extract_integer : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , value : emacs_value ) -> intmax_t > , pub make_integer : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , value : intmax_t ) -> emacs_value > , pub extract_float : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , value : emacs_value ) -> f64 > , pub make_float : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , value : f64 ) -> emacs_value > , pub copy_string_contents : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , value : emacs_value , buffer : * mut ::libc :: c_char , size_inout : * mut isize ) -> bool > , pub make_string : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , contents : * const ::libc :: c_char , length : isize ) -> emacs_value > , pub make_user_ptr : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , fin : :: std :: option :: Option < unsafe extern "C" fn ( arg1 : * mut ::libc :: c_void ) > , ptr : * mut ::libc :: c_void ) -> emacs_value > , pub get_user_ptr : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , uptr : emacs_value ) -> * mut ::libc :: c_void > , pub set_user_ptr : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , uptr : emacs_value , ptr : * mut ::libc :: c_void ) > , pub get_user_finalizer : :: std :: option :: Option < unsafe extern "C" fn ( arg1 : * mut ::libc :: c_void , env : * mut emacs_env , uptr : emacs_value ) -> :: std :: option :: Option < unsafe extern "C" fn ( arg1 : * mut ::libc :: c_void , env : * mut emacs_env , uptr : emacs_value ) > > , pub set_user_finalizer : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , uptr : emacs_value , fin : :: std :: option :: Option < unsafe extern "C" fn ( arg1 : * mut ::libc :: c_void ) > ) > , pub vec_get : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , vec : emacs_value , i : isize ) -> emacs_value > , pub vec_set : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , vec : emacs_value , i : isize , val : emacs_value ) > , pub vec_size : :: std :: option :: Option < unsafe extern "C" fn ( env : * mut emacs_env , vec : emacs_value ) -> isize > , }

132
tests/target/issue-2164.rs Normal file

@ -0,0 +1,132 @@
// A stress test against code generated by bindgen.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct emacs_env_25 {
pub size: isize,
pub private_members: *mut emacs_env_private,
pub make_global_ref: ::std::option::Option<
unsafe extern "C" fn(env: *mut emacs_env, any_reference: emacs_value) -> emacs_value,
>,
pub free_global_ref: ::std::option::Option<
unsafe extern "C" fn(env: *mut emacs_env, global_reference: emacs_value),
>,
pub non_local_exit_check:
::std::option::Option<unsafe extern "C" fn(env: *mut emacs_env) -> emacs_funcall_exit>,
pub non_local_exit_clear: ::std::option::Option<unsafe extern "C" fn(env: *mut emacs_env)>,
pub non_local_exit_get: ::std::option::Option<
unsafe extern "C" fn(
env: *mut emacs_env,
non_local_exit_symbol_out: *mut emacs_value,
non_local_exit_data_out: *mut emacs_value,
) -> emacs_funcall_exit,
>,
pub non_local_exit_signal: ::std::option::Option<
unsafe extern "C" fn(
env: *mut emacs_env,
non_local_exit_symbol: emacs_value,
non_local_exit_data: emacs_value,
),
>,
pub non_local_exit_throw: ::std::option::Option<
unsafe extern "C" fn(env: *mut emacs_env, tag: emacs_value, value: emacs_value),
>,
pub make_function: ::std::option::Option<
unsafe extern "C" fn(
env: *mut emacs_env,
min_arity: isize,
max_arity: isize,
function: ::std::option::Option<
unsafe extern "C" fn(
env: *mut emacs_env,
nargs: isize,
args: *mut emacs_value,
arg1: *mut ::libc::c_void,
) -> emacs_value,
>,
documentation: *const ::libc::c_char,
data: *mut ::libc::c_void,
) -> emacs_value,
>,
pub funcall: ::std::option::Option<
unsafe extern "C" fn(
env: *mut emacs_env,
function: emacs_value,
nargs: isize,
args: *mut emacs_value,
) -> emacs_value,
>,
pub intern: ::std::option::Option<
unsafe extern "C" fn(env: *mut emacs_env, symbol_name: *const ::libc::c_char)
-> emacs_value,
>,
pub type_of: ::std::option::Option<
unsafe extern "C" fn(env: *mut emacs_env, value: emacs_value) -> emacs_value,
>,
pub is_not_nil: ::std::option::Option<
unsafe extern "C" fn(env: *mut emacs_env, value: emacs_value) -> bool,
>,
pub eq: ::std::option::Option<
unsafe extern "C" fn(env: *mut emacs_env, a: emacs_value, b: emacs_value) -> bool,
>,
pub extract_integer: ::std::option::Option<
unsafe extern "C" fn(env: *mut emacs_env, value: emacs_value) -> intmax_t,
>,
pub make_integer: ::std::option::Option<
unsafe extern "C" fn(env: *mut emacs_env, value: intmax_t) -> emacs_value,
>,
pub extract_float:
::std::option::Option<unsafe extern "C" fn(env: *mut emacs_env, value: emacs_value) -> f64>,
pub make_float:
::std::option::Option<unsafe extern "C" fn(env: *mut emacs_env, value: f64) -> emacs_value>,
pub copy_string_contents: ::std::option::Option<
unsafe extern "C" fn(
env: *mut emacs_env,
value: emacs_value,
buffer: *mut ::libc::c_char,
size_inout: *mut isize,
) -> bool,
>,
pub make_string: ::std::option::Option<
unsafe extern "C" fn(env: *mut emacs_env, contents: *const ::libc::c_char, length: isize)
-> emacs_value,
>,
pub make_user_ptr: ::std::option::Option<
unsafe extern "C" fn(
env: *mut emacs_env,
fin: ::std::option::Option<
unsafe extern "C" fn(arg1: *mut ::libc::c_void),
>,
ptr: *mut ::libc::c_void,
) -> emacs_value,
>,
pub get_user_ptr: ::std::option::Option<
unsafe extern "C" fn(env: *mut emacs_env, uptr: emacs_value) -> *mut ::libc::c_void,
>,
pub set_user_ptr: ::std::option::Option<
unsafe extern "C" fn(env: *mut emacs_env, uptr: emacs_value, ptr: *mut ::libc::c_void),
>,
pub get_user_finalizer: ::std::option::Option<
unsafe extern "C" fn(
arg1: *mut ::libc::c_void, env: *mut emacs_env, uptr: emacs_value
) -> ::std::option::Option<
unsafe extern "C" fn(arg1: *mut ::libc::c_void, env: *mut emacs_env, uptr: emacs_value),
>,
>,
pub set_user_finalizer: ::std::option::Option<
unsafe extern "C" fn(
env: *mut emacs_env,
uptr: emacs_value,
fin: ::std::option::Option<
unsafe extern "C" fn(arg1: *mut ::libc::c_void),
>,
),
>,
pub vec_get: ::std::option::Option<
unsafe extern "C" fn(env: *mut emacs_env, vec: emacs_value, i: isize) -> emacs_value,
>,
pub vec_set: ::std::option::Option<
unsafe extern "C" fn(env: *mut emacs_env, vec: emacs_value, i: isize, val: emacs_value),
>,
pub vec_size:
::std::option::Option<unsafe extern "C" fn(env: *mut emacs_env, vec: emacs_value) -> isize>,
}