]> git.lizzy.rs Git - rust.git/commitdiff
Simplify some uses of cfg in test cases
authorAnton Blanchard <anton@samba.org>
Wed, 13 Jan 2016 00:55:51 +0000 (00:55 +0000)
committerAnton Blanchard <anton@samba.org>
Wed, 13 Jan 2016 01:39:01 +0000 (01:39 +0000)
While adding PowerPC64 support it was noticed that some testcases should
just use target_pointer_width, and others should select between
x86 and !x86.

src/test/auxiliary/extern_calling_convention.rs
src/test/run-pass/bitwise.rs
src/test/run-pass/intrinsic-alignment.rs
src/test/run-pass/issue-2895.rs
src/test/run-pass/rec-align-u32.rs
src/test/run-pass/rec-align-u64.rs
src/test/run-pass/struct-return.rs

index c11c054317d346cab8a13b14c488515a7a5493f4..55a4226c6632da8685dd5c58fd556c6469e79834 100644 (file)
@@ -24,8 +24,7 @@ pub extern "win64" fn foo(a: isize, b: isize, c: isize, d: isize) {
 }
 
 #[inline(never)]
-#[cfg(any(target_arch = "x86", target_arch = "arm", target_arch = "aarch64",
-          target_arch = "powerpc64", target_arch = "powerpc64le"))]
+#[cfg(not(target_arch = "x86_64"))]
 pub extern fn foo(a: isize, b: isize, c: isize, d: isize) {
     assert_eq!(a, 1);
     assert_eq!(b, 2);
index 6cb99edf3708eabc8156a1d3d97a124cbb2e56ca..bb4b9cfecf7b62b609742d245f0a3d16d66dd854 100644 (file)
@@ -8,13 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[cfg(any(target_arch = "x86", target_arch = "arm"))]
+#[cfg(any(target_pointer_width = "32"))]
 fn target() {
     assert_eq!(-1000isize as usize >> 3_usize, 536870787_usize);
 }
 
-#[cfg(any(target_arch = "x86_64", target_arch = "aarch64",
-          target_arch = "powerpc64", target_arch = "powerpc64le"))]
+#[cfg(any(target_pointer_width = "64"))]
 fn target() {
     assert_eq!(-1000isize as usize >> 3_usize, 2305843009213693827_usize);
 }
index 2f105ec84f1e7cab20854bb841550724a3ecba37..a4720d48213ce43f527d0a369631d4d0b11d217a 100644 (file)
@@ -35,9 +35,7 @@ pub fn main() {
     }
 
     #[main]
-    #[cfg(any(target_arch = "x86_64", target_arch = "arm",
-              target_arch = "aarch64", target_arch = "powerpc64",
-              target_arch = "powerpc64le"))]
+    #[cfg(not(target_arch = "x86"))]
     pub fn main() {
         unsafe {
             assert_eq!(::rusti::pref_align_of::<u64>(), 8);
index ae62109fe23ae18cd3e3264614c3e3bdf0dfd41c..5587f68bd18544465c2aa5c8fb8dd7929ed233f4 100644 (file)
@@ -23,14 +23,13 @@ impl Drop for Kitty {
     fn drop(&mut self) {}
 }
 
-#[cfg(any(target_arch = "x86_64", target_arch="aarch64",
-          target_arch="powerpc64", target_arch="powerpc64le"))]
+#[cfg(target_pointer_width = "64")]
 pub fn main() {
     assert_eq!(mem::size_of::<Cat>(), 8 as usize);
     assert_eq!(mem::size_of::<Kitty>(), 16 as usize);
 }
 
-#[cfg(any(target_arch = "x86", target_arch = "arm"))]
+#[cfg(target_pointer_width = "32")]
 pub fn main() {
     assert_eq!(mem::size_of::<Cat>(), 4 as usize);
     assert_eq!(mem::size_of::<Kitty>(), 8 as usize);
index 7e3a05bbf847778ca4dbd5dcf363c9e15572fdd2..4a115c737da3a5752e82873a5c473475551dc274 100644 (file)
@@ -35,15 +35,6 @@ struct Outer {
     t: Inner
 }
 
-
-#[cfg(any(target_arch = "x86", target_arch = "arm", target_arch = "aarch64",
-          target_arch = "powerpc64", target_arch = "powerpc64le"))]
-mod m {
-    pub fn align() -> usize { 4 }
-    pub fn size() -> usize { 8 }
-}
-
-#[cfg(target_arch = "x86_64")]
 mod m {
     pub fn align() -> usize { 4 }
     pub fn size() -> usize { 8 }
index e12d04adabff8eccd425c4dd35d69889c073a248..25cd77845ea03bf9ef8389ce4265614b549ecad6 100644 (file)
@@ -49,9 +49,7 @@ pub fn align() -> usize { 4 }
         pub fn size() -> usize { 12 }
     }
 
-    #[cfg(any(target_arch = "x86_64", target_arch = "arm",
-              target_arch = "aarch64", target_arch = "powerpc64",
-              target_arch = "powerpc64le"))]
+    #[cfg(not(target_arch = "x86"))]
     pub mod m {
         pub fn align() -> usize { 8 }
         pub fn size() -> usize { 16 }
index 55474a69cb7587cec9f951cd4f2da0c52a19f030..6f23263790cb777ff0c0f8e4c56122f85598a467 100644 (file)
@@ -43,8 +43,7 @@ fn test1() {
     }
 }
 
-#[cfg(any(target_arch = "x86_64", target_arch = "aarch64",
-          target_arch = "powerpc64", target_arch = "powerpc64le"))]
+#[cfg(target_pointer_width = "64")]
 fn test2() {
     unsafe {
         let f = Floats { a: 1.234567890e-15_f64,
@@ -60,7 +59,7 @@ fn test2() {
     }
 }
 
-#[cfg(any(target_arch = "x86", target_arch = "arm"))]
+#[cfg(target_pointer_width = "32")]
 fn test2() {
 }