about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-03-14 18:26:30 -0700
committerbors <bors@rust-lang.org>2014-03-14 18:26:30 -0700
commit58fb492f9c827ee824de8f3767ff102cafb1ca88 (patch)
treedf00c4ee0fd3d5b0c6982c47f79f475cb26ca128
parent76e0e26603d723038dae1ad06161cade47e53a55 (diff)
parent8e5ca4b793e928b5a7545f6d1010b7663a9d30ae (diff)
downloadrust-58fb492f9c827ee824de8f3767ff102cafb1ca88.tar.gz
rust-58fb492f9c827ee824de8f3767ff102cafb1ca88.zip
auto merge of #12893 : alexcrichton/rust/cfg-not, r=luqmana
The two commits have the details of the two fixes
-rw-r--r--src/libstd/rt/libunwind.rs15
-rw-r--r--src/libsyntax/attr.rs4
-rw-r--r--src/test/run-pass/cfgs-on-items.rs10
3 files changed, 24 insertions, 5 deletions
diff --git a/src/libstd/rt/libunwind.rs b/src/libstd/rt/libunwind.rs
index 8c14e6c81e9..ac34277dcbd 100644
--- a/src/libstd/rt/libunwind.rs
+++ b/src/libstd/rt/libunwind.rs
@@ -101,9 +101,18 @@ extern "C" {
     pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn,
                              trace_argument: *libc::c_void)
                 -> _Unwind_Reason_Code;
-    #[cfg(not(target_os = "android"))]
+    #[cfg(stage0, not(target_os = "android"))]
     pub fn _Unwind_GetIP(ctx: *_Unwind_Context) -> libc::uintptr_t;
-    #[cfg(not(target_os = "android"))]
+    #[cfg(stage0, not(target_os = "android"))]
+    pub fn _Unwind_FindEnclosingFunction(pc: *libc::c_void) -> *libc::c_void;
+
+    #[cfg(not(stage0),
+          not(target_os = "android"),
+          not(target_os = "linux", target_arch = "arm"))]
+    pub fn _Unwind_GetIP(ctx: *_Unwind_Context) -> libc::uintptr_t;
+    #[cfg(not(stage0),
+          not(target_os = "android"),
+          not(target_os = "linux", target_arch = "arm"))]
     pub fn _Unwind_FindEnclosingFunction(pc: *libc::c_void) -> *libc::c_void;
 }
 
@@ -111,6 +120,7 @@ extern "C" {
 // 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_os = "arm")]
 pub unsafe fn _Unwind_GetIP(ctx: *_Unwind_Context) -> libc::uintptr_t {
     #[repr(C)]
     enum _Unwind_VRS_Result {
@@ -154,6 +164,7 @@ pub unsafe fn _Unwind_GetIP(ctx: *_Unwind_Context) -> libc::uintptr_t {
 
 // This function also doesn't exist on android, so make it a no-op
 #[cfg(target_os = "android")]
+#[cfg(target_os = "linux", target_os = "arm")]
 pub unsafe fn _Unwind_FindEnclosingFunction(pc: *libc::c_void) -> *libc::c_void{
     pc
 }
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index ed56ef15a1c..7ff9a73f29d 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -317,9 +317,9 @@ pub fn test_cfg<AM: AttrMetaMethods, It: Iterator<AM>>
                                 debug!("not!");
                                 // inside #[cfg(not(...))], so these need to all
                                 // not match.
-                                not_cfgs.iter().all(|mi| {
+                                !not_cfgs.iter().all(|mi| {
                                     debug!("cfg(not({}[...]))", mi.name());
-                                    !contains(cfg, *mi)
+                                    contains(cfg, *mi)
                                 })
                             }
                             _ => contains(cfg, *cfg_mi)
diff --git a/src/test/run-pass/cfgs-on-items.rs b/src/test/run-pass/cfgs-on-items.rs
index 72d12b56c5c..f1c91dbaf35 100644
--- a/src/test/run-pass/cfgs-on-items.rs
+++ b/src/test/run-pass/cfgs-on-items.rs
@@ -16,7 +16,7 @@
 fn foo1() -> int { 1 }
 
 // !fooA AND !bar
-#[cfg(not(fooA, bar))]
+#[cfg(not(fooA), not(bar))]
 fn foo2() -> int { 2 }
 
 // fooC OR (fooB AND !bar)
@@ -24,8 +24,16 @@ fn foo2() -> int { 2 }
 #[cfg(fooB, not(bar))]
 fn foo2() -> int { 3 }
 
+// fooA AND bar
+#[cfg(fooA, bar)]
+fn foo3() -> int { 2 }
+
+// !(fooA AND bar)
+#[cfg(not(fooA, bar))]
+fn foo3() -> int { 3 }
 
 pub fn main() {
     assert_eq!(1, foo1());
     assert_eq!(3, foo2());
+    assert_eq!(3, foo3());
 }