]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/intrinsic-alignment.rs
auto merge of #15999 : Kimundi/rust/fix_folder, r=nikomatsakis
[rust.git] / src / test / run-pass / intrinsic-alignment.rs
1 // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 #![feature(intrinsics)]
12
13 mod rusti {
14     extern "rust-intrinsic" {
15         pub fn pref_align_of<T>() -> uint;
16         pub fn min_align_of<T>() -> uint;
17     }
18 }
19
20 #[cfg(target_os = "linux")]
21 #[cfg(target_os = "macos")]
22 #[cfg(target_os = "freebsd")]
23 #[cfg(target_os = "dragonfly")]
24 mod m {
25     #[main]
26     #[cfg(target_arch = "x86")]
27     pub fn main() {
28         unsafe {
29             assert_eq!(::rusti::pref_align_of::<u64>(), 8u);
30             assert_eq!(::rusti::min_align_of::<u64>(), 4u);
31         }
32     }
33
34     #[main]
35     #[cfg(target_arch = "x86_64")]
36     pub fn main() {
37         unsafe {
38             assert_eq!(::rusti::pref_align_of::<u64>(), 8u);
39             assert_eq!(::rusti::min_align_of::<u64>(), 8u);
40         }
41     }
42 }
43
44 #[cfg(target_os = "win32")]
45 mod m {
46     #[main]
47     #[cfg(target_arch = "x86")]
48     pub fn main() {
49         unsafe {
50             assert_eq!(::rusti::pref_align_of::<u64>(), 8u);
51             assert_eq!(::rusti::min_align_of::<u64>(), 8u);
52         }
53     }
54 }
55
56 #[cfg(target_os = "android")]
57 mod m {
58     #[main]
59     #[cfg(target_arch = "arm")]
60     pub fn main() {
61         unsafe {
62             assert_eq!(::rusti::pref_align_of::<u64>(), 8u);
63             assert_eq!(::rusti::min_align_of::<u64>(), 8u);
64         }
65     }
66 }