diff options
author | Anthony Green <green@moxielogic.com> | 2018-03-29 07:01:14 -0400 |
---|---|---|
committer | Anthony Green <green@moxielogic.com> | 2018-03-29 07:01:14 -0400 |
commit | 746c3ce220cb155a8f3b613550a7ecad76f9fedc (patch) | |
tree | 4fc788109c18ed0f817c2e77ee9b3042dab9dd51 /testsuite/libffi.call | |
parent | 2eee934d0cb2beef7c0aa29767eca1ce03452ae9 (diff) | |
download | libffi-746c3ce220cb155a8f3b613550a7ecad76f9fedc.tar.gz |
Expand ABI tests on x86. Testsuite bug fixes.
Diffstat (limited to 'testsuite/libffi.call')
-rw-r--r-- | testsuite/libffi.call/align_stdcall.c | 46 | ||||
-rw-r--r-- | testsuite/libffi.call/ffitest.h | 2 |
2 files changed, 47 insertions, 1 deletions
diff --git a/testsuite/libffi.call/align_stdcall.c b/testsuite/libffi.call/align_stdcall.c new file mode 100644 index 0000000..5e5cb86 --- /dev/null +++ b/testsuite/libffi.call/align_stdcall.c @@ -0,0 +1,46 @@ +/* Area: ffi_call + Purpose: Check for proper argument alignment. + Limitations: none. + PR: none. + Originator: <twalljava@java.net> (from many_win32.c) */ + +/* { dg-do run } */ + +#include "ffitest.h" + +static float ABI_ATTR align_arguments(int i1, + double f2, + int i3, + double f4) +{ + return i1+f2+i3+f4; +} + +int main(void) +{ + ffi_cif cif; + ffi_type *args[4] = { + &ffi_type_sint, + &ffi_type_double, + &ffi_type_sint, + &ffi_type_double + }; + double fa[2] = {1,2}; + int ia[2] = {1,2}; + void *values[4] = {&ia[0], &fa[0], &ia[1], &fa[1]}; + float f, ff; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, ABI_NUM, 4, + &ffi_type_float, args) == FFI_OK); + + ff = align_arguments(ia[0], fa[0], ia[1], fa[1]);; + + ffi_call(&cif, FFI_FN(align_arguments), &f, values); + + if (f == ff) + printf("align arguments tests ok!\n"); + else + CHECK(0); + exit(0); +} diff --git a/testsuite/libffi.call/ffitest.h b/testsuite/libffi.call/ffitest.h index 203d948..cfce1ad 100644 --- a/testsuite/libffi.call/ffitest.h +++ b/testsuite/libffi.call/ffitest.h @@ -64,7 +64,7 @@ #endif /* MinGW kludge. */ -#ifdef _WIN64 +#if defined(_WIN64) | defined(_WIN32) #define PRIdLL "I64d" #define PRIuLL "I64u" #else |