about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSteven Fackler <sfackler@gmail.com>2014-09-28 23:38:24 -0700
committerSteven Fackler <sfackler@palantir.com>2014-09-30 12:52:46 -0700
commitad833526186c9dffc6a7381a3fa02c35543461c9 (patch)
treeaa2ff98c7e1283fbe824bb0caf7de5ac1633c489
parentd5647a8ea3932c8a44dad13699e128d3d3fee255 (diff)
downloadrust-ad833526186c9dffc6a7381a3fa02c35543461c9.tar.gz
rust-ad833526186c9dffc6a7381a3fa02c35543461c9.zip
Fix librustrt
-rw-r--r--src/librustrt/args.rs14
-rw-r--r--src/librustrt/lib.rs2
-rw-r--r--src/librustrt/libunwind.rs19
-rw-r--r--src/librustrt/local_ptr.rs10
-rw-r--r--src/librustrt/mutex.rs6
-rw-r--r--src/librustrt/stack.rs72
-rw-r--r--src/librustrt/thread_local_storage.rs10
-rw-r--r--src/librustrt/unwind.rs10
8 files changed, 74 insertions, 69 deletions
diff --git a/src/librustrt/args.rs b/src/librustrt/args.rs
index c0a17a72014..bd63886baee 100644
--- a/src/librustrt/args.rs
+++ b/src/librustrt/args.rs
@@ -39,10 +39,10 @@ pub fn put(args: Vec<Vec<u8>>) { imp::put(args) }
 /// Make a clone of the global arguments.
 pub fn clone() -> Option<Vec<Vec<u8>>> { imp::clone() }
 
-#[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"))]
 mod imp {
     use core::prelude::*;
 
@@ -146,9 +146,9 @@ mod imp {
     }
 }
 
