summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2019-02-11 09:58:33 +0100
committerGitHub <noreply@github.com>2019-02-11 09:58:33 +0100
commit9fb016e32bfc2cd917c907e8b9e892eed89b24c7 (patch)
tree2a7971c2fa927c617ac8948f8412d869d72c8478
parent807033601808efb25e08ee6a3a1a8e98da02cd75 (diff)
parent5063e94c0ce0a0a8c3bd005c436a1136935ab870 (diff)
Merge pull request #1519 from flier/fix-one-argument-block-pointer
fix one argument block pointer issue, #1378
-rw-r--r--src/codegen/mod.rs2
-rw-r--r--tests/expectations/tests/blocks-signature.rs13
-rw-r--r--tests/expectations/tests/blocks.rs4
-rw-r--r--tests/headers/blocks.hpp4
4 files changed, 17 insertions, 6 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 4dfd12ce..2d71942c 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -3961,7 +3961,7 @@ mod utils {
};
quote! {
- *const ::block::Block<(#(#args),*), #ret_ty>
+ *const ::block::Block<(#(#args,)*), #ret_ty>
}
}
}
diff --git a/tests/expectations/tests/blocks-signature.rs b/tests/expectations/tests/blocks-signature.rs
index 69dbbed8..b479dfc2 100644
--- a/tests/expectations/tests/blocks-signature.rs
+++ b/tests/expectations/tests/blocks-signature.rs
@@ -11,14 +11,19 @@
extern crate block;
extern "C" {
#[link_name = "\u{1}_Z8atexit_bU13block_pointerFvvE"]
- pub fn atexit_b(arg1: _bindgen_ty_id_20);
+ pub fn atexit_b(arg1: _bindgen_ty_id_25);
}
pub type dispatch_data_t = *mut ::std::os::raw::c_void;
-pub type dispatch_data_applier_t = _bindgen_ty_id_27;
+pub type dispatch_data_applier_t = _bindgen_ty_id_32;
extern "C" {
#[link_name = "\u{1}_Z19dispatch_data_applyPvU13block_pointerFbS_yPKvyE"]
pub fn dispatch_data_apply(data: dispatch_data_t, applier: dispatch_data_applier_t) -> bool;
}
-pub type _bindgen_ty_id_20 = *const ::block::Block<(), ()>;
-pub type _bindgen_ty_id_27 =
+extern "C" {
+ #[link_name = "\u{1}_Z3fooU13block_pointerFvyE"]
+ pub fn foo(arg1: _bindgen_ty_id_42) -> bool;
+}
+pub type _bindgen_ty_id_25 = *const ::block::Block<(), ()>;
+pub type _bindgen_ty_id_32 =
*const ::block::Block<(dispatch_data_t, usize, *const ::std::os::raw::c_void, usize), bool>;
+pub type _bindgen_ty_id_42 = *const ::block::Block<(usize,), ()>;
diff --git a/tests/expectations/tests/blocks.rs b/tests/expectations/tests/blocks.rs
index 70b616b8..16d144f8 100644
--- a/tests/expectations/tests/blocks.rs
+++ b/tests/expectations/tests/blocks.rs
@@ -18,3 +18,7 @@ extern "C" {
#[link_name = "\u{1}_Z19dispatch_data_applyPvU13block_pointerFbS_yPKvyE"]
pub fn dispatch_data_apply(data: dispatch_data_t, applier: dispatch_data_applier_t) -> bool;
}
+extern "C" {
+ #[link_name = "\u{1}_Z3fooU13block_pointerFvyE"]
+ pub fn foo(arg1: *mut ::std::os::raw::c_void) -> bool;
+}
diff --git a/tests/headers/blocks.hpp b/tests/headers/blocks.hpp
index b8bc71f9..4b53a8f4 100644
--- a/tests/headers/blocks.hpp
+++ b/tests/headers/blocks.hpp
@@ -13,4 +13,6 @@ typedef bool (^dispatch_data_applier_t)(dispatch_data_t region,
size_t size);
bool dispatch_data_apply(dispatch_data_t data,
- dispatch_data_applier_t applier); \ No newline at end of file
+ dispatch_data_applier_t applier);
+
+bool foo(void (^)(size_t bar));