fef67987cf
ISO_Fortran_binding.h had many incorrect hardwired kind encodings in the definitions of the CFI_type_* macros. Additionally, not all targets support all the defined type encodings, and the Fortran standard requires those macros to have a negative value. This patch changes ISO_Fortran_binding.h to use sizeof instead of hard-coded sizes, and assembles it from fragments that reflect the set of types supported by the target. 2021-07-22 Sandra Loosemore <sandra@codesourcery.com> Tobias Burnus <tobias@codesourcery.com> libgfortran/ PR libfortran/101305 * ISO_Fortran_binding.h: Fix hard-coded sizes and split into... * ISO_Fortran_binding-1-tmpl.h: New file. * ISO_Fortran_binding-2-tmpl.h: New file. * ISO_Fortran_binding-3-tmpl.h: New file. * Makefile.am: Add rule for generating ISO_Fortran_binding.h. Adjust pathnames to that file. * Makefile.in: Regenerated. * mk-kinds-h.sh: New file. * runtime/ISO_Fortran_binding.c: Fix include path.
43 lines
1.7 KiB
C
43 lines
1.7 KiB
C
#include "config.h"
|
|
#include "kinds.inc"
|
|
|
|
/* Note that -1 is used by CFI_type_other, hence, -2 is used for unavailable kinds. */
|
|
|
|
#if GFC_C_INT128_T_KIND == 16
|
|
#define CFI_type_int128_t (CFI_type_Integer + (16 << CFI_type_kind_shift))
|
|
#define CFI_type_int_least128_t (CFI_type_Integer + (16 << CFI_type_kind_shift))
|
|
#define CFI_type_int_fast128_t (CFI_type_Integer + (16 << CFI_type_kind_shift))
|
|
#elif GFC_C_INT128_T_KIND < 0
|
|
#define CFI_type_int128_t -2
|
|
#define CFI_type_int_least128_t -2
|
|
#define CFI_type_int_fast128_t -2
|
|
#else
|
|
#error "Unexpected value for GFC_C_INT128_T_KIND"
|
|
#endif
|
|
|
|
#if GFC_C_LONG_DOUBLE_KIND == 16
|
|
#define CFI_type_long_double (CFI_type_Real + (16 << CFI_type_kind_shift))
|
|
#define CFI_type_long_double_Complex (CFI_type_Complex + (16 << CFI_type_kind_shift))
|
|
#elif GFC_C_LONG_DOUBLE_KIND == 10
|
|
#define CFI_type_long_double (CFI_type_Real + (10 << CFI_type_kind_shift))
|
|
#define CFI_type_long_double_Complex (CFI_type_Complex + (10 << CFI_type_kind_shift))
|
|
#elif GFC_C_LONG_DOUBLE_KIND == 8
|
|
#define CFI_type_long_double (CFI_type_Real + (8 << CFI_type_kind_shift))
|
|
#define CFI_type_long_double_Complex (CFI_type_Complex + (8 << CFI_type_kind_shift))
|
|
#elif GFC_C_LONG_DOUBLE_KIND < 0
|
|
#define CFI_type_long_double -2
|
|
#define CFI_type_long_double_Complex -2
|
|
#else
|
|
#error "Unexpected value for GFC_C_LONG_DOUBLE_KIND"
|
|
#endif
|
|
|
|
#if GFC_C_FLOAT128_KIND == 16
|
|
#define CFI_type_float128 (CFI_type_Real + (16 << CFI_type_kind_shift))
|
|
#define CFI_type_float128_Complex (CFI_type_Complex + (16 << CFI_type_kind_shift))
|
|
#elif GFC_C_FLOAT128_KIND < 0
|
|
#define CFI_type_float128 -2
|
|
#define CFI_type_float128_Complex -2
|
|
#else
|
|
#error "Unexpected value for GFC_C_FLOAT128_KIND"
|
|
#endif
|