summaryrefslogtreecommitdiffstats
path: root/src/test/ui/extern/auxiliary/extern_calling_convention.rs
blob: e24cf9fdaa0c54b95ce213228e09da7a4ec39ad0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Make sure Rust generates the correct calling convention for extern
// functions.

#[inline(never)]
#[cfg(target_arch = "x86_64")]
pub extern "win64" fn foo(a: isize, b: isize, c: isize, d: isize) {
    assert_eq!(a, 1);
    assert_eq!(b, 2);
    assert_eq!(c, 3);
    assert_eq!(d, 4);

    println!("a: {}, b: {}, c: {}, d: {}",
             a, b, c, d)
}

#[inline(never)]
#[cfg(not(target_arch = "x86_64"))]
pub extern "C" fn foo(a: isize, b: isize, c: isize, d: isize) {
    assert_eq!(a, 1);
    assert_eq!(b, 2);
    assert_eq!(c, 3);
    assert_eq!(d, 4);

    println!("a: {}, b: {}, c: {}, d: {}",
             a, b, c, d)
}