about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSteven Fackler <sfackler@gmail.com>2014-09-28 22:31:50 -0700
committerSteven Fackler <sfackler@palantir.com>2014-09-30 12:52:00 -0700
commitd5647a8ea3932c8a44dad13699e128d3d3fee255 (patch)
treed3dc48b0810c66407d1c620d741920d295f96743 /src
parent1e0c7b682f1675e39085f1f0f928a37364bab9c7 (diff)
downloadrust-d5647a8ea3932c8a44dad13699e128d3d3fee255.tar.gz
rust-d5647a8ea3932c8a44dad13699e128d3d3fee255.zip
Fix libstd
Diffstat (limited to 'src')
-rw-r--r--src/libstd/dynamic_lib.rs22
-rw-r--r--src/libstd/io/net/addrinfo.rs2
-rw-r--r--src/libstd/io/process.rs14
-rw-r--r--src/libstd/io/signal.rs4
-rw-r--r--src/libstd/os.rs36
-rw-r--r--src/libstd/rand/os.rs2
-rw-r--r--src/libstd/rt/backtrace.rs28
7 files changed, 52 insertions, 56 deletions
diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs
index a88448f47e0..bd2bd1ad090 100644
--- a/src/libstd/dynamic_lib.rs
+++ b/src/libstd/dynamic_lib.rs
@@ -154,7 +154,7 @@ impl DynamicLibrary {
     }
 }
 
-#[cfg(test, not(target_os = "ios"))]
+#[cfg(all(test, not(target_os = "ios")))]
 mod test {
     use super::*;
     use prelude::*;
@@ -189,10 +189,10 @@ mod test {
     }
 
     #[test]
-    #[cfg(target_os = "linux")]
-    #[cfg(target_os = "macos")]
-    #[cfg(target_os = "freebsd")]
-    #[cfg(target_os = "dragonfly")]
+    #[cfg(any(target_os = "linux",
+              target_os = "macos",
+              target_os = "freebsd",
+              target_os = "dragonfly"))]
     fn test_errors_do_not_crash() {
         // Open /dev/null as a library to get an error, and make sure
         // that only causes an error, and not a crash.
@@ -204,12 +204,12 @@ mod test {
     }
 }
 
-#[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 dl {
 
     use c_str::{CString, ToCStr};
diff --git a/src/libstd/io/net/addrinfo.rs b/src/libstd/io/net/addrinfo.rs
index 867e8bcca82..ea1dd12f323 100644
--- a/src/libstd/io/net/addrinfo.rs
+++ b/src/libstd/io/net/addrinfo.rs
@@ -123,7 +123,7 @@ fn lookup(hostname: Option<&str>, servname: Option<&str>, hint: Option<Hint>)
 
 // Ignored on android since we cannot give tcp/ip
 // permission without help of apk
