This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch/rfc] Add host's floatformat


Here's a revised patch:

- uses functions instead of variables
- adds m68k
- adds _host_ to the function names

more comments?
Andrew
Index: include/ChangeLog
2004-04-30  Andrew Cagney  <cagney@redhat.com>

	* floatformat.h (floatformat_host_float, floatformat_host_double)
	(floatformat_host_long_double): Declare.

Index: libiberty/ChangeLog
2004-04-30  Andrew Cagney  <cagney@redhat.com>

	* configure.ac: Define HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT, and
	HOST_LONG_DOUBLE_FORMAT.
	* configure, config.in: Re-generate.
	* floatformat.c (floatformat_host_float, floatformat_host_double)
	(floatformat_host_long_double): New functions.

Index: include/floatformat.h
===================================================================
RCS file: /cvs/src/src/include/floatformat.h,v
retrieving revision 1.9
diff -p -u -r1.9 floatformat.h
--- include/floatformat.h	22 Sep 2003 17:41:02 -0000	1.9
+++ include/floatformat.h	1 May 2004 17:17:36 -0000
@@ -1,5 +1,7 @@
 /* IEEE floating point support declarations, for GDB, the GNU Debugger.
-   Copyright 1991, 1994, 1995, 1997, 2000, 2003 Free Software Foundation, Inc.
+
+   Copyright 1991, 1994, 1995, 1997, 2000, 2003, 2004 Free Software
+   Foundation, Inc.
 
 This file is part of GDB.
 
@@ -129,5 +131,11 @@ floatformat_from_double PARAMS ((const s
 
 extern int
 floatformat_is_valid PARAMS ((const struct floatformat *fmt, const char *from));
+
+/* If non-NULL, the host's floatformat corresponding to the compilers
+   "float", "double" and "long double" types.  */
+extern const struct floatformat *floatformat_host_float PARAMS ((void));
+extern const struct floatformat *floatformat_host_double PARAMS ((void));
+extern const struct floatformat *floatformat_host_long_double PARAMS ((void));
 
 #endif	/* defined (FLOATFORMAT_H) */
Index: libiberty/config.in
===================================================================
RCS file: /cvs/src/src/libiberty/config.in,v
retrieving revision 1.26
diff -p -u -r1.26 config.in
--- libiberty/config.in	22 Apr 2004 18:39:02 -0000	1.26
+++ libiberty/config.in	1 May 2004 17:17:43 -0000
@@ -313,6 +313,15 @@
 /* Define if you have the _system_configuration variable. */
 #undef HAVE__SYSTEM_CONFIGURATION
 
+/* Host double floatformat */
+#undef HOST_DOUBLE_FORMAT
+
+/* Host float floatformat */
+#undef HOST_FLOAT_FORMAT
+
+/* Host long double floatformat */
+#undef HOST_LONG_DOUBLE_FORMAT
+
 /* Define if the host machine stores words of multi-word integers in
    big-endian order. */
 #undef HOST_WORDS_BIG_ENDIAN
Index: libiberty/configure
===================================================================
RCS file: /cvs/src/src/libiberty/configure,v
retrieving revision 1.58
diff -p -u -r1.58 configure
--- libiberty/configure	26 Apr 2004 18:23:59 -0000	1.58
+++ libiberty/configure	1 May 2004 17:17:47 -0000
@@ -6293,6 +6293,45 @@ case "${host}" in
 esac
 
 
