From 3de7a56267b14b3692b65dbedf122148d94dd907 Mon Sep 17 00:00:00 2001 From: topecongiro Date: Sat, 18 Nov 2017 15:32:10 +0900 Subject: [PATCH] Add a test for #2164 --- tests/source/issue-2164.rs | 4 ++ tests/target/issue-2164.rs | 132 +++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 tests/source/issue-2164.rs create mode 100644 tests/target/issue-2164.rs diff --git a/tests/source/issue-2164.rs b/tests/source/issue-2164.rs new file mode 100644 index 00000000000..6c288e1bd62 --- /dev/null +++ b/tests/source/issue-2164.rs @@ -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 > , } diff --git a/tests/target/issue-2164.rs b/tests/target/issue-2164.rs new file mode 100644 index 00000000000..ab1d7dfd37a --- /dev/null +++ b/tests/target/issue-2164.rs @@ -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 emacs_funcall_exit>, + pub non_local_exit_clear: ::std::option::Option, + 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 f64>, + pub make_float: + ::std::option::Option 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 isize>, +}