From c35f4ffcade07bba900aa312c2d0c2242113c5d4 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Thu, 29 Jul 2004 19:33:22 +0000 Subject: [PATCH] 2004-07-29 Andrew Cagney * config/pa/xm-linux.h: Do not include "floatformat.h". (HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT) (HOST_LONG_DOUBLE_FORMAT): Delete macros. * config/i386/xm-i386.h: Do not include "floatformat.h". (HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT) (HOST_LONG_DOUBLE_FORMAT): Delete macros. * doublest.c (HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT) (HOST_LONG_DOUBLE_FORMAT): Delete macros. Use GDB_HOST_FLOAT_FORMAT, GDB_HOST_DOUBLE_FORMAT and GDB_HOST_LONG_DOUBLE_FORMAT instead. * configure.in (GDB_HOST_FLOAT_FORMAT, GDB_HOST_DOUBLE_FORMAT) (GDB_HOST_LONG_DOUBLE_FORMAT): Define. * configure, config.in: Regenerate. * configure.host (gdb_host_float_format, gdb_host_double_format) (gdb_host_long_double_format): Set according to the host. --- gdb/ChangeLog | 18 +++++++++++++++++ gdb/config.in | 9 +++++++++ gdb/config/i386/xm-i386.h | 6 ------ gdb/config/pa/xm-linux.h | 6 ------ gdb/configure | 50 ++++++++++++++++++++++++++++++----------------- gdb/configure.host | 30 ++++++++++++++++++++++++++-- gdb/configure.in | 5 +++++ gdb/doublest.c | 31 +++++++++++++---------------- 8 files changed, 106 insertions(+), 49 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8269d72..c71f2e9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,23 @@ 2004-07-29 Andrew Cagney + * config/pa/xm-linux.h: Do not include "floatformat.h". + (HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT) + (HOST_LONG_DOUBLE_FORMAT): Delete macros. + * config/i386/xm-i386.h: Do not include "floatformat.h". + (HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT) + (HOST_LONG_DOUBLE_FORMAT): Delete macros. + * doublest.c (HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT) + (HOST_LONG_DOUBLE_FORMAT): Delete macros. Use + GDB_HOST_FLOAT_FORMAT, GDB_HOST_DOUBLE_FORMAT and + GDB_HOST_LONG_DOUBLE_FORMAT instead. + * configure.in (GDB_HOST_FLOAT_FORMAT, GDB_HOST_DOUBLE_FORMAT) + (GDB_HOST_LONG_DOUBLE_FORMAT): Define. + * configure, config.in: Regenerate. + * configure.host (gdb_host_float_format, gdb_host_double_format) + (gdb_host_long_double_format): Set according to the host. + +2004-07-29 Andrew Cagney + * Makefile.in (CONFIG_CLEAN): Delete duplicate definition. 2004-07-28 Andrew Cagney diff --git a/gdb/config.in b/gdb/config.in index 7da9038..933f3a0 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -540,6 +540,15 @@ /* Define if we can use the tkill syscall. */ #undef HAVE_TKILL_SYSCALL +/* Host float floatformat */ +#undef GDB_HOST_FLOAT_FORMAT + +/* Host double floatformat */ +#undef GDB_HOST_DOUBLE_FORMAT + +/* Host long double floatformat */ +#undef GDB_HOST_LONG_DOUBLE_FORMAT + /* Define to the default OS ABI for this configuration. */ #undef GDB_OSABI_DEFAULT diff --git a/gdb/config/i386/xm-i386.h b/gdb/config/i386/xm-i386.h index de29b26..e4ba146 100644 --- a/gdb/config/i386/xm-i386.h +++ b/gdb/config/i386/xm-i386.h @@ -22,10 +22,4 @@ #ifndef XM_I386_H #define XM_I386_H -#include "floatformat.h" - -#define HOST_FLOAT_FORMAT &floatformat_ieee_single_little -#define HOST_DOUBLE_FORMAT &floatformat_ieee_double_little -#define HOST_LONG_DOUBLE_FORMAT &floatformat_i387_ext - #endif /* xm-i386.h */ diff --git a/gdb/config/pa/xm-linux.h b/gdb/config/pa/xm-linux.h index ceb6ed2..81847be 100644 --- a/gdb/config/pa/xm-linux.h +++ b/gdb/config/pa/xm-linux.h @@ -22,10 +22,4 @@ #ifndef XM_HPPA_LINUX_H #define XM_HPPA_LINUX_H -#include "floatformat.h" - -#define HOST_FLOAT_FORMAT &floatformat_ieee_single_big -#define HOST_DOUBLE_FORMAT &floatformat_ieee_double_big -#define HOST_LONG_DOUBLE_FORMAT &floatformat_ieee_double_big - #endif /* xm-linux.h */ diff --git a/gdb/configure b/gdb/configure index 8b7d2a9..d56de71 100755 --- a/gdb/configure +++ b/gdb/configure @@ -10563,6 +10563,20 @@ fi +# List of host floatformats. +cat >> confdefs.h <> confdefs.h <> confdefs.h <&6 -echo "configure:10640: checking whether gdbserver is supported on this host" >&5 +echo "configure:10654: checking whether gdbserver is supported on this host" >&5 if test "x$build_gdbserver" = xyes; then configdirs="$configdirs gdbserver" echo "$ac_t""yes" 1>&6 @@ -10700,12 +10714,12 @@ fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:10704: checking for Cygwin environment" >&5 +echo "configure:10718: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10734: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -10733,19 +10747,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:10737: checking for mingw32 environment" >&5 +echo "configure:10751: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10763: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -10764,7 +10778,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:10768: checking for executable suffix" >&5 +echo "configure:10782: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10774,10 +10788,10 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:10778: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:10792: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.c | *.C | *.o | *.obj | *.ilk | *.pdb) ;; + *.c | *.o | *.obj | *.ilk | *.pdb) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -10816,7 +10830,7 @@ fi echo $ac_n "checking for iconv""... $ac_c" 1>&6 -echo "configure:10820: checking for iconv" >&5 +echo "configure:10834: checking for iconv" >&5 if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10824,7 +10838,7 @@ else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat > conftest.$ac_ext < #include @@ -10834,7 +10848,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:10838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_func_iconv=yes else @@ -10846,7 +10860,7 @@ rm -f conftest* am_save_LIBS="$LIBS" LIBS="$LIBS -liconv" cat > conftest.$ac_ext < #include @@ -10856,7 +10870,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:10860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10874: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_lib_iconv=yes am_cv_func_iconv=yes @@ -10877,13 +10891,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6 EOF echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6 -echo "configure:10881: checking for iconv declaration" >&5 +echo "configure:10895: checking for iconv declaration" >&5 if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -10902,7 +10916,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:10906: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10920: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_proto_iconv_arg1="" else diff --git a/gdb/configure.host b/gdb/configure.host index a2a8d5d..71436bf 100644 --- a/gdb/configure.host +++ b/gdb/configure.host @@ -2,8 +2,11 @@ # invoked from the autoconf generated configure script. # This file sets the following shell variables: -# gdb_host_cpu generic name of host's CPU -# gdb_host name of GDB host definition to use +# gdb_host_cpu generic name of host's CPU +# gdb_host name of GDB host definition to use +# gdb_host_float_format host's float floatformat, or 0 +# gdb_host_double_format host's double floatformat, or 0 +# gdb_host_long_double_format host's long double floatformat, or 0 # Map host cpu into the config cpu subdirectory name. # The default is $host_cpu. @@ -145,3 +148,26 @@ x86_64-*-openbsd*) gdb_host=obsd64 ;; m32r*-*-linux*) gdb_host=linux ;; esac + + + +# Map the host/cpu onto the floatformat correspondong to C's "float", +# "double" and "long double" types. + +case "${host}" in +i[34567]86-*-*) + gdb_host_float_format="&floatformat_ieee_single_little" + gdb_host_double_format="&floatformat_ieee_double_little" + gdb_host_long_double_format="&floatformat_i387_ext" + ;; +hppa*-*-linux*) + gdb_host_float_format="&floatformat_ieee_single_big" + gdb_host_double_format="&floatformat_ieee_double_big" + gdb_host_long_double_format="&floatformat_ieee_double_big" + ;; +*) + gdb_host_float_format=0 + gdb_host_double_format=0 + gdb_host_long_double_format=0 + ;; +esac diff --git a/gdb/configure.in b/gdb/configure.in index ef5f17a..f5f3e98 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -1300,6 +1300,11 @@ AC_SUBST(CONFIG_CLEAN) AC_SUBST(CONFIG_INSTALL) AC_SUBST(CONFIG_UNINSTALL) +# List of host floatformats. +AC_DEFINE_UNQUOTED(GDB_HOST_FLOAT_FORMAT,$gdb_host_float_format,[Host float floatformat]) +AC_DEFINE_UNQUOTED(GDB_HOST_DOUBLE_FORMAT,$gdb_host_double_format,[Host double floatformat]) +AC_DEFINE_UNQUOTED(GDB_HOST_LONG_DOUBLE_FORMAT,$gdb_host_long_double_format,[Host long double floatformat]) + # target_subdir is used by the testsuite to find the target libraries. target_subdir= if test "${host}" != "${target}"; then diff --git a/gdb/doublest.c b/gdb/doublest.c index 3f283e1..10f4dfb 100644 --- a/gdb/doublest.c +++ b/gdb/doublest.c @@ -91,10 +91,17 @@ get_field (unsigned char *data, enum floatformat_byteorders order, { result |= (unsigned long)*(data + cur_byte) << cur_bitshift; cur_bitshift += FLOATFORMAT_CHAR_BIT; - if (order == floatformat_little || order == floatformat_littlebyte_bigword) - ++cur_byte; - else - --cur_byte; + switch (order) + { + case floatformat_little: + ++cur_byte; + break; + case floatformat_big: + --cur_byte; + break; + case floatformat_littlebyte_bigword: + break; + } } if (len < sizeof(result) * FLOATFORMAT_CHAR_BIT) /* Mask out bits which are not part of the field */ @@ -554,19 +561,9 @@ floatformat_mantissa (const struct floatformat *fmt, char *val) increase precision as necessary. Otherwise, we call the conversion routine and let it do the dirty work. */ -#ifndef HOST_FLOAT_FORMAT -#define HOST_FLOAT_FORMAT 0 -#endif -#ifndef HOST_DOUBLE_FORMAT -#define HOST_DOUBLE_FORMAT 0 -#endif -#ifndef HOST_LONG_DOUBLE_FORMAT -#define HOST_LONG_DOUBLE_FORMAT 0 -#endif - -static const struct floatformat *host_float_format = HOST_FLOAT_FORMAT; -static const struct floatformat *host_double_format = HOST_DOUBLE_FORMAT; -static const struct floatformat *host_long_double_format = HOST_LONG_DOUBLE_FORMAT; +static const struct floatformat *host_float_format = GDB_HOST_FLOAT_FORMAT; +static const struct floatformat *host_double_format = GDB_HOST_DOUBLE_FORMAT; +static const struct floatformat *host_long_double_format = GDB_HOST_LONG_DOUBLE_FORMAT; void floatformat_to_doublest (const struct floatformat *fmt, -- 2.7.4