Skip to content

Commit

Permalink
Add test cases for x86 Windows calling conventions.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwoerister committed May 13, 2019
1 parent d466754 commit 51ef923
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/expectations/tests/mangling-win32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
11 changes: 11 additions & 0 deletions tests/headers/mangling-win32.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 51ef923

Please sign in to comment.