Skip to content

Commit 848962f

Browse files
committed
libstd: windows: Use cfg_if instead of NIH ifdef macro
1 parent de8bf5b commit 848962f

File tree

1 file changed

+6
-8
lines changed
  • src/libstd/sys/windows

1 file changed

+6
-8
lines changed

src/libstd/sys/windows/c.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
#![cfg_attr(test, allow(dead_code))]
55
#![unstable(issue = "0", feature = "windows_c")]
66

7-
macro_rules! ifdef {
8-
($($t:tt)*) => ($($t)*)
9-
}
10-
117
use crate::os::raw::{c_int, c_uint, c_ulong, c_long, c_longlong, c_ushort, c_char};
128
use crate::ptr;
139

@@ -608,8 +604,8 @@ pub struct timeval {
608604
}
609605

610606
// Functions forbidden when targeting UWP
611-
#[cfg(not(target_vendor = "uwp"))]
612-
ifdef! {
607+
cfg_if::cfg_if! {
608+
if #[cfg(not(target_vendor = "uwp"))] {
613609
pub const EXCEPTION_CONTINUE_SEARCH: LONG = 0;
614610
pub const EXCEPTION_STACK_OVERFLOW: DWORD = 0xc00000fd;
615611
pub const EXCEPTION_MAXIMUM_PARAMETERS: usize = 15;
@@ -707,10 +703,11 @@ ifdef! {
707703
-> BOOL;
708704
}
709705
}
706+
}
710707

711708
// UWP specific functions & types
712-
#[cfg(target_vendor = "uwp")]
713-
ifdef! {
709+
cfg_if::cfg_if! {
710+
if #[cfg(target_vendor = "uwp")] {
714711
pub const BCRYPT_USE_SYSTEM_PREFERRED_RNG: DWORD = 0x00000002;
715712

716713
#[repr(C)]
@@ -731,6 +728,7 @@ ifdef! {
731728
cbBuffer: ULONG, dwFlags: ULONG) -> LONG;
732729
}
733730
}
731+
}
734732

735733
// Shared between Desktop & UWP
736734
extern "system" {

0 commit comments

Comments
 (0)