diff --git a/src/rt/rust_shape.h b/src/rt/rust_shape.h index ee9b6400cd4..3aaea6f739c 100644 --- a/src/rt/rust_shape.h +++ b/src/rt/rust_shape.h @@ -127,7 +127,6 @@ rust_alignof() { // On 32-bit x86 the alignment of 64-bit ints in structures is 4 bytes // Which is different from the preferred 8-byte alignment reported // by __alignof__ (at least on gcc). -#ifndef __WIN32__ #ifdef __i386__ template<> inline size_t @@ -135,7 +134,6 @@ rust_alignof() { return 4; } #endif -#endif // Utility classes diff --git a/src/test/run-pass/intrinsic-alignment.rs b/src/test/run-pass/intrinsic-alignment.rs index 5bcb31cc930..7841cda4522 100644 --- a/src/test/run-pass/intrinsic-alignment.rs +++ b/src/test/run-pass/intrinsic-alignment.rs @@ -1,31 +1,19 @@ +// xfail-win32 need to investigate alignment on windows + #[abi = "rust-intrinsic"] native mod rusti { fn pref_align_of() -> uint; fn min_align_of() -> uint; } -#[cfg(target_os = "linux")] -#[cfg(target_os = "macos")] -#[cfg(target_os = "freebsd")] -mod m { - #[cfg(target_arch = "x86")] - fn main() { - assert rusti::pref_align_of::() == 8u; - assert rusti::min_align_of::() == 4u; - } - - #[cfg(target_arch = "x86_64")] - fn main() { - assert rusti::pref_align_of::() == 8u; - assert rusti::min_align_of::() == 8u; - } +#[cfg(target_arch = "x86")] +fn main() { + assert rusti::pref_align_of::() == 8u; + assert rusti::min_align_of::() == 4u; } -#[cfg(target_os = "win32")] -mod m { - #[cfg(target_arch = "x86")] - fn main() { - assert rusti::pref_align_of::() == 8u; - assert rusti::min_align_of::() == 8u; - } +#[cfg(target_arch = "x86_64")] +fn main() { + assert rusti::pref_align_of::() == 8u; + assert rusti::min_align_of::() == 8u; } diff --git a/src/test/run-pass/rec-align-u32.rs b/src/test/run-pass/rec-align-32-bit.rs similarity index 73% rename from src/test/run-pass/rec-align-u32.rs rename to src/test/run-pass/rec-align-32-bit.rs index 89f3305bf79..28e0268b6a5 100644 --- a/src/test/run-pass/rec-align-u32.rs +++ b/src/test/run-pass/rec-align-32-bit.rs @@ -1,4 +1,5 @@ // xfail-pretty +// xfail-win32 // Issue #2303 #[abi = "rust-intrinsic"] @@ -9,7 +10,7 @@ native mod rusti { // This is the type with the questionable alignment type inner = { - c64: u32 + c64: u64 }; // This is the type that contains the type with the @@ -19,22 +20,10 @@ type outer = { t: inner }; - #[cfg(target_arch = "x86")] -mod m { - fn align() -> uint { 4u } - fn size() -> uint { 8u } -} - -#[cfg(target_arch = "x86_64")] -mod m { - fn align() -> uint { 4u } - fn size() -> uint { 8u } -} - fn main() { - let x = {c8: 22u8, t: {c64: 44u32}}; + let x = {c8: 22u8, t: {c64: 44u64}}; // Send it through the shape code let y = #fmt["%?", x]; @@ -44,11 +33,14 @@ fn main() { #debug("y = %s", y); // per clang/gcc the alignment of `inner` is 4 on x86. - assert rusti::min_align_of::() == m::align(); + assert rusti::min_align_of::() == 4u; // per clang/gcc the size of `outer` should be 12 // because `inner`s alignment was 4. - assert sys::size_of::() == m::size(); + assert sys::size_of::() == 12u; assert y == "(22, (44))"; } + +#[cfg(target_arch = "x86_64")] +fn main() { } diff --git a/src/test/run-pass/rec-align-u64.rs b/src/test/run-pass/rec-align-u64.rs deleted file mode 100644 index 39646bb04e0..00000000000 --- a/src/test/run-pass/rec-align-u64.rs +++ /dev/null @@ -1,68 +0,0 @@ -// xfail-pretty -// Issue #2303 - -#[abi = "rust-intrinsic"] -native mod rusti { - fn pref_align_of() -> uint; - fn min_align_of() -> uint; -} - -// This is the type with the questionable alignment -type inner = { - c64: u64 -}; - -// This is the type that contains the type with the -// questionable alignment, for testing -type outer = { - c8: u8, - t: inner -}; - - -#[cfg(target_os = "linux")] -#[cfg(target_os = "macos")] -#[cfg(target_os = "freebsd")] -mod m { - #[cfg(target_arch = "x86")] - mod m { - fn align() -> uint { 4u } - fn size() -> uint { 12u } - } - - #[cfg(target_arch = "x86_64")] - mod m { - fn align() -> uint { 8u } - fn size() -> uint { 16u } - } -} - -#[cfg(target_os = "win32")] -mod m { - #[cfg(target_arch = "x86")] - mod m { - fn align() -> uint { 8u } - fn size() -> uint { 16u } - } -} - -fn main() { - - let x = {c8: 22u8, t: {c64: 44u64}}; - - // Send it through the shape code - let y = #fmt["%?", x]; - - #debug("align inner = %?", rusti::min_align_of::()); - #debug("size outer = %?", sys::size_of::()); - #debug("y = %s", y); - - // per clang/gcc the alignment of `inner` is 4 on x86. - assert rusti::min_align_of::() == m::m::align(); - - // per clang/gcc the size of `outer` should be 12 - // because `inner`s alignment was 4. - assert sys::size_of::() == m::m::size(); - - assert y == "(22, (44))"; -}