mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-10 14:57:14 +00:00
Revert "rt: Fix some record alignment issues on windows"
This reverts commit a2457f5864
.
This commit is contained in:
parent
a2457f5864
commit
e2910bf264
@ -127,7 +127,6 @@ rust_alignof<double>() {
|
||||
// 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<uint64_t>() {
|
||||
return 4;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// Utility classes
|
||||
|
@ -1,31 +1,19 @@
|
||||
// xfail-win32 need to investigate alignment on windows
|
||||
|
||||
#[abi = "rust-intrinsic"]
|
||||
native mod rusti {
|
||||
fn pref_align_of<T>() -> uint;
|
||||
fn min_align_of<T>() -> 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::<u64>() == 8u;
|
||||
assert rusti::min_align_of::<u64>() == 4u;
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
fn main() {
|
||||
assert rusti::pref_align_of::<u64>() == 8u;
|
||||
assert rusti::min_align_of::<u64>() == 8u;
|
||||
}
|
||||
#[cfg(target_arch = "x86")]
|
||||
fn main() {
|
||||
assert rusti::pref_align_of::<u64>() == 8u;
|
||||
assert rusti::min_align_of::<u64>() == 4u;
|
||||
}
|
||||
|
||||
#[cfg(target_os = "win32")]
|
||||
mod m {
|
||||
#[cfg(target_arch = "x86")]
|
||||
fn main() {
|
||||
assert rusti::pref_align_of::<u64>() == 8u;
|
||||
assert rusti::min_align_of::<u64>() == 8u;
|
||||
}
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
fn main() {
|
||||
assert rusti::pref_align_of::<u64>() == 8u;
|
||||
assert rusti::min_align_of::<u64>() == 8u;
|
||||
}
|
||||
|
@ -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::<inner>() == m::align();
|
||||
assert rusti::min_align_of::<inner>() == 4u;
|
||||
|
||||
// per clang/gcc the size of `outer` should be 12
|
||||
// because `inner`s alignment was 4.
|
||||
assert sys::size_of::<outer>() == m::size();
|
||||
assert sys::size_of::<outer>() == 12u;
|
||||
|
||||
assert y == "(22, (44))";
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
fn main() { }
|
@ -1,68 +0,0 @@
|
||||
// xfail-pretty
|
||||
// Issue #2303
|
||||
|
||||
#[abi = "rust-intrinsic"]
|
||||
native mod rusti {
|
||||
fn pref_align_of<T>() -> uint;
|
||||
fn min_align_of<T>() -> 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::<inner>());
|
||||
#debug("size outer = %?", sys::size_of::<outer>());
|
||||
#debug("y = %s", y);
|
||||
|
||||
// per clang/gcc the alignment of `inner` is 4 on x86.
|
||||
assert rusti::min_align_of::<inner>() == m::m::align();
|
||||
|
||||
// per clang/gcc the size of `outer` should be 12
|
||||
// because `inner`s alignment was 4.
|
||||
assert sys::size_of::<outer>() == m::m::size();
|
||||
|
||||
assert y == "(22, (44))";
|
||||
}
|
Loading…
Reference in New Issue
Block a user