summaryrefslogtreecommitdiff
path: root/libffi
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-31 22:04:30 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-31 22:04:30 +0000
commitf587fca27d183e0e858265d4e7b3214d17c10c08 (patch)
tree162864d0f40d7df9bedfba3d0fd570b765c9409c /libffi
parent717c502ef73d100cd5617f6ff638af93fdaa0bb3 (diff)
downloadgcc-f587fca27d183e0e858265d4e7b3214d17c10c08.tar.gz
* src/types.c (FFI_AGGREGATE_TYPEDEF): Remove.
(FFI_TYPEDEF): Rename from FFI_INTEGRAL_TYPEDEF. Replace size and offset parameters with a type parameter; deduce size and structure alignment. Update all users. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92775 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libffi')
-rw-r--r--libffi/ChangeLog7
-rw-r--r--libffi/src/types.c94
2 files changed, 35 insertions, 66 deletions
diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index a55735efcda..02a5fc29fdb 100644
--- a/libffi/ChangeLog
+++ b/libffi/ChangeLog
@@ -1,5 +1,12 @@
2004-12-31 Richard Henderson <rth@redhat.com>
+ * src/types.c (FFI_AGGREGATE_TYPEDEF): Remove.
+ (FFI_TYPEDEF): Rename from FFI_INTEGRAL_TYPEDEF. Replace size and
+ offset parameters with a type parameter; deduce size and structure
+ alignment. Update all users.
+
+2004-12-31 Richard Henderson <rth@redhat.com>
+
* src/types.c (FFI_TYPE_POINTER): Define with sizeof.
(FFI_TYPE_LONGDOUBLE): Fix for ia64.
* src/ia64/ffitarget.h (struct ffi_ia64_trampoline_struct): Move
diff --git a/libffi/src/types.c b/libffi/src/types.c
index 06c9e6939c9..b65787359fe 100644
--- a/libffi/src/types.c
+++ b/libffi/src/types.c
@@ -28,71 +28,33 @@
/* Type definitions */
-#define FFI_INTEGRAL_TYPEDEF(n, s, a, t) ffi_type ffi_type_##n = { s, a, t, NULL }
-#define FFI_AGGREGATE_TYPEDEF(n, e) ffi_type ffi_type_##n = { 0, 0, FFI_TYPE_STRUCT, e }
+#define FFI_TYPEDEF(name, type, id) \
+struct struct_align_##name { \
+ char c; \
+ type x; \
+}; \
+ffi_type ffi_type_##name = { \
+ sizeof(type), \
+ offsetof(struct struct_align_##name, x), \
+ id, NULL \
+}
/* Size and alignment are fake here. They must not be 0. */
-FFI_INTEGRAL_TYPEDEF(void, 1, 1, FFI_TYPE_VOID);
-
-FFI_INTEGRAL_TYPEDEF(uint8, 1, 1, FFI_TYPE_UINT8);
-FFI_INTEGRAL_TYPEDEF(sint8, 1, 1, FFI_TYPE_SINT8);
-FFI_INTEGRAL_TYPEDEF(uint16, 2, 2, FFI_TYPE_UINT16);
-FFI_INTEGRAL_TYPEDEF(sint16, 2, 2, FFI_TYPE_SINT16);
-FFI_INTEGRAL_TYPEDEF(uint32, 4, 4, FFI_TYPE_UINT32);
-FFI_INTEGRAL_TYPEDEF(sint32, 4, 4, FFI_TYPE_SINT32);
-FFI_INTEGRAL_TYPEDEF(float, 4, 4, FFI_TYPE_FLOAT);
-
-FFI_INTEGRAL_TYPEDEF(pointer, sizeof(void*), sizeof(void*), FFI_TYPE_POINTER);
-
-#if defined X86 || defined ARM || defined M68K || SH
-
-FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64);
-FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64);
-
-#else
-
-FFI_INTEGRAL_TYPEDEF(uint64, 8, 8, FFI_TYPE_UINT64);
-FFI_INTEGRAL_TYPEDEF(sint64, 8, 8, FFI_TYPE_SINT64);
-
-#endif
-
-
-#if defined X86 || defined X86_WIN32 || defined M68K
-
-#ifdef X86_WIN32
-FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
-#else
-FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
-#endif
-FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE);
-
-#elif defined ARM || defined SH || defined POWERPC_AIX || defined M32R
-
-FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
-FFI_INTEGRAL_TYPEDEF(longdouble, 8, 4, FFI_TYPE_LONGDOUBLE);
-
-#elif defined POWERPC_DARWIN
-
-FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
-FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE);
-
-#elif defined SPARC
-
-FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
-#ifdef SPARC64
-FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE);
-#else
-FFI_INTEGRAL_TYPEDEF(longdouble, 16, 8, FFI_TYPE_LONGDOUBLE);
-#endif
-
-#elif defined X86_64 || defined POWERPC64 || defined IA64
-
-FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
-FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE);
-
-#else
-
-FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
-FFI_INTEGRAL_TYPEDEF(longdouble, 8, 8, FFI_TYPE_LONGDOUBLE);
-
-#endif
+ffi_type ffi_type_void = {
+ 1, 1, FFI_TYPE_VOID, NULL
+};
+
+FFI_TYPEDEF(uint8, UINT8, FFI_TYPE_UINT8);
+FFI_TYPEDEF(sint8, SINT8, FFI_TYPE_SINT8);
+FFI_TYPEDEF(uint16, UINT16, FFI_TYPE_UINT16);
+FFI_TYPEDEF(sint16, SINT16, FFI_TYPE_SINT16);
+FFI_TYPEDEF(uint32, UINT32, FFI_TYPE_UINT32);
+FFI_TYPEDEF(sint32, SINT32, FFI_TYPE_SINT32);
+FFI_TYPEDEF(uint64, UINT64, FFI_TYPE_UINT64);
+FFI_TYPEDEF(sint64, SINT64, FFI_TYPE_SINT64);
+
+FFI_TYPEDEF(pointer, void*, FFI_TYPE_POINTER);
+
+FFI_TYPEDEF(float, float, FFI_TYPE_FLOAT);
+FFI_TYPEDEF(double, double, FFI_TYPE_DOUBLE);
+FFI_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE);