Skip to content

Commit d27d56a

Browse files
committed
Add a dispatch_object_s type to fix improper_ctypes warnings.
These warnings starting appearing from rust-lang/rust#26583.
1 parent 8407505 commit d27d56a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/ffi.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
use libc::{c_char, c_long, c_ulong, c_void, size_t, timespec};
44

5+
pub enum dispatch_object_s { }
6+
57
// dispatch_block_t
68
pub type dispatch_function_t = extern fn(*mut c_void);
7-
pub type dispatch_semaphore_t = *mut ();
8-
pub type dispatch_group_t = *mut ();
9-
pub type dispatch_object_t = *mut ();
9+
pub type dispatch_semaphore_t = *mut dispatch_object_s;
10+
pub type dispatch_group_t = *mut dispatch_object_s;
11+
pub type dispatch_object_t = *mut dispatch_object_s;
1012
pub type dispatch_once_t = c_long;
11-
pub type dispatch_queue_t = *mut ();
13+
pub type dispatch_queue_t = *mut dispatch_object_s;
1214
pub type dispatch_time_t = u64;
1315
// dispatch_source_type_t
1416
// dispatch_fd_t
@@ -19,12 +21,12 @@ pub type dispatch_time_t = u64;
1921
// dispatch_io_type_t
2022
// dispatch_io_close_flags_t
2123
// dispatch_io_interval_flags_t
22-
pub type dispatch_queue_attr_t = *const ();
24+
pub type dispatch_queue_attr_t = *const dispatch_object_s;
2325

2426
#[link(name = "System", kind = "dylib")]
2527
extern {
26-
static _dispatch_main_q: ();
27-
static _dispatch_queue_attr_concurrent: ();
28+
static _dispatch_main_q: dispatch_object_s;
29+
static _dispatch_queue_attr_concurrent: dispatch_object_s;
2830

2931
pub fn dispatch_get_global_queue(identifier: c_long, flags: c_ulong) -> dispatch_queue_t;
3032
pub fn dispatch_queue_create(label: *const c_char, attr: dispatch_queue_attr_t) -> dispatch_queue_t;

0 commit comments

Comments
 (0)