32aa3bffc3
* intrinsics/c99_functions.c (log10l): New log10l function for systems where this is not available. * c99_protos.h: Prototype for log10l function. * libgfortran.h: Use generated kinds.h to define GFC_INTEGER_*, GFC_UINTEGER_*, GFC_LOGICAL_*, GFC_REAL_*, GFC_COMPLEX_*. Update prototypes for gfc_itoa and xtoa. * io/io.h: Update prototypes for set_integer and max_value. * io/list_read.c (convert_integer): Use new GFC_(INTEGER|REAL)_LARGEST type. * io/read.c (set_integer): Likewise. (max_value): Likewise. (convert_real): Likewise. (real_l): Likewise. (next_char): Likewise. (read_decimal): Likewise. (read_radix): Likewise. (read_f): Likewise. * io/write.c (extract_int): Use new GFC_INTEGER_LARGEST type. (extract_real): Use new GFC_REAL_LARGEST type. (calculate_exp): Likewise. (calculate_G_format): Likewise. (output_float): Likewise. Use log10l for long double values. Add comment for sprintf format. Use GFC_REAL_LARGEST_FORMAT. (write_l): Use new GFC_INTEGER_LARGEST type. (write_float): Use new GFC_REAL_LARGEST type. (write_int): Remove useless special case for (len < 8). (write_decimal): Use GFC_INTEGER_LARGEST. (otoa): Use GFC_UINTEGER_LARGEST as argument. (btoa): Use GFC_UINTEGER_LARGEST as argument. * runtime/error.c (gfc_itoa): Use GFC_INTEGER_LARGEST as argument. (xtoa): Use GFC_UINTEGER_LARGEST as argument. * Makefile.am: Use mk-kinds-h.sh to generate header kinds.h with all Fortran kinds available. * configure.ac: Check for strtold and log10l. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * config.h.in: Regenerate. * mk-kinds-h.sh: Configuration script for available integer and real kinds. * lib/target-supports.exp: Add check_effective_target_fortran_large_real and check_effective_target_fortran_large_int to check for corresponding effective targets. * gfortran.dg/large_integer_kind_1.f90: New test. * gfortran.dg/large_real_kind_1.f90: New test. From-SVN: r101274
66 lines
1.6 KiB
Bash
Executable File
66 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
compile="$1"
|
|
|
|
# Possible types must be listed in ascending order
|
|
possible_integer_kinds="1 2 4 8 16"
|
|
possible_real_kinds="4 8 10 16"
|
|
|
|
|
|
largest=""
|
|
for k in $possible_integer_kinds; do
|
|
echo " integer (kind=$k) :: i" > tmp$$.f90
|
|
echo " end" >> tmp$$.f90
|
|
if $compile -c tmp$$.f90 > /dev/null 2>&1; then
|
|
s=`expr 8 \* $k`
|
|
largest="$k"
|
|
|
|
if [ $s -eq 128 ]; then
|
|
prefix="__"
|
|
else
|
|
prefix=""
|
|
fi
|
|
|
|
echo "typedef ${prefix}int${s}_t GFC_INTEGER_${k};"
|
|
echo "typedef ${prefix}uint${s}_t GFC_UINTEGER_${k};"
|
|
echo "typedef GFC_INTEGER_${k} GFC_LOGICAL_${k};"
|
|
echo "#define HAVE_GFC_INTEGER_${k}"
|
|
fi
|
|
rm -f tmp$$.*
|
|
done
|
|
|
|
echo "#define GFC_INTEGER_LARGEST GFC_INTEGER_${largest}"
|
|
echo "#define GFC_UINTEGER_LARGEST GFC_UINTEGER_${largest}"
|
|
echo ""
|
|
|
|
|
|
largest_ctype=""
|
|
for k in $possible_real_kinds; do
|
|
echo " real (kind=$k) :: x" > tmp$$.f90
|
|
echo " end" >> tmp$$.f90
|
|
if $compile -c tmp$$.f90 > /dev/null 2>&1; then
|
|
case $k in
|
|
4) ctype="float" ;;
|
|
8) ctype="double" ;;
|
|
10) ctype="long double" ;;
|
|
16) ctype="long double" ;;
|
|
*) echo "$0: Unknown type" >&2 ; exit 1 ;;
|
|
esac
|
|
largest_ctype="$ctype"
|
|
echo "typedef ${ctype} GFC_REAL_${k};"
|
|
echo "typedef complex ${ctype} GFC_COMPLEX_${k};"
|
|
echo "#define HAVE_GFC_REAL_${k}"
|
|
fi
|
|
rm -f tmp$$.*
|
|
done
|
|
|
|
case $largest_ctype in
|
|
float) echo "#define GFC_REAL_LARGEST_FORMAT \"\"" ;;
|
|
double) echo "#define GFC_REAL_LARGEST_FORMAT \"l\"" ;;
|
|
"long double") echo "#define GFC_REAL_LARGEST_FORMAT \"L\"" ;;
|
|
*) echo "$0: Unknown type" >&2 ; exit 1 ;;
|
|
esac
|
|
echo "#define GFC_REAL_LARGEST $largest_ctype"
|
|
|
|
exit 0
|