Simplify some uses of cfg in test cases
While adding PowerPC64 support it was noticed that some testcases should just use target_pointer_width, and others should select between x86 and !x86.
This commit is contained in:
parent
7ff64b20f9
commit
12aec073a8
7 changed files with 9 additions and 26 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -35,9 +35,7 @@ mod m {
|
|||
}
|
||||
|
||||
#[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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -49,9 +49,7 @@ mod m {
|
|||
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 }
|
||||
|
|
|
@ -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() {
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue