From 48a8eda74aad8a21b6f26df5df08fe64c043d208 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Mon, 24 Mar 2014 21:21:12 -0700 Subject: [PATCH 1/2] Avoid referencing undefined ABIs on 64-bit Windows builds 64-bit Windows does not have FFI_STDCALL, FFI_THISCALL, or FFI_FASTCALL. --- src/x86/ffi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/x86/ffi.c b/src/x86/ffi.c index a02a8a19..e1f24471 100644 --- a/src/x86/ffi.c +++ b/src/x86/ffi.c @@ -318,7 +318,9 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) #endif #ifndef X86_WIN32 +#ifndef X86_WIN64 if (cif->abi != FFI_STDCALL && cif->abi != FFI_THISCALL && cif->abi != FFI_FASTCALL) +#endif cif->bytes = (cif->bytes + 15) & ~0xF; #endif From 56be47f87629e31afbcb0774aa65735f539ee972 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Mon, 24 Mar 2014 21:24:53 -0700 Subject: [PATCH 2/2] Fix a warning on 64-bit Windows When sizeof(size_t) != sizeof(unsigned), adding a size_t to cif->bytes produces a "possible loss of data" warning. However, the size_t in question refers to the size of a single parameter. Use a cast to avoid the warning. --- src/x86/ffi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/x86/ffi.c b/src/x86/ffi.c index e1f24471..79407ae2 100644 --- a/src/x86/ffi.c +++ b/src/x86/ffi.c @@ -309,7 +309,7 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { if (((*ptr)->alignment - 1) & cif->bytes) cif->bytes = ALIGN(cif->bytes, (*ptr)->alignment); - cif->bytes += ALIGN((*ptr)->size, FFI_SIZEOF_ARG); + cif->bytes += (unsigned)ALIGN((*ptr)->size, FFI_SIZEOF_ARG); } #ifdef X86_WIN64