-#[cfg(test, not(target_os = "android"))]
+#[cfg(all(test, not(target_os = "android")))]
 mod test {
     iotest!(fn dns_smoke_test() {
         let ipaddrs = get_host_addresses("localhost").unwrap();
diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs
index 83890d2b127..f97e9f4647b 100644
--- a/src/libstd/io/process.rs
+++ b/src/libstd/io/process.rs
@@ -693,7 +693,7 @@ mod tests {
         drop(p.wait().clone());
     })
 
-    #[cfg(unix, not(target_os="android"))]
+    #[cfg(all(unix, not(target_os="android")))]
     iotest!(fn signal_reported_right() {
         let p = Command::new("/bin/sh").arg("-c").arg("kill -1 $$").spawn();
         assert!(p.is_ok());
@@ -725,7 +725,7 @@ mod tests {
         assert_eq!(run_output(cmd), "foobar\n".to_string());
     })
 
-    #[cfg(unix, not(target_os="android"))]
+    #[cfg(all(unix, not(target_os="android")))]
     iotest!(fn set_cwd_works() {
         let mut cmd = Command::new("/bin/sh");
         cmd.arg("-c").arg("pwd")
@@ -734,7 +734,7 @@ mod tests {
         assert_eq!(run_output(cmd), "/\n".to_string());
     })
 
-    #[cfg(unix, not(target_os="android"))]
+    #[cfg(all(unix, not(target_os="android")))]
     iotest!(fn stdin_works() {
         let mut p = Command::new("/bin/sh")
                             .arg("-c").arg("read line; echo $line")
@@ -759,7 +759,7 @@ mod tests {
         assert!(Command::new("test").uid(10).spawn().is_err());
     })
 
-    #[cfg(unix, not(target_os="android"))]
+    #[cfg(all(unix, not(target_os="android")))]
     iotest!(fn uid_works() {
         use libc;
         let mut p = Command::new("/bin/sh")
@@ -770,7 +770,7 @@ mod tests {
         assert!(p.wait().unwrap().success());
     })
 
-    #[cfg(unix, not(target_os="android"))]
+    #[cfg(all(unix, not(target_os="android")))]
     iotest!(fn uid_to_root_fails() {
         use libc;
 
@@ -847,7 +847,7 @@ mod tests {
         }
     })
 
-    #[cfg(unix,not(target_os="android"))]
+    #[cfg(all(unix, not(target_os="android")))]
     pub fn pwd_cmd() -> Command {
         Command::new("pwd")
     }
@@ -897,7 +897,7 @@ mod tests {
         assert_eq!(parent_stat.unstable.inode, child_stat.unstable.inode);
     })
 
-    #[cfg(unix,not(target_os="android"))]
+    #[cfg(all(unix, not(target_os="android")))]
     pub fn env_cmd() -> Command {
         Command::new("env")
     }
diff --git a/src/libstd/io/signal.rs b/src/libstd/io/signal.rs
index 1d882bdc0ad..79a00e90b40 100644
--- a/src/libstd/io/signal.rs
+++ b/src/libstd/io/signal.rs
@@ -160,7 +160,7 @@ impl Listener {
     }
 }
 
-#[cfg(test, unix)]
+#[cfg(all(test, unix))]
 mod test_unix {
     use prelude::*;
     use libc;
@@ -218,7 +218,7 @@ mod test_unix {
     }
 }
 
-#[cfg(test, windows)]
+#[cfg(all(test, windows))]
 mod test_windows {
     use super::{User1, Listener};
     use result::{Ok, Err};
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index 478a40f17b0..d904e657e40 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -653,8 +653,7 @@ pub fn dll_filename(base: &str) -> String {
 /// ```
 pub fn self_exe_name() -> Option<Path> {
 
-    #[cfg(target_os = "freebsd")]
-    #[cfg(target_os = "dragonfly")]
+    #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
     fn load_self() -> Option<Vec<u8>> {
         unsafe {
             use libc::funcs::bsd44::*;
@@ -680,8 +679,7 @@ pub fn self_exe_name() -> Option<Path> {
         }
     }
 
-    #[cfg(target_os = "linux")]
-    #[cfg(target_os = "android")]
+    #[cfg(any(target_os = "linux", target_os = "android"))]
     fn load_self() -> Option<Vec<u8>> {
         use std::io;
 
@@ -691,8 +689,7 @@ pub fn self_exe_name() -> Option<Path> {
         }
     }
 
-    #[cfg(target_os = "macos")]
-    #[cfg(target_os = "ios")]
+    #[cfg(any(target_os = "macos", target_os = "ios"))]
     fn load_self() -> Option<Vec<u8>> {
         unsafe {
             use libc::funcs::extra::_NSGetExecutablePath;
@@ -909,9 +906,9 @@ pub fn change_dir(p: &Path) -> bool {
 #[cfg(unix)]
 /// Returns the platform-specific value of errno
 pub fn errno() -> int {
-    #[cfg(target_os = "macos")]
-    #[cfg(target_os = "ios")]
-    #[cfg(target_os = "freebsd")]
+    #[cfg(any(target_os = "macos",
+              target_os = "ios",
+              target_os = "freebsd"))]
     fn errno_location() -> *const c_int {
         extern {
             fn __error() -> *const c_int;
@@ -931,8 +928,7 @@ pub fn errno() -> int {
         }
     }
 
-    #[cfg(target_os = "linux")]
-    #[cfg(target_os = "android")]
+    #[cfg(any(target_os = "linux", target_os = "android"))]
     fn errno_location() -> *const c_int {
         extern {
             fn __errno_location() -> *const c_int;
@@ -975,11 +971,11 @@ pub fn error_string(errnum: uint) -> String {
 
     #[cfg(unix)]
     fn strerror(errnum: uint) -> String {
-        #[cfg(target_os = "macos")]
-        #[cfg(target_os = "ios")]
-        #[cfg(target_os = "android")]
-        #[cfg(target_os = "freebsd")]
-        #[cfg(target_os = "dragonfly")]
+        #[cfg(any(target_os = "macos",
+                  target_os = "ios",
+                  target_os = "android",
+                  target_os = "freebsd",
+                  target_os = "dragonfly"))]
         fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: libc::size_t)
                       -> c_int {
             extern {
@@ -1180,10 +1176,10 @@ fn real_args_as_bytes() -> Vec<Vec<u8>> {
     res
 }
 
-#[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"))]
 fn real_args_as_bytes() -> Vec<Vec<u8>> {
     use rt;
 
diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs
index 120ace1c36a..c5b7154ffdb 100644
--- a/src/libstd/rand/os.rs
+++ b/src/libstd/rand/os.rs
@@ -13,7 +13,7 @@
 
 pub use self::imp::OsRng;
 
-#[cfg(unix, not(target_os = "ios"))]
+#[cfg(all(unix, not(target_os = "ios")))]
 mod imp {
     use io::{IoResult, File};
     use path::Path;
diff --git a/src/libstd/rt/backtrace.rs b/src/libstd/rt/backtrace.rs
index aa9505d83fc..33f8713e1a1 100644
--- a/src/libstd/rt/backtrace.rs
+++ b/src/libstd/rt/backtrace.rs
@@ -253,7 +253,7 @@ mod imp {
     /// play well with green threads, so while it is extremely nice
     /// and simple to use it should be used only on iOS devices as the
     /// only viable option.
-    #[cfg(target_os = "ios", target_arch = "arm")]
+    #[cfg(all(target_os = "ios", target_arch = "arm"))]
     #[inline(never)]
     pub fn write(w: &mut Writer) -> IoResult<()> {
         use iter::{Iterator, range};
@@ -284,7 +284,7 @@ mod imp {
         result::fold(iter, (), |_, _| ())
     }
 
-    #[cfg(not(target_os = "ios", target_arch = "arm"))]
+    #[cfg(not(all(target_os = "ios", target_arch = "arm")))]
     #[inline(never)] // if we know this is a function call, we can skip it when
                      // tracing
     pub fn write(w: &mut Writer) -> IoResult<()> {
@@ -365,8 +365,7 @@ mod imp {
         }
     }
 
-    #[cfg(target_os = "macos")]
-    #[cfg(target_os = "ios")]
+    #[cfg(any(target_os = "macos", target_os = "ios"))]
     fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void) -> IoResult<()> {
         use intrinsics;
         #[repr(C)]
@@ -391,7 +390,7 @@ mod imp {
         }
     }
 
-    #[cfg(not(target_os = "macos"), not(target_os = "ios"))]
+    #[cfg(not(any(target_os = "macos", target_os = "ios")))]
     fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void) -> IoResult<()> {
         use collections::Collection;
         use iter::Iterator;
@@ -571,16 +570,17 @@ mod imp {
 
         extern {
             // No native _Unwind_Backtrace on iOS
-            #[cfg(not(target_os = "ios", target_arch = "arm"))]
+            #[cfg(not(all(target_os = "ios", target_arch = "arm")))]
             pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn,
                                      trace_argument: *mut libc::c_void)
                         -> _Unwind_Reason_Code;
 
-            #[cfg(not(target_os = "android"),
-                  not(target_os = "linux", target_arch = "arm"))]
+            #[cfg(all(not(target_os = "android"),
+                      not(all(target_os = "linux", target_arch = "arm"))))]
             pub fn _Unwind_GetIP(ctx: *mut _Unwind_Context) -> libc::uintptr_t;
-            #[cfg(not(target_os = "android"),
-                  not(target_os = "linux", target_arch = "arm"))]
+
+            #[cfg(all(not(target_os = "android"),
+                      not(all(target_os = "linux", target_arch = "arm"))))]
             pub fn _Unwind_FindEnclosingFunction(pc: *mut libc::c_void)
                 -> *mut libc::c_void;
         }
@@ -588,8 +588,8 @@ mod imp {
         // On android, the function _Unwind_GetIP is a macro, and this is the
         // expansion of the macro. This is all copy/pasted directly from the
         // header file with the definition of _Unwind_GetIP.
-        #[cfg(target_os = "android")]
-        #[cfg(target_os = "linux", target_arch = "arm")]
+        #[cfg(any(target_os = "android",
+                  all(target_os = "linux", target_arch = "arm")))]
         pub unsafe fn _Unwind_GetIP(ctx: *mut _Unwind_Context) -> libc::uintptr_t {
             #[repr(C)]
             enum _Unwind_VRS_Result {
@@ -634,8 +634,8 @@ mod imp {
 
         // This function also doesn't exist on Android or ARM/Linux, so make it
         // a no-op
-        #[cfg(target_os = "android")]
-        #[cfg(target_os = "linux", target_arch = "arm")]
+        #[cfg(any(target_os = "android",
+                  all(target_os = "linux", target_arch = "arm")))]
         pub unsafe fn _Unwind_FindEnclosingFunction(pc: *mut libc::c_void)
             -> *mut libc::c_void
         {