From 51ef92352afb543d4e66a7f95cb3a64f7b767ab7 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Mon, 13 May 2019 12:35:03 +0200 Subject: [PATCH] Add test cases for x86 Windows calling conventions. --- tests/expectations/tests/mangling-win32.rs | 20 ++++++++++++++++++++ tests/headers/mangling-win32.hpp | 11 +++++++++++ 2 files changed, 31 insertions(+) diff --git a/tests/expectations/tests/mangling-win32.rs b/tests/expectations/tests/mangling-win32.rs index 0d9c49faf7..ad4ac42a15 100644 --- a/tests/expectations/tests/mangling-win32.rs +++ b/tests/expectations/tests/mangling-win32.rs @@ -29,3 +29,23 @@ fn bindgen_test_layout_Foo() { concat!("Alignment of ", stringify!(Foo)) ); } +extern "fastcall" { + pub fn fast_call_func_no_args() -> ::std::os::raw::c_int; +} +extern "fastcall" { + pub fn fast_call_func_many_args( + arg1: ::std::os::raw::c_int, + arg2: ::std::os::raw::c_int, + arg3: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "stdcall" { + pub fn std_call_func_no_args() -> ::std::os::raw::c_int; +} +extern "stdcall" { + pub fn std_call_func_many_args( + arg1: ::std::os::raw::c_int, + arg2: ::std::os::raw::c_int, + arg3: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} diff --git a/tests/headers/mangling-win32.hpp b/tests/headers/mangling-win32.hpp index 50beea5aec..386df4aba3 100644 --- a/tests/headers/mangling-win32.hpp +++ b/tests/headers/mangling-win32.hpp @@ -5,3 +5,14 @@ extern "C" void foo(); struct Foo { static bool sBar; }; + +// Also test some x86 Windows specific calling conventions that have their own +// special mangling +extern "C" { + int _fastcall fast_call_func_no_args(); + // This will result in a suffix with more than one character (i.e. `@12`) + int _fastcall fast_call_func_many_args(int,int,int); + int _stdcall std_call_func_no_args(); + // This will result in a suffix with more than one character (i.e. `@12`) + int _stdcall std_call_func_many_args(int,int,int); +}