summaryrefslogtreecommitdiff
path: root/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h
diff options
context:
space:
mode:
Diffstat (limited to 'ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h')
-rw-r--r--ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h62
1 files changed, 22 insertions, 40 deletions
diff --git a/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h b/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h
index 0e95e16..15d5e44 100644
--- a/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h
+++ b/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h
@@ -15,14 +15,25 @@
#define MAX_ARGS 256
-#define CHECK(x) !(x) ? abort() : 0
+#define CHECK(x) (void)(!(x) ? (abort(), 1) : 0)
-/* Define __UNUSED__ that also other compilers than gcc can run the tests. */
+/* Define macros so that compilers other than gcc can run the tests. */
#undef __UNUSED__
#if defined(__GNUC__)
#define __UNUSED__ __attribute__((__unused__))
+#define __STDCALL__ __attribute__((stdcall))
+#define __THISCALL__ __attribute__((thiscall))
+#define __FASTCALL__ __attribute__((fastcall))
#else
#define __UNUSED__
+#define __STDCALL__ __stdcall
+#define __THISCALL__ __thiscall
+#define __FASTCALL__ __fastcall
+#endif
+
+#ifndef ABI_NUM
+#define ABI_NUM FFI_DEFAULT_ABI
+#define ABI_ATTR
#endif
/* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a
@@ -110,44 +121,15 @@
#endif
#endif
-#ifdef USING_MMAP
-static inline void *
-allocate_mmap (size_t size)
-{
- void *page;
-#if defined (HAVE_MMAP_DEV_ZERO)
- static int dev_zero_fd = -1;
-#endif
-
-#ifdef HAVE_MMAP_DEV_ZERO
- if (dev_zero_fd == -1)
- {
- dev_zero_fd = open ("/dev/zero", O_RDONLY);
- if (dev_zero_fd == -1)
- {
- perror ("open /dev/zero: %m");
- exit (1);
- }
- }
-#endif
-
-
-#ifdef HAVE_MMAP_ANON
- page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-#endif
-#ifdef HAVE_MMAP_DEV_ZERO
- page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE, dev_zero_fd, 0);
+/* MSVC kludge. */
+#if defined _MSC_VER
+#define PRIuPTR "lu"
+#define PRIu8 "u"
+#define PRId8 "d"
+#define PRIu64 "I64u"
+#define PRId64 "I64d"
#endif
- if (page == (void *) MAP_FAILED)
- {
- perror ("virtual memory exhausted");
- exit (1);
- }
-
- return page;
-}
-
+#ifndef PRIuPTR
+#define PRIuPTR "u"
#endif