-#[cfg(target_os = "macos")]
-#[cfg(target_os = "ios")]
-#[cfg(target_os = "windows")]
+#[cfg(any(target_os = "macos",
+          target_os = "ios",
+          target_os = "windows"))]
 mod imp {
     use core::prelude::*;
     use collections::vec::Vec;
diff --git a/src/librustrt/lib.rs b/src/librustrt/lib.rs
index b4ad1f23154..72c7d89a3b9 100644
--- a/src/librustrt/lib.rs
+++ b/src/librustrt/lib.rs
@@ -160,7 +160,7 @@ pub unsafe fn cleanup() {
 pub mod shouldnt_be_public {
     #[cfg(not(test))]
     pub use super::local_ptr::native::maybe_tls_key;
-    #[cfg(not(windows), not(target_os = "android"), not(target_os = "ios"))]
+    #[cfg(all(not(windows), not(target_os = "android"), not(target_os = "ios")))]
     pub use super::local_ptr::compiled::RT_TLS_PTR;
 }
 
diff --git a/src/librustrt/libunwind.rs b/src/librustrt/libunwind.rs
index aab75d7f774..2e7408d9159 100644
--- a/src/librustrt/libunwind.rs
+++ b/src/librustrt/libunwind.rs
@@ -16,8 +16,7 @@
 
 use libc;
 
-#[cfg(not(target_arch = "arm"))]
-#[cfg(target_os = "ios")]
+#[cfg(any(not(target_arch = "arm"), target_os = "ios"))]
 #[repr(C)]
 pub enum _Unwind_Action {
     _UA_SEARCH_PHASE = 1,
@@ -62,14 +61,13 @@ pub static unwinder_private_data_size: uint = 5;
 #[cfg(target_arch = "x86_64")]
 pub static unwinder_private_data_size: uint = 6;
 
-#[cfg(target_arch = "arm", not(target_os = "ios"))]
+#[cfg(all(target_arch = "arm", not(target_os = "ios")))]
 pub static unwinder_private_data_size: uint = 20;
 
-#[cfg(target_arch = "arm", target_os = "ios")]
+#[cfg(all(target_arch = "arm", target_os = "ios"))]
 pub static unwinder_private_data_size: uint = 5;
 
-#[cfg(target_arch = "mips")]
-#[cfg(target_arch = "mipsel")]
+#[cfg(any(target_arch = "mips", target_arch = "mipsel"))]
 pub static unwinder_private_data_size: uint = 2;
 
 #[repr(C)]
@@ -85,8 +83,7 @@ pub type _Unwind_Exception_Cleanup_Fn =
         extern "C" fn(unwind_code: _Unwind_Reason_Code,
                       exception: *mut _Unwind_Exception);
 
-#[cfg(target_os = "linux")]
-#[cfg(target_os = "freebsd")]
+#[cfg(any(target_os = "linux", target_os = "freebsd"))]
 #[link(name = "gcc_s")]
 extern {}
 
@@ -101,11 +98,11 @@ extern {}
 extern "C" {
     // iOS on armv7 uses SjLj exceptions and requires to link
     // against corresponding routine (..._SjLj_...)
-    #[cfg(not(target_os = "ios", target_arch = "arm"))]
+    #[cfg(not(all(target_os = "ios", target_arch = "arm")))]
     pub fn _Unwind_RaiseException(exception: *mut _Unwind_Exception)
                                   -> _Unwind_Reason_Code;
 
-    #[cfg(target_os = "ios", target_arch = "arm")]
+    #[cfg(all(target_os = "ios", target_arch = "arm"))]
     fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception)
                                    -> _Unwind_Reason_Code;
 
@@ -115,7 +112,7 @@ extern "C" {
 // ... and now we just providing access to SjLj counterspart
 // through a standard name to hide those details from others
 // (see also comment above regarding _Unwind_RaiseException)
-#[cfg(target_os = "ios", target_arch = "arm")]
+#[cfg(all(target_os = "ios", target_arch = "arm"))]
 #[inline(always)]
 pub unsafe fn _Unwind_RaiseException(exc: *mut _Unwind_Exception)
                                      -> _Unwind_Reason_Code {
diff --git a/src/librustrt/local_ptr.rs b/src/librustrt/local_ptr.rs
index 912e4ef4d40..58f8f8b310f 100644
--- a/src/librustrt/local_ptr.rs
+++ b/src/librustrt/local_ptr.rs
@@ -22,13 +22,13 @@ use core::prelude::*;
 use core::mem;
 use alloc::boxed::Box;
 
-#[cfg(windows)]               // mingw-w32 doesn't like thread_local things
-#[cfg(target_os = "android")] // see #10686
-#[cfg(target_os = "ios")]
+#[cfg(any(windows, // mingw-w32 doesn't like thread_local things
+          target_os = "android", // see #10686
+          target_os = "ios"))]
 pub use self::native::{init, cleanup, put, take, try_take, unsafe_take, exists,
                        unsafe_borrow, try_unsafe_borrow};
 
-#[cfg(not(windows), not(target_os = "android"), not(target_os = "ios"))]
+#[cfg(not(any(windows, target_os = "android", target_os = "ios")))]
 pub use self::compiled::{init, cleanup, put, take, try_take, unsafe_take, exists,
                          unsafe_borrow, try_unsafe_borrow};
 
@@ -82,7 +82,7 @@ pub unsafe fn borrow<T>() -> Borrowed<T> {
 /// implemented using LLVM's thread_local attribute which isn't necessarily
 /// working on all platforms. This implementation is faster, however, so we use
 /// it wherever possible.
-#[cfg(not(windows), not(target_os = "android"), not(target_os = "ios"))]
+#[cfg(not(any(windows, target_os = "android", target_os = "ios")))]
 pub mod compiled {
     use core::prelude::*;
 
diff --git a/src/librustrt/mutex.rs b/src/librustrt/mutex.rs
index f4fff43fd7c..86dc9b85a79 100644
--- a/src/librustrt/mutex.rs
+++ b/src/librustrt/mutex.rs
@@ -346,8 +346,7 @@ mod imp {
     type pthread_mutexattr_t = libc::c_void;
     type pthread_condattr_t = libc::c_void;
 
-    #[cfg(target_os = "freebsd")]
-    #[cfg(target_os = "dragonfly")]
+    #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
     mod os {
         use libc;
 
@@ -360,8 +359,7 @@ mod imp {
             0 as pthread_cond_t;
     }
 
-    #[cfg(target_os = "macos")]
-    #[cfg(target_os = "ios")]
+    #[cfg(any(target_os = "macos", target_os = "ios"))]
     mod os {
         use libc;
 
diff --git a/src/librustrt/stack.rs b/src/librustrt/stack.rs
index a4cbbf24811..5c94ef61bfd 100644
--- a/src/librustrt/stack.rs
+++ b/src/librustrt/stack.rs
@@ -156,13 +156,13 @@ pub unsafe fn record_rust_managed_stack_bounds(stack_lo: uint, stack_hi: uint) {
     #[cfg(not(windows))] #[inline(always)]
     unsafe fn target_record_stack_bounds(_stack_lo: uint, _stack_hi: uint) {}
 
-    #[cfg(windows, target_arch = "x86")] #[inline(always)]
+    #[cfg(all(windows, target_arch = "x86"))] #[inline(always)]
     unsafe fn target_record_stack_bounds(stack_lo: uint, stack_hi: uint) {
         // stack range is at TIB: %fs:0x04 (top) and %fs:0x08 (bottom)
         asm!("mov $0, %fs:0x04" :: "r"(stack_hi) :: "volatile");
         asm!("mov $0, %fs:0x08" :: "r"(stack_lo) :: "volatile");
     }
-    #[cfg(windows, target_arch = "x86_64")] #[inline(always)]
+    #[cfg(all(windows, target_arch = "x86_64"))] #[inline(always)]
     unsafe fn target_record_stack_bounds(stack_lo: uint, stack_hi: uint) {
         // stack range is at TIB: %gs:0x08 (top) and %gs:0x10 (bottom)
         asm!("mov $0, %gs:0x08" :: "r"(stack_hi) :: "volatile");
@@ -189,49 +189,53 @@ pub unsafe fn record_sp_limit(limit: uint) {
     return target_record_sp_limit(limit);
 
     // x86-64
-    #[cfg(target_arch = "x86_64", target_os = "macos")]
-    #[cfg(target_arch = "x86_64", target_os = "ios")] #[inline(always)]
+    #[cfg(all(target_arch = "x86_64",
+              any(target_os = "macos", target_os = "ios")))]
+    #[inline(always)]
     unsafe fn target_record_sp_limit(limit: uint) {
         asm!("movq $$0x60+90*8, %rsi
               movq $0, %gs:(%rsi)" :: "r"(limit) : "rsi" : "volatile")
     }
-    #[cfg(target_arch = "x86_64", target_os = "linux")] #[inline(always)]
+    #[cfg(all(target_arch = "x86_64", target_os = "linux"))] #[inline(always)]
     unsafe fn target_record_sp_limit(limit: uint) {
         asm!("movq $0, %fs:112" :: "r"(limit) :: "volatile")
     }
-    #[cfg(target_arch = "x86_64", target_os = "windows")] #[inline(always)]
+    #[cfg(all(target_arch = "x86_64", target_os = "windows"))] #[inline(always)]
     unsafe fn target_record_sp_limit(_: uint) {
     }
-    #[cfg(target_arch = "x86_64", target_os = "freebsd")] #[inline(always)]
+    #[cfg(all(target_arch = "x86_64", target_os = "freebsd"))] #[inline(always)]
     unsafe fn target_record_sp_limit(limit: uint) {
         asm!("movq $0, %fs:24" :: "r"(limit) :: "volatile")
     }
-    #[cfg(target_arch = "x86_64", target_os = "dragonfly")] #[inline(always)]
+    #[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))] #[inline(always)]
     unsafe fn target_record_sp_limit(limit: uint) {
         asm!("movq $0, %fs:32" :: "r"(limit) :: "volatile")
     }
 
     // x86
-    #[cfg(target_arch = "x86", target_os = "macos")]
-    #[cfg(target_arch = "x86", target_os = "ios")] #[inline(always)]
+    #[cfg(all(target_arch = "x86",
+              any(target_os = "macos", target_os = "ios")))]
+    #[inline(always)]
     unsafe fn target_record_sp_limit(limit: uint) {
         asm!("movl $$0x48+90*4, %eax
               movl $0, %gs:(%eax)" :: "r"(limit) : "eax" : "volatile")
     }
-    #[cfg(target_arch = "x86", target_os = "linux")]
-    #[cfg(target_arch = "x86", target_os = "freebsd")] #[inline(always)]
+    #[cfg(all(target_arch = "x86",
+              any(target_os = "linux", target_os = "freebsd")))]
+    #[inline(always)]
     unsafe fn target_record_sp_limit(limit: uint) {
         asm!("movl $0, %gs:48" :: "r"(limit) :: "volatile")
     }
-    #[cfg(target_arch = "x86", target_os = "windows")] #[inline(always)]
+    #[cfg(all(target_arch = "x86", target_os = "windows"))] #[inline(always)]
     unsafe fn target_record_sp_limit(_: uint) {
     }
 
     // mips, arm - Some brave soul can port these to inline asm, but it's over
     //             my head personally
-    #[cfg(target_arch = "mips")]
-    #[cfg(target_arch = "mipsel")]
-    #[cfg(target_arch = "arm", not(target_os = "ios"))] #[inline(always)]
+    #[cfg(any(target_arch = "mips",
+              target_arch = "mipsel",
+              all(target_arch = "arm", not(target_os = "ios"))))]
+    #[inline(always)]
     unsafe fn target_record_sp_limit(limit: uint) {
         use libc::c_void;
         return record_sp_limit(limit as *const c_void);
@@ -241,7 +245,7 @@ pub unsafe fn record_sp_limit(limit: uint) {
     }
 
     // iOS segmented stack is disabled for now, see related notes
-    #[cfg(target_arch = "arm", target_os = "ios")] #[inline(always)]
+    #[cfg(all(target_arch = "arm", target_os = "ios"))] #[inline(always)]
     unsafe fn target_record_sp_limit(_: uint) {
     }
 }
