aboutsummaryrefslogtreecommitdiff
path: root/libffi/src/types.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2007-04-06 16:24:16 +0000
committerRichard Henderson <rth@redhat.com>2007-04-06 16:24:16 +0000
commit916cad78643f772aa4efaa340011b37d32996680 (patch)
tree430f3d3b8444386a212bcbe6f9a70261cfb97d01 /libffi/src/types.c
parentcfd16f0c8acdab52b1c3492526f4af1e83251377 (diff)
* configure.ac: Tidy target case.
(HAVE_LONG_DOUBLE): Allow the target to override. * configure: Regenerate. * include/ffi.h.in: Don't define ffi_type_foo if LIBFFI_HIDE_BASIC_TYPES is defined. (ffi_type_longdouble): If not HAVE_LONG_DOUBLE, define to ffi_type_double. * types.c (LIBFFI_HIDE_BASIC_TYPES): Define. (FFI_TYPEDEF, ffi_type_void): Mark the data const. (ffi_type_longdouble): Special case for Alpha. Don't define if long double == double. * src/alpha/ffi.c (FFI_TYPE_LONGDOUBLE): Assert unique value. (ffi_prep_cif_machdep): Handle it as the 128-bit type. (ffi_call, ffi_closure_osf_inner): Likewise. (ffi_closure_osf_inner): Likewise. Mark hidden. (ffi_call_osf, ffi_closure_osf): Mark hidden. * src/alpha/ffitarget.h (FFI_LAST_ABI): Tidy definition. * src/alpha/osf.S (ffi_call_osf, ffi_closure_osf): Mark hidden. (load_table): Handle 128-bit long double. * testsuite/libffi.call/float4.c: Add -mieee for alpha. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@123622 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libffi/src/types.c')
-rw-r--r--libffi/src/types.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/libffi/src/types.c b/libffi/src/types.c
index b65787359fe..6d3048870c8 100644
--- a/libffi/src/types.c
+++ b/libffi/src/types.c
@@ -23,6 +23,10 @@
OTHER DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
+/* Hide the basic type definitions from the header file, so that we
+ can redefine them here as "const". */
+#define LIBFFI_HIDE_BASIC_TYPES
+
#include <ffi.h>
#include <ffi_common.h>
@@ -33,14 +37,14 @@ struct struct_align_##name { \
char c; \
type x; \
}; \
-ffi_type ffi_type_##name = { \
+const 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_type ffi_type_void = {
+const ffi_type ffi_type_void = {
1, 1, FFI_TYPE_VOID, NULL
};
@@ -57,4 +61,16 @@ FFI_TYPEDEF(pointer, void*, FFI_TYPE_POINTER);
FFI_TYPEDEF(float, float, FFI_TYPE_FLOAT);
FFI_TYPEDEF(double, double, FFI_TYPE_DOUBLE);
+
+#ifdef __alpha__
+/* Even if we're not configured to default to 128-bit long double,
+ maintain binary compatibility, as -mlong-double-128 can be used
+ at any time. */
+/* Validate the hard-coded number below. */
+# if defined(__LONG_DOUBLE_128__) && FFI_TYPE_LONGDOUBLE != 4
+# error FFI_TYPE_LONGDOUBLE out of date
+# endif
+const ffi_type ffi_type_longdouble = { 16, 16, 4, NULL };
+#elif FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
FFI_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE);
+#endif