Skip to content

Commit 9fb016e

Browse files
authored
Merge pull request #1519 from flier/fix-one-argument-block-pointer
fix one argument block pointer issue, #1378
2 parents 8070336 + 5063e94 commit 9fb016e

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

src/codegen/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3961,7 +3961,7 @@ mod utils {
39613961
};
39623962

39633963
quote! {
3964-
*const ::block::Block<(#(#args),*), #ret_ty>
3964+
*const ::block::Block<(#(#args,)*), #ret_ty>
39653965
}
39663966
}
39673967
}

tests/expectations/tests/blocks-signature.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,19 @@
1111
extern crate block;
1212
extern "C" {
1313
#[link_name = "\u{1}_Z8atexit_bU13block_pointerFvvE"]
14-
pub fn atexit_b(arg1: _bindgen_ty_id_20);
14+
pub fn atexit_b(arg1: _bindgen_ty_id_25);
1515
}
1616
pub type dispatch_data_t = *mut ::std::os::raw::c_void;
17-
pub type dispatch_data_applier_t = _bindgen_ty_id_27;
17+
pub type dispatch_data_applier_t = _bindgen_ty_id_32;
1818
extern "C" {
1919
#[link_name = "\u{1}_Z19dispatch_data_applyPvU13block_pointerFbS_yPKvyE"]
2020
pub fn dispatch_data_apply(data: dispatch_data_t, applier: dispatch_data_applier_t) -> bool;
2121
}
22-
pub type _bindgen_ty_id_20 = *const ::block::Block<(), ()>;
23-
pub type _bindgen_ty_id_27 =
22+
extern "C" {
23+
#[link_name = "\u{1}_Z3fooU13block_pointerFvyE"]
24+
pub fn foo(arg1: _bindgen_ty_id_42) -> bool;
25+
}
26+
pub type _bindgen_ty_id_25 = *const ::block::Block<(), ()>;
27+
pub type _bindgen_ty_id_32 =
2428
*const ::block::Block<(dispatch_data_t, usize, *const ::std::os::raw::c_void, usize), bool>;
29+
pub type _bindgen_ty_id_42 = *const ::block::Block<(usize,), ()>;

tests/expectations/tests/blocks.rs

+4
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ extern "C" {
1818
#[link_name = "\u{1}_Z19dispatch_data_applyPvU13block_pointerFbS_yPKvyE"]
1919
pub fn dispatch_data_apply(data: dispatch_data_t, applier: dispatch_data_applier_t) -> bool;
2020
}
21+
extern "C" {
22+
#[link_name = "\u{1}_Z3fooU13block_pointerFvyE"]
23+
pub fn foo(arg1: *mut ::std::os::raw::c_void) -> bool;
24+
}

tests/headers/blocks.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ typedef bool (^dispatch_data_applier_t)(dispatch_data_t region,
1313
size_t size);
1414

1515
bool dispatch_data_apply(dispatch_data_t data,
16-
dispatch_data_applier_t applier);
16+
dispatch_data_applier_t applier);
17+
18+
bool foo(void (^)(size_t bar));

0 commit comments

Comments
 (0)