@@ -259,31 +263,32 @@ pub unsafe fn get_sp_limit() -> uint {
     return target_get_sp_limit();
 
     // x86-64
-    #[cfg(target_arch = "x86_64", target_os = "macos")]
-    #[cfg(target_arch = "x86_64", target_os = "ios")] #[inline(always)]
+    #[cfg(all(target_arch = "x86_64",
+              any(target_os = "macos", target_os = "ios")))]
+    #[inline(always)]
     unsafe fn target_get_sp_limit() -> uint {
         let limit;
         asm!("movq $$0x60+90*8, %rsi
               movq %gs:(%rsi), $0" : "=r"(limit) :: "rsi" : "volatile");
         return limit;
     }
-    #[cfg(target_arch = "x86_64", target_os = "linux")] #[inline(always)]
+    #[cfg(all(target_arch = "x86_64", target_os = "linux"))] #[inline(always)]
     unsafe fn target_get_sp_limit() -> uint {
         let limit;
         asm!("movq %fs:112, $0" : "=r"(limit) ::: "volatile");
         return limit;
     }
-    #[cfg(target_arch = "x86_64", target_os = "windows")] #[inline(always)]
+    #[cfg(all(target_arch = "x86_64", target_os = "windows"))] #[inline(always)]
     unsafe fn target_get_sp_limit() -> uint {
         return 1024;
     }
-    #[cfg(target_arch = "x86_64", target_os = "freebsd")] #[inline(always)]
+    #[cfg(all(target_arch = "x86_64", target_os = "freebsd"))] #[inline(always)]
     unsafe fn target_get_sp_limit() -> uint {
         let limit;
         asm!("movq %fs:24, $0" : "=r"(limit) ::: "volatile");
         return limit;
     }
-    #[cfg(target_arch = "x86_64", target_os = "dragonfly")] #[inline(always)]
+    #[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))] #[inline(always)]
     unsafe fn target_get_sp_limit() -> uint {
         let limit;
         asm!("movq %fs:32, $0" : "=r"(limit) ::: "volatile");
@@ -292,31 +297,34 @@ pub unsafe fn get_sp_limit() -> uint {
 
 
     // x86
-    #[cfg(target_arch = "x86", target_os = "macos")]
-    #[cfg(target_arch = "x86", target_os = "ios")] #[inline(always)]
+    #[cfg(all(target_arch = "x86",
+              any(target_os = "macos", target_os = "ios")))]
+    #[inline(always)]
     unsafe fn target_get_sp_limit() -> uint {
         let limit;
         asm!("movl $$0x48+90*4, %eax
               movl %gs:(%eax), $0" : "=r"(limit) :: "eax" : "volatile");
         return limit;
     }
-    #[cfg(target_arch = "x86", target_os = "linux")]
-    #[cfg(target_arch = "x86", target_os = "freebsd")] #[inline(always)]
+    #[cfg(all(target_arch = "x86",
+              any(target_os = "linux", target_os = "freebsd")))]
+    #[inline(always)]
     unsafe fn target_get_sp_limit() -> uint {
         let limit;
         asm!("movl %gs:48, $0" : "=r"(limit) ::: "volatile");
         return limit;
     }
