X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=libffi%2Fsrc%2Ftypes.c;h=6d3048870c886d9731ac2277a6ab87872c63f84e;hp=b65787359feb9970d5c14698da9d93ab1ca856cd;hb=ea4d299a259d8cc08aefa91e797ec4a6e5bf4053;hpb=8ac34e6dbde42bf7267604428d5418cb79c1fa7e 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 #include @@ -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