diff options
Diffstat (limited to 'tests/ui/extern/auxiliary/extern_calling_convention.rs')
-rw-r--r-- | tests/ui/extern/auxiliary/extern_calling_convention.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/ui/extern/auxiliary/extern_calling_convention.rs b/tests/ui/extern/auxiliary/extern_calling_convention.rs new file mode 100644 index 000000000..e24cf9fda --- /dev/null +++ b/tests/ui/extern/auxiliary/extern_calling_convention.rs @@ -0,0 +1,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) +} |