summaryrefslogtreecommitdiff
path: root/libgfortran/mk-kinds-h.sh
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>2007-10-25 23:32:07 +0000
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2007-10-25 23:32:07 +0000
commit1fa6df85b101a71ea35000352ee000916517f100 (patch)
treef0e2df033c23e09e06ad14e3229d4d4afab719d9 /libgfortran/mk-kinds-h.sh
parent691307546ee843b5fff57573987cd616e832cd62 (diff)
downloadgcc-1fa6df85b101a71ea35000352ee000916517f100.tar.gz
libgfortran.h (GFC_REAL_*_HUGE, [...]): Remove.
* libgfortran.h (GFC_REAL_*_HUGE, GFC_REAL_*_DIGITS, GFC_REAL_*_RADIX): Remove. * mk-kinds-h.sh: Define GFC_REAL_*_HUGE, GFC_REAL_*_DIGITS and GFC_REAL_*_RADIX. Don't define GFC_REAL_LARGEST_FORMAT and GFC_REAL_LARGEST. From-SVN: r129636
Diffstat (limited to 'libgfortran/mk-kinds-h.sh')
-rwxr-xr-xlibgfortran/mk-kinds-h.sh43
1 files changed, 29 insertions, 14 deletions
diff --git a/libgfortran/mk-kinds-h.sh b/libgfortran/mk-kinds-h.sh
index ccd073844c9..0a0cdb7080f 100755
--- a/libgfortran/mk-kinds-h.sh
+++ b/libgfortran/mk-kinds-h.sh
@@ -31,6 +31,7 @@ for k in $possible_integer_kinds; do
echo "typedef GFC_INTEGER_${k} GFC_LOGICAL_${k};"
echo "#define HAVE_GFC_LOGICAL_${k}"
echo "#define HAVE_GFC_INTEGER_${k}"
+ echo ""
fi
rm -f tmp$$.*
done
@@ -41,33 +42,47 @@ echo "#define GFC_DEFAULT_CHAR ${smallest}"
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" ;;
+ 4) ctype="float" ; suffix="f" ;;
+ 8) ctype="double" ; suffix="" ;;
+ 10) ctype="long double" ; suffix="l" ;;
+ 16) ctype="long double" ; suffix="l" ;;
*) echo "$0: Unknown type" >&2 ; exit 1 ;;
esac
- largest_ctype="$ctype"
+
+ # Check for the value of HUGE
+ echo "print *, huge(0._$k) ; end" > tmq$$.f90
+ huge=`$compile -c -fdump-parse-tree tmq$$.f90 | grep TRANSFER \
+ | sed 's/ *TRANSFER *// ; s/_.*//'`
+ rm -f tmq$$.*
+
+ # Check for the value of DIGITS
+ echo "print *, digits(0._$k) ; end" > tmq$$.f90
+ digits=`$compile -c -fdump-parse-tree tmq$$.f90 | grep TRANSFER \
+ | sed 's/ *TRANSFER *//'`
+ rm -f tmq$$.*
+
+ # Check for the value of RADIX
+ echo "print *, radix(0._$k) ; end" > tmq$$.f90
+ radix=`$compile -c -fdump-parse-tree tmq$$.f90 | grep TRANSFER \
+ | sed 's/ *TRANSFER *//'`
+ rm -f tmq$$.*
+
+ # Output the information we've gathered
echo "typedef ${ctype} GFC_REAL_${k};"
echo "typedef complex ${ctype} GFC_COMPLEX_${k};"
echo "#define HAVE_GFC_REAL_${k}"
echo "#define HAVE_GFC_COMPLEX_${k}"
+ echo "#define GFC_REAL_${k}_HUGE ${huge}${suffix}"
+ echo "#define GFC_REAL_${k}_DIGITS ${digits}"
+ echo "#define GFC_REAL_${k}_RADIX ${radix}"
+ echo ""
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