+# Figure out which floatformat to use.
+case "${host}" in
+i3456786-*-*)
+	host_float_format="&floatformat_ieee_single_little"
+	host_double_format="&floatformat_ieee_double_little"
+	host_long_double_format="&floatformat_i387_ext"
+	;;
+hppa*-*-linux*)
+	host_float_format="&floatformat_ieee_single_big"
+	host_double_format="&floatformat_ieee_double_big"
+	host_long_double_format="&floatformat_ieee_double_big"
+	;;
+m68*-*-*)
+	host_float_format="&floatformat_ieee_single_big"
+	host_double_format="&floatformat_ieee_double_big"
+	host_long_double_format="&floatformat_m68881_ext"
+	;;
+*)
+	host_float_format=0
+	host_double_format=0
+	host_long_double_format=0
+	;;
+esac
+
+cat >>confdefs.h <<_ACEOF
+#define HOST_FLOAT_FORMAT $host_float_format
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define HOST_DOUBLE_FORMAT $host_double_format
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define HOST_LONG_DOUBLE_FORMAT $host_long_double_format
+_ACEOF
+
+
 if test x$gcc_no_link = xyes; then
   if test "x${ac_cv_func_mmap_fixed_mapped+set}" != xset; then
     ac_cv_func_mmap_fixed_mapped=no
Index: libiberty/configure.ac
===================================================================
RCS file: /cvs/src/src/libiberty/configure.ac,v
retrieving revision 1.6
diff -p -u -r1.6 configure.ac
--- libiberty/configure.ac	26 Apr 2004 18:23:59 -0000	1.6
+++ libiberty/configure.ac	1 May 2004 17:17:47 -0000
@@ -520,6 +520,33 @@ case "${host}" in
 esac
 AC_SUBST(pexecute)
 
+# Figure out which floatformat to use.
+case "${host}" in
+i[34567]86-*-*)
+	host_float_format="&floatformat_ieee_single_little"
+	host_double_format="&floatformat_ieee_double_little"
+	host_long_double_format="&floatformat_i387_ext"
+	;;
+hppa*-*-linux*)
+	host_float_format="&floatformat_ieee_single_big"
+	host_double_format="&floatformat_ieee_double_big"
+	host_long_double_format="&floatformat_ieee_double_big"
+	;;
+m68*-*-*)
+	host_float_format="&floatformat_ieee_single_big"
+	host_double_format="&floatformat_ieee_double_big"
+	host_long_double_format="&floatformat_m68881_ext"
+	;;
+*)
+	host_float_format=0
+	host_double_format=0
+	host_long_double_format=0
+	;;
+esac
+AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT,$host_float_format,[Host float floatformat])
+AC_DEFINE_UNQUOTED(HOST_DOUBLE_FORMAT,$host_double_format,[Host double floatformat])
+AC_DEFINE_UNQUOTED(HOST_LONG_DOUBLE_FORMAT,$host_long_double_format,[Host long double floatformat])
+
 libiberty_AC_FUNC_STRNCMP
 
 # Install a library built with a cross compiler in $(tooldir) rather
Index: libiberty/floatformat.c
===================================================================
RCS file: /cvs/src/src/libiberty/floatformat.c,v
retrieving revision 1.12
diff -p -u -r1.12 floatformat.c
--- libiberty/floatformat.c	3 Dec 2003 19:03:29 -0000	1.12
+++ libiberty/floatformat.c	1 May 2004 17:17:47 -0000
@@ -1,5 +1,7 @@
 /* IEEE floating point support routines, for GDB, the GNU Debugger.
-   Copyright (C) 1991, 1994, 1999, 2000, 2003 Free Software Foundation, Inc.
+
+   Copyright 1991, 1994, 1999, 2000, 2003, 2004 Free Software
+   Foundation, Inc.
 
 This file is part of GDB.
 
@@ -548,6 +550,24 @@ floatformat_is_valid (fmt, from)
   return fmt->is_valid (fmt, from);
 }
 
+/* If non-NULL, the host's floatformat.  */
+const struct floatformat *
+floatformat_host_float ()
+{
+  return HOST_FLOAT_FORMAT;
+}
+
+const struct floatformat *
+floatformat_host_double ()
+{
+  return HOST_DOUBLE_FORMAT;
+}
+
+const struct floatformat *
+floatformat_host_long_double ()
+{
+  return HOST_LONG_DOUBLE_FORMAT;
+}
 
 #ifdef IEEE_DEBUG
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]