1 /* -----------------------------------------------------------------------
2 ffi_common.h - Copyright (c) 1996 Red Hat, Inc.
3 Copyright (C) 2007 Free Software Foundation, Inc
5 Common internal definitions and macros. Only necessary for building
7 ----------------------------------------------------------------------- */
16 #include <fficonfig.h>
18 /* Do not move this. Some versions of AIX are very picky about where
19 this is positioned. */
21 # define alloca __builtin_alloca
22 # define MAYBE_UNUSED __attribute__((__unused__))
31 # ifndef alloca /* predefined by HP cc +Olibcalls */
38 /* Check for the existence of memcpy. */
43 # define memcpy(d, s, n) bcopy ((s), (d), (n))
47 #if defined(FFI_DEBUG)
52 void ffi_assert(char *expr, char *file, int line);
53 void ffi_stop_here(void);
54 void ffi_type_test(ffi_type *a, char *file, int line);
56 #define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__))
57 #define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l)))
58 #define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__)
61 #define FFI_ASSERT_AT(x, f, l)
62 #define FFI_ASSERT_VALID_TYPE(x)
65 #define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1)
66 #define ALIGN_DOWN(v, a) (((size_t) (v)) & -a)
68 /* Perform machine dependent cif processing */
69 ffi_status ffi_prep_cif_machdep(ffi_cif *cif);
71 /* Extended cif, used in callback from assembly routine */
79 /* Terse sized type definitions. */
80 typedef unsigned int UINT8 __attribute__((__mode__(__QI__)));
81 typedef signed int SINT8 __attribute__((__mode__(__QI__)));
82 typedef unsigned int UINT16 __attribute__((__mode__(__HI__)));
83 typedef signed int SINT16 __attribute__((__mode__(__HI__)));
84 typedef unsigned int UINT32 __attribute__((__mode__(__SI__)));
85 typedef signed int SINT32 __attribute__((__mode__(__SI__)));
86 typedef unsigned int UINT64 __attribute__((__mode__(__DI__)));
87 typedef signed int SINT64 __attribute__((__mode__(__DI__)));
89 typedef float FLOAT32;