Skip to content

Commit d31c809

Browse files
committed
fix deprecated warnings
1 parent 59a0a94 commit d31c809

File tree

4 files changed

+98
-1
lines changed

4 files changed

+98
-1
lines changed

src/task_info.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub type task_info_t = *mut integer_t;
4343
note = "requires the unstable feature to avoid undefined behavior"
4444
)
4545
)]
46+
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
4647
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
4748
pub struct task_dyld_info {
4849
pub all_image_info_addr: mach_vm_address_t,

src/vm.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ use vm_behavior::vm_behavior_t;
1111
use vm_inherit::vm_inherit_t;
1212
use vm_prot::vm_prot_t;
1313
use vm_purgable::vm_purgable_t;
14-
use vm_region::*;
1514
use vm_sync::vm_sync_t;
1615
use vm_types::*;
1716

17+
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
18+
use vm_region::*;
19+
1820
extern "C" {
1921
pub fn mach_vm_allocate(
2022
target: vm_task_entry_t,
@@ -52,6 +54,14 @@ extern "C" {
5254
dataCnt: *mut mach_msg_type_number_t,
5355
) -> kern_return_t;
5456

57+
#[cfg_attr(
58+
not(feature = "unstable"),
59+
deprecated(
60+
since = "0.2.3",
61+
note = "requires the `unstable` feature to avoid undefined behavior"
62+
)
63+
)]
64+
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
5565
pub fn mach_vm_read_list(
5666
target_task: vm_task_entry_t,
5767
data_list: mach_vm_read_entry_t,
@@ -216,6 +226,7 @@ mod tests {
216226
}
217227
}
218228

229+
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
219230
#[test]
220231
fn mach_vm_region_sanity() {
221232
unsafe {

src/vm_region.rs

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,23 @@ pub type vm_region_recurse_info_t = *mut ::libc::c_int;
1818
pub type vm_region_recurse_info_64_t = *mut ::libc::c_int;
1919
pub type vm_region_flavor_t = ::libc::c_int;
2020
pub type vm_region_info_data_t = [::libc::c_int; VM_REGION_INFO_MAX as usize];
21+
#[cfg_attr(
22+
not(feature = "unstable"),
23+
deprecated(
24+
since = "0.2.3",
25+
note = "requires the `unstable` feature to avoid undefined behavior"
26+
)
27+
)]
28+
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
2129
pub type vm_region_basic_info_64_t = *mut vm_region_basic_info_64;
30+
#[cfg_attr(
31+
not(feature = "unstable"),
32+
deprecated(
33+
since = "0.2.3",
34+
note = "requires the `unstable` feature to avoid undefined behavior"
35+
)
36+
)]
37+
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
2238
pub type vm_region_basic_info_data_64_t = vm_region_basic_info_64;
2339
pub type vm_region_basic_info_t = *mut vm_region_basic_info;
2440
pub type vm_region_basic_info_data_t = vm_region_basic_info;
@@ -28,14 +44,54 @@ pub type vm_region_top_info_t = *mut vm_region_top_info;
2844
pub type vm_region_top_info_data_t = vm_region_top_info;
2945
pub type vm_region_submap_info_t = *mut vm_region_submap_info;
3046
pub type vm_region_submap_info_data_t = vm_region_submap_info;
47+
#[cfg_attr(
48+
not(feature = "unstable"),
49+
deprecated(
50+
since = "0.2.3",
51+
note = "requires the `unstable` feature to avoid undefined behavior"
52+
)
53+
)]
54+
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
3155
pub type vm_region_submap_info_64_t = *mut vm_region_submap_info_64;
56+
#[cfg_attr(
57+
not(feature = "unstable"),
58+
deprecated(
59+
since = "0.2.3",
60+
note = "requires the `unstable` feature to avoid undefined behavior"
61+
)
62+
)]
63+
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
3264
pub type vm_region_submap_info_data_64_t = vm_region_submap_info_64;
65+
#[cfg_attr(
66+
not(feature = "unstable"),
67+
deprecated(
68+
since = "0.2.3",
69+
note = "requires the `unstable` feature to avoid undefined behavior"
70+
)
71+
)]
72+
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
3373
pub type vm_region_submap_short_info_64_t = *mut vm_region_submap_short_info_64;
74+
#[cfg_attr(
75+
not(feature = "unstable"),
76+
deprecated(
77+
since = "0.2.3",
78+
note = "requires the `unstable` feature to avoid undefined behavior"
79+
)
80+
)]
81+
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
3482
pub type vm_region_submap_short_info_data_64_t = vm_region_submap_short_info_64;
3583
pub type vm_page_info_t = *mut ::libc::c_int;
3684
pub type vm_page_info_flavor_t = ::libc::c_int;
3785
pub type vm_page_info_basic_t = *mut vm_page_info_basic;
3886
pub type vm_page_info_basic_data_t = vm_page_info_basic;
87+
#[cfg_attr(
88+
not(feature = "unstable"),
89+
deprecated(
90+
since = "0.2.3",
91+
note = "requires the `unstable` feature to avoid undefined behavior"
92+
)
93+
)]
94+
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
3995
pub type mach_vm_read_entry_t = [mach_vm_read_entry; VM_MAP_ENTRY_MAX as usize];
4096

