From d31c809c22724c5dad198037ad03bfec7906e016 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Sat, 27 Oct 2018 18:00:31 +0200 Subject: [PATCH] fix deprecated warnings --- src/task_info.rs | 1 + src/vm.rs | 13 ++++++- src/vm_region.rs | 84 ++++++++++++++++++++++++++++++++++++++++++++ src/vm_statistics.rs | 1 + 4 files changed, 98 insertions(+), 1 deletion(-) diff --git a/src/task_info.rs b/src/task_info.rs index 1f12202..082977b 100644 --- a/src/task_info.rs +++ b/src/task_info.rs @@ -43,6 +43,7 @@ pub type task_info_t = *mut integer_t; note = "requires the unstable feature to avoid undefined behavior" ) )] +#[cfg_attr(not(feature = "unstable"), allow(deprecated))] #[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)] pub struct task_dyld_info { pub all_image_info_addr: mach_vm_address_t, diff --git a/src/vm.rs b/src/vm.rs index 947b3f1..2b218c5 100644 --- a/src/vm.rs +++ b/src/vm.rs @@ -11,10 +11,12 @@ use vm_behavior::vm_behavior_t; use vm_inherit::vm_inherit_t; use vm_prot::vm_prot_t; use vm_purgable::vm_purgable_t; -use vm_region::*; use vm_sync::vm_sync_t; use vm_types::*; +#[cfg_attr(not(feature = "unstable"), allow(deprecated))] +use vm_region::*; + extern "C" { pub fn mach_vm_allocate( target: vm_task_entry_t, @@ -52,6 +54,14 @@ extern "C" { dataCnt: *mut mach_msg_type_number_t, ) -> kern_return_t; + #[cfg_attr( + not(feature = "unstable"), + deprecated( + since = "0.2.3", + note = "requires the `unstable` feature to avoid undefined behavior" + ) + )] + #[cfg_attr(not(feature = "unstable"), allow(deprecated))] pub fn mach_vm_read_list( target_task: vm_task_entry_t, data_list: mach_vm_read_entry_t, @@ -216,6 +226,7 @@ mod tests { } } + #[cfg_attr(not(feature = "unstable"), allow(deprecated))] #[test] fn mach_vm_region_sanity() { unsafe { diff --git a/src/vm_region.rs b/src/vm_region.rs index c25287c..4ee78b2 100644 --- a/src/vm_region.rs +++ b/src/vm_region.rs @@ -18,7 +18,23 @@ pub type vm_region_recurse_info_t = *mut ::libc::c_int; pub type vm_region_recurse_info_64_t = *mut ::libc::c_int; pub type vm_region_flavor_t = ::libc::c_int; pub type vm_region_info_data_t = [::libc::c_int; VM_REGION_INFO_MAX as usize]; +#[cfg_attr( + not(feature = "unstable"), + deprecated( + since = "0.2.3", + note = "requires the `unstable` feature to avoid undefined behavior" + ) +)] +#[cfg_attr(not(feature = "unstable"), allow(deprecated))] pub type vm_region_basic_info_64_t = *mut vm_region_basic_info_64; +#[cfg_attr( + not(feature = "unstable"), + deprecated( + since = "0.2.3", + note = "requires the `unstable` feature to avoid undefined behavior" + ) +)] +#[cfg_attr(not(feature = "unstable"), allow(deprecated))] pub type vm_region_basic_info_data_64_t = vm_region_basic_info_64; pub type vm_region_basic_info_t = *mut vm_region_basic_info; 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; pub type vm_region_top_info_data_t = vm_region_top_info; pub type vm_region_submap_info_t = *mut vm_region_submap_info; pub type vm_region_submap_info_data_t = vm_region_submap_info; +#[cfg_attr( + not(feature = "unstable"), + deprecated( + since = "0.2.3", + note = "requires the `unstable` feature to avoid undefined behavior" + ) +)] +#[cfg_attr(not(feature = "unstable"), allow(deprecated))] pub type vm_region_submap_info_64_t = *mut vm_region_submap_info_64; +#[cfg_attr( + not(feature = "unstable"), + deprecated( + since = "0.2.3", + note = "requires the `unstable` feature to avoid undefined behavior" + ) +)] +#[cfg_attr(not(feature = "unstable"), allow(deprecated))] pub type vm_region_submap_info_data_64_t = vm_region_submap_info_64; +#[cfg_attr( + not(feature = "unstable"), + deprecated( + since = "0.2.3", + note = "requires the `unstable` feature to avoid undefined behavior" + ) +)] +#[cfg_attr(not(feature = "unstable"), allow(deprecated))] pub type vm_region_submap_short_info_64_t = *mut vm_region_submap_short_info_64; +#[cfg_attr( + not(feature = "unstable"), + deprecated( + since = "0.2.3", + note = "requires the `unstable` feature to avoid undefined behavior" + ) +)] +#[cfg_attr(not(feature = "unstable"), allow(deprecated))] pub type vm_region_submap_short_info_data_64_t = vm_region_submap_short_info_64; pub type vm_page_info_t = *mut ::libc::c_int; pub type vm_page_info_flavor_t = ::libc::c_int; pub type vm_page_info_basic_t = *mut vm_page_info_basic; pub type vm_page_info_basic_data_t = vm_page_info_basic; +#[cfg_attr( + not(feature = "unstable"), + deprecated( + since = "0.2.3", + note = "requires the `unstable` feature to avoid undefined behavior" + ) +)] +#[cfg_attr(not(feature = "unstable"), allow(deprecated))] pub type mach_vm_read_entry_t = [mach_vm_read_entry; VM_MAP_ENTRY_MAX as usize]; pub const VM_REGION_INFO_MAX: ::libc::c_int = (1 << 10); @@ -65,6 +121,7 @@ pub const SM_SHARED_ALIASED: ::libc::c_uchar = 7; note = "requires the unstable feature to avoid undefined behavior" ) )] +#[cfg_attr(not(feature = "unstable"), allow(deprecated))] #[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)] pub struct vm_region_basic_info_64 { pub protection: vm_prot_t, @@ -77,6 +134,14 @@ pub struct vm_region_basic_info_64 { pub user_wired_count: ::libc::c_ushort, } +#[cfg_attr( + not(feature = "unstable"), + deprecated( + since = "0.2.3", + note = "requires the `unstable` feature to avoid undefined behavior" + ) +)] +#[cfg_attr(not(feature = "unstable"), allow(deprecated))] impl vm_region_basic_info_64 { pub fn count() -> mach_msg_type_number_t { (mem::size_of::() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t @@ -177,6 +242,7 @@ impl vm_region_submap_info { note = "requires the `unstable` feature to avoid undefined behavior" ) )] +#[cfg_attr(not(feature = "unstable"), allow(deprecated))] #[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)] pub struct vm_region_submap_info_64 { pub protection: vm_prot_t, @@ -199,6 +265,14 @@ pub struct vm_region_submap_info_64 { pub pages_reusable: ::libc::c_uint, } +#[cfg_attr( + not(feature = "unstable"), + deprecated( + since = "0.2.3", + note = "requires the `unstable` feature to avoid undefined behavior" + ) +)] +#[cfg_attr(not(feature = "unstable"), allow(deprecated))] impl vm_region_submap_info_64 { pub fn count() -> mach_msg_type_number_t { (mem::size_of::() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t @@ -214,6 +288,7 @@ impl vm_region_submap_info_64 { note = "requires the `unstable` feature to avoid undefined behavior" ) )] +#[cfg_attr(not(feature = "unstable"), allow(deprecated))] #[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)] pub struct vm_region_submap_short_info_64 { pub protection: vm_prot_t, @@ -231,6 +306,14 @@ pub struct vm_region_submap_short_info_64 { pub user_wired_count: ::libc::c_ushort, } +#[cfg_attr( + not(feature = "unstable"), + deprecated( + since = "0.2.3", + note = "requires the `unstable` feature to avoid undefined behavior" + ) +)] +#[cfg_attr(not(feature = "unstable"), allow(deprecated))] impl vm_region_submap_short_info_64 { pub fn count() -> mach_msg_type_number_t { (mem::size_of::() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t @@ -263,6 +346,7 @@ impl vm_page_info_basic { note = "requires the `unstable` feature to avoid undefined behavior" ) )] +#[cfg_attr(not(feature = "unstable"), allow(deprecated))] #[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)] pub struct mach_vm_read_entry { pub address: mach_vm_address_t, diff --git a/src/vm_statistics.rs b/src/vm_statistics.rs index 955ffe0..5cc3a15 100644 --- a/src/vm_statistics.rs +++ b/src/vm_statistics.rs @@ -69,6 +69,7 @@ pub struct vm_statistics { since = "0.2.3", note = "`pmap_statistics` was removed after MacOSX 10.3.9" )] +#[cfg_attr(feature = "deprecated", allow(deprecated))] #[repr(C)] #[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)] pub struct pmap_statistics {