-    #[cfg(target_arch = "x86", target_os = "windows")] #[inline(always)]
+    #[cfg(all(target_arch = "x86", target_os = "windows"))] #[inline(always)]
     unsafe fn target_get_sp_limit() -> uint {
         return 1024;
     }
 
     // mips, arm - Some brave soul can port these to inline asm, but it's over
     //             my head personally
-    #[cfg(target_arch = "mips")]
-    #[cfg(target_arch = "mipsel")]
-    #[cfg(target_arch = "arm", not(target_os = "ios"))] #[inline(always)]
+    #[cfg(any(target_arch = "mips",
+              target_arch = "mipsel",
+              all(target_arch = "arm", not(target_os = "ios"))))]
+    #[inline(always)]
     unsafe fn target_get_sp_limit() -> uint {
         use libc::c_void;
         return get_sp_limit() as uint;
@@ -328,7 +336,7 @@ pub unsafe fn get_sp_limit() -> uint {
     // iOS doesn't support segmented stacks yet. This function might
     // be called by runtime though so it is unsafe to mark it as
     // unreachable, let's return a fixed constant.
-    #[cfg(target_arch = "arm", target_os = "ios")] #[inline(always)]
+    #[cfg(all(target_arch = "arm", target_os = "ios"))] #[inline(always)]
     unsafe fn target_get_sp_limit() -> uint {
         1024
     }
diff --git a/src/librustrt/thread_local_storage.rs b/src/librustrt/thread_local_storage.rs
index 6078ed990e4..aee70980bba 100644
--- a/src/librustrt/thread_local_storage.rs
+++ b/src/librustrt/thread_local_storage.rs
@@ -41,11 +41,11 @@ pub unsafe fn destroy(key: Key) {
 #[allow(non_camel_case_types)] // foreign type
 type pthread_key_t = ::libc::c_ulong;
 
-#[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"))]
 #[allow(non_camel_case_types)] // foreign type
 type pthread_key_t = ::libc::c_uint;
 
diff --git a/src/librustrt/unwind.rs b/src/librustrt/unwind.rs
index d3ab0f27c13..1561f428ce5 100644
--- a/src/librustrt/unwind.rs
+++ b/src/librustrt/unwind.rs
@@ -235,7 +235,9 @@ fn rust_exception_class() -> uw::_Unwind_Exception_Class {
 //
 // See also: rt/rust_try.ll
 
-#[cfg(not(target_arch = "arm"), not(windows, target_arch = "x86_64"), not(test))]
+#[cfg(all(not(target_arch = "arm"),
+          not(all(windows, target_arch = "x86_64")),
+          not(test)))]
 #[doc(hidden)]
 pub mod eabi {
     use libunwind as uw;
@@ -288,7 +290,7 @@ pub mod eabi {
 // iOS on armv7 is using SjLj exceptions and therefore requires to use
 // a specialized personality routine: __gcc_personality_sj0
 
-#[cfg(target_os = "ios", target_arch = "arm", not(test))]
+#[cfg(all(target_os = "ios", target_arch = "arm", not(test)))]
 #[doc(hidden)]
 pub mod eabi {
     use libunwind as uw;
@@ -343,7 +345,7 @@ pub mod eabi {
 
 // ARM EHABI uses a slightly different personality routine signature,
 // but otherwise works the same.
-#[cfg(target_arch = "arm", not(target_os = "ios"), not(test))]
+#[cfg(all(target_arch = "arm", not(target_os = "ios"), not(test)))]
 #[doc(hidden)]
 pub mod eabi {
     use libunwind as uw;
@@ -392,7 +394,7 @@ pub mod eabi {
 // GCC reuses the same personality routine as for the other architectures by wrapping it
 // with an "API translator" layer (_GCC_specific_handler).
 
-#[cfg(windows, target_arch = "x86_64", not(test))]
+#[cfg(all(windows, target_arch = "x86_64", not(test)))]
 #[doc(hidden)]
 #[allow(non_camel_case_types, non_snake_case)]
 pub mod eabi {