From c76151529a79bf85f54d95cf41876d83a0fdad1d Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sun, 28 Sep 2014 21:02:04 -0700 Subject: [PATCH] Fix cfg warnings for liblibc --- src/liblibc/lib.rs | 201 +++++++++++++++++++++------------------------ 1 file changed, 93 insertions(+), 108 deletions(-) diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index eabc02e3e26..affa452eb49 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -278,32 +278,31 @@ pub use funcs::bsd43::{shutdown}; #[cfg(windows)] pub use funcs::extra::msvcrt::{get_osfhandle, open_osfhandle}; #[cfg(windows)] pub use funcs::extra::winsock::{ioctlsocket}; -#[cfg(target_os = "linux")] #[cfg(target_os = "android")] -#[cfg(target_os = "freebsd")] #[cfg(target_os = "dragonfly")] +#[cfg(any(target_os = "linux", + target_os = "android", + target_os = "freebsd", + target_os = "dragonfly"))] pub use consts::os::posix01::{CLOCK_REALTIME, CLOCK_MONOTONIC}; -#[cfg(target_os = "linux")] #[cfg(target_os = "android")] +#[cfg(any(target_os = "linux", target_os = "android"))] pub use funcs::posix01::unistd::{fdatasync}; -#[cfg(target_os = "linux")] #[cfg(target_os = "android")] +#[cfg(any(target_os = "linux", target_os = "android"))] pub use types::os::arch::extra::{sockaddr_ll}; -#[cfg(target_os = "linux")] #[cfg(target_os = "android")] +#[cfg(any(target_os = "linux", target_os = "android"))] pub use consts::os::extra::{AF_PACKET}; -#[cfg(unix, not(target_os = "freebsd"))] +#[cfg(all(unix, not(target_os = "freebsd")))] pub use consts::os::extra::{MAP_STACK}; -#[cfg(target_os = "freebsd")] -#[cfg(target_os = "dragonfly")] +#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] pub use consts::os::bsd44::{TCP_KEEPIDLE}; -#[cfg(target_os = "macos")] -#[cfg(target_os = "ios")] +#[cfg(any(target_os = "macos", target_os = "ios"))] pub use consts::os::bsd44::{TCP_KEEPALIVE}; -#[cfg(target_os = "macos")] -#[cfg(target_os = "ios")] +#[cfg(any(target_os = "macos", target_os = "ios"))] pub use consts::os::extra::{F_FULLFSYNC}; -#[cfg(target_os = "macos")] -#[cfg(target_os = "ios")] + +#[cfg(any(target_os = "macos", target_os = "ios"))] pub use types::os::arch::extra::{mach_timebase_info}; @@ -372,8 +371,7 @@ pub mod types { // Standard types that are scalar but vary by OS and arch. - #[cfg(target_os = "linux")] - #[cfg(target_os = "android")] + #[cfg(any(target_os = "linux", target_os = "android"))] pub mod os { pub mod common { pub mod posix01 { @@ -506,10 +504,10 @@ pub mod types { } } - #[cfg(target_arch = "x86")] - #[cfg(target_arch = "arm")] - #[cfg(target_arch = "mips")] - #[cfg(target_arch = "mipsel")] + #[cfg(any(target_arch = "x86", + target_arch = "arm", + target_arch = "mips", + target_arch = "mipsel"))] pub mod arch { pub mod c95 { pub type c_char = i8; @@ -536,9 +534,9 @@ pub mod types { pub type intptr_t = i32; pub type uintptr_t = u32; } - #[cfg(target_arch = "x86")] - #[cfg(target_arch = "mips")] - #[cfg(target_arch = "mipsel")] + #[cfg(any(target_arch = "x86", + target_arch = "mips", + target_arch = "mipsel"))] pub mod posix88 { pub type off_t = i32; pub type dev_t = u64; @@ -652,8 +650,7 @@ pub mod types { pub __size: [u32, ..9] } } - #[cfg(target_arch = "mips")] - #[cfg(target_arch = "mipsel")] + #[cfg(any(target_arch = "mips", target_arch = "mipsel"))] pub mod posix01 { use types::os::arch::c95::{c_long, c_ulong, time_t}; use types::os::arch::posix88::{gid_t, ino_t}; @@ -1660,8 +1657,7 @@ pub mod types { } } - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] pub mod os { pub mod common { pub mod posix01 { @@ -1793,8 +1789,7 @@ pub mod types { } } - #[cfg(target_arch = "arm")] - #[cfg(target_arch = "x86")] + #[cfg(any(target_arch = "arm", target_arch = "x86"))] pub mod arch { pub mod c95 { pub type c_char = i8; @@ -2383,8 +2378,7 @@ pub mod consts { } - #[cfg(target_os = "linux")] - #[cfg(target_os = "android")] + #[cfg(any(target_os = "linux", target_os = "android"))] pub mod os { pub mod c95 { use types::os::arch::c95::{c_int, c_uint}; @@ -2407,9 +2401,9 @@ pub mod consts { } pub mod c99 { } - #[cfg(target_arch = "x86")] - #[cfg(target_arch = "x86_64")] - #[cfg(target_arch = "arm")] + #[cfg(any(target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm"))] pub mod posix88 { use types::os::arch::c95::c_int; use types::common::c95::c_void; @@ -2621,8 +2615,7 @@ pub mod consts { pub static EHWPOISON: c_int = 133; } - #[cfg(target_arch = "mips")] - #[cfg(target_arch = "mipsel")] + #[cfg(any(target_arch = "mips", target_arch = "mipsel"))] pub mod posix88 { use types::os::arch::c95::c_int; use types::common::c95::c_void; @@ -2898,13 +2891,14 @@ pub mod consts { #[cfg(target_os = "android")] pub static PTHREAD_STACK_MIN: size_t = 8192; - #[cfg(target_arch = "arm", target_os = "linux")] - #[cfg(target_arch = "x86", target_os = "linux")] - #[cfg(target_arch = "x86_64", target_os = "linux")] + #[cfg(all(target_os = "linux", + any(target_arch = "arm", + target_arch = "x86", + target_arch = "x86_64")))] pub static PTHREAD_STACK_MIN: size_t = 16384; - #[cfg(target_arch = "mips", target_os = "linux")] - #[cfg(target_arch = "mipsel", target_os = "linux")] + #[cfg(all(target_os = "linux", + any(target_arch = "mips", target_arch = "mipsel")))] pub static PTHREAD_STACK_MIN: size_t = 131072; pub static CLOCK_REALTIME: c_int = 0; @@ -2912,9 +2906,9 @@ pub mod consts { } pub mod posix08 { } - #[cfg(target_arch = "arm")] - #[cfg(target_arch = "x86")] - #[cfg(target_arch = "x86_64")] + #[cfg(any(target_arch = "arm", + target_arch = "x86", + target_arch = "x86_64"))] pub mod bsd44 { use types::os::arch::c95::c_int; @@ -2961,8 +2955,7 @@ pub mod consts { pub static SHUT_WR: c_int = 1; pub static SHUT_RDWR: c_int = 2; } - #[cfg(target_arch = "mips")] - #[cfg(target_arch = "mipsel")] + #[cfg(any(target_arch = "mips", target_arch = "mipsel"))] pub mod bsd44 { use types::os::arch::c95::c_int; @@ -3007,9 +3000,9 @@ pub mod consts { pub static SHUT_WR: c_int = 1; pub static SHUT_RDWR: c_int = 2; } - #[cfg(target_arch = "x86")] - #[cfg(target_arch = "x86_64")] - #[cfg(target_arch = "arm")] + #[cfg(any(target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm"))] pub mod extra { use types::os::arch::c95::c_int; @@ -3036,8 +3029,7 @@ pub mod consts { pub static MAP_NONBLOCK : c_int = 0x010000; pub static MAP_STACK : c_int = 0x020000; } - #[cfg(target_arch = "mips")] - #[cfg(target_arch = "mipsel")] + #[cfg(any(target_arch = "mips", target_arch = "mipsel"))] pub mod extra { use types::os::arch::c95::c_int; @@ -3160,8 +3152,7 @@ pub mod consts { } } - #[cfg(target_os = "freebsd")] - #[cfg(target_os = "dragonfly")] + #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] pub mod os { pub mod c95 { use types::os::arch::c95::{c_int, c_uint}; @@ -3421,10 +3412,11 @@ pub mod consts { #[cfg(target_arch = "arm")] pub static PTHREAD_STACK_MIN: size_t = 4096; - #[cfg(target_os = "freebsd", target_arch = "mips")] - #[cfg(target_os = "freebsd", target_arch = "mipsel")] - #[cfg(target_os = "freebsd", target_arch = "x86")] - #[cfg(target_os = "freebsd", target_arch = "x86_64")] + #[cfg(all(target_os = "freebsd", + any(target_arch = "mips", + target_arch = "mipsel", + target_arch = "x86", + target_arch = "x86_64")))] pub static PTHREAD_STACK_MIN: size_t = 2048; #[cfg(target_os = "dragonfly")] @@ -3569,8 +3561,7 @@ pub mod consts { } } - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] pub mod os { pub mod c95 { use types::os::arch::c95::{c_int, c_uint}; @@ -4261,13 +4252,12 @@ pub mod funcs { } } - - #[cfg(target_os = "linux")] - #[cfg(target_os = "android")] - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] - #[cfg(target_os = "freebsd")] - #[cfg(target_os = "dragonfly")] + #[cfg(any(target_os = "linux", + target_os = "android", + target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "dragonfly"))] pub mod posix88 { pub mod stat_ { use types::os::arch::c95::{c_char, c_int}; @@ -4278,11 +4268,11 @@ pub mod funcs { pub fn chmod(path: *const c_char, mode: mode_t) -> c_int; pub fn fchmod(fd: c_int, mode: mode_t) -> c_int; - #[cfg(target_os = "linux")] - #[cfg(target_os = "freebsd")] - #[cfg(target_os = "dragonfly")] - #[cfg(target_os = "android")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "linux", + target_os = "freebsd", + target_os = "dragonfly", + target_os = "android", + target_os = "ios"))] pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int; #[cfg(target_os = "macos")] @@ -4292,11 +4282,11 @@ pub mod funcs { pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int; pub fn mkfifo(path: *const c_char, mode: mode_t) -> c_int; - #[cfg(target_os = "linux")] - #[cfg(target_os = "freebsd")] - #[cfg(target_os = "dragonfly")] - #[cfg(target_os = "android")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "linux", + target_os = "freebsd", + target_os = "dragonfly", + target_os = "android", + target_os = "ios"))] pub fn stat(path: *const c_char, buf: *mut stat) -> c_int; #[cfg(target_os = "macos")] @@ -4481,23 +4471,23 @@ pub mod funcs { } - #[cfg(target_os = "linux")] - #[cfg(target_os = "android")] - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] - #[cfg(target_os = "freebsd")] - #[cfg(target_os = "dragonfly")] + #[cfg(any(target_os = "linux", + target_os = "android", + target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "dragonfly"))] pub mod posix01 { pub mod stat_ { use types::os::arch::c95::{c_char, c_int}; use types::os::arch::posix01::stat; extern { - #[cfg(target_os = "linux")] - #[cfg(target_os = "freebsd")] - #[cfg(target_os = "dragonfly")] - #[cfg(target_os = "android")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "linux", + target_os = "freebsd", + target_os = "dragonfly", + target_os = "android", + target_os = "ios"))] pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int; #[cfg(target_os = "macos")] @@ -4518,8 +4508,7 @@ pub mod funcs { pub fn fsync(fd: c_int) -> c_int; - #[cfg(target_os = "linux")] - #[cfg(target_os = "android")] + #[cfg(any(target_os = "linux", target_os = "android"))] pub fn fdatasync(fd: c_int) -> c_int; pub fn setenv(name: *const c_char, val: *const c_char, @@ -4598,13 +4587,13 @@ pub mod funcs { } - #[cfg(target_os = "windows")] - #[cfg(target_os = "linux")] - #[cfg(target_os = "android")] - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] - #[cfg(target_os = "freebsd")] - #[cfg(target_os = "dragonfly")] + #[cfg(any(target_os = "windows", + target_os = "linux", + target_os = "android", + target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "dragonfly"))] pub mod posix08 { pub mod unistd { } @@ -4687,10 +4676,10 @@ pub mod funcs { } } - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] - #[cfg(target_os = "freebsd")] - #[cfg(target_os = "dragonfly")] + #[cfg(any(target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "dragonfly"))] pub mod bsd44 { use types::common::c95::{c_void}; use types::os::arch::c95::{c_char, c_uchar, c_int, c_uint, c_ulong, size_t}; @@ -4723,8 +4712,7 @@ pub mod funcs { } - #[cfg(target_os = "linux")] - #[cfg(target_os = "android")] + #[cfg(any(target_os = "linux", target_os = "android"))] pub mod bsd44 { use types::common::c95::{c_void}; use types::os::arch::c95::{c_uchar, c_int, size_t}; @@ -4744,8 +4732,7 @@ pub mod funcs { pub mod bsd44 { } - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] pub mod extra { use types::os::arch::c95::{c_char, c_int}; @@ -4755,13 +4742,11 @@ pub mod funcs { } } - #[cfg(target_os = "freebsd")] - #[cfg(target_os = "dragonfly")] + #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] pub mod extra { } - #[cfg(target_os = "linux")] - #[cfg(target_os = "android")] + #[cfg(any(target_os = "linux", target_os = "android"))] pub mod extra { }