4197
pub const VM_REGION_INFO_MAX: ::libc::c_int = (1 << 10);
@@ -65,6 +121,7 @@ pub const SM_SHARED_ALIASED: ::libc::c_uchar = 7;
65121
note = "requires the unstable feature to avoid undefined behavior"
66122
)
67123
)]
124+
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
68125
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
69126
pub struct vm_region_basic_info_64 {
70127
pub protection: vm_prot_t,
@@ -77,6 +134,14 @@ pub struct vm_region_basic_info_64 {
77134
pub user_wired_count: ::libc::c_ushort,
78135
}
79136

137+
#[cfg_attr(
138+
not(feature = "unstable"),
139+
deprecated(
140+
since = "0.2.3",
141+
note = "requires the `unstable` feature to avoid undefined behavior"
142+
)
143+
)]
144+
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
80145
impl vm_region_basic_info_64 {
81146
pub fn count() -> mach_msg_type_number_t {
82147
(mem::size_of::<Self>() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t
@@ -177,6 +242,7 @@ impl vm_region_submap_info {
177242
note = "requires the `unstable` feature to avoid undefined behavior"
178243
)
179244
)]
245+
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
180246
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
181247
pub struct vm_region_submap_info_64 {
182248
pub protection: vm_prot_t,
@@ -199,6 +265,14 @@ pub struct vm_region_submap_info_64 {
199265
pub pages_reusable: ::libc::c_uint,
200266
}
201267

268+
#[cfg_attr(
269+
not(feature = "unstable"),
270+
deprecated(
271+
since = "0.2.3",
272+
note = "requires the `unstable` feature to avoid undefined behavior"
273+
)
274+
)]
275+
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
202276
impl vm_region_submap_info_64 {
203277
pub fn count() -> mach_msg_type_number_t {
204278
(mem::size_of::<Self>() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t
@@ -214,6 +288,7 @@ impl vm_region_submap_info_64 {
214288
note = "requires the `unstable` feature to avoid undefined behavior"
215289
)
216290
)]
291+
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
217292
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
218293
pub struct vm_region_submap_short_info_64 {
219294
pub protection: vm_prot_t,
@@ -231,6 +306,14 @@ pub struct vm_region_submap_short_info_64 {
231306
pub user_wired_count: ::libc::c_ushort,
232307
}
233308

309+
#[cfg_attr(
310+
not(feature = "unstable"),
311+
deprecated(
312+
since = "0.2.3",
313+
note = "requires the `unstable` feature to avoid undefined behavior"
314+
)
315+
)]
316+
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
234317
impl vm_region_submap_short_info_64 {
235318
pub fn count() -> mach_msg_type_number_t {
236319
(mem::size_of::<Self>() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t
@@ -263,6 +346,7 @@ impl vm_page_info_basic {
263346
note = "requires the `unstable` feature to avoid undefined behavior"
264347
)
265348
)]
349+
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
266350
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
267351
pub struct mach_vm_read_entry {
268352
pub address: mach_vm_address_t,

src/vm_statistics.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ pub struct vm_statistics {
6969
since = "0.2.3",
7070
note = "`pmap_statistics` was removed after MacOSX 10.3.9"
7171
)]
72+
#[cfg_attr(feature = "deprecated", allow(deprecated))]
7273
#[repr(C)]
7374
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
7475
pub struct pmap_statistics {

0 commit comments

Comments
 (0)