This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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] Use C99 isfinite macro instead of finite when availab


John David Anglin wrote:
>>John David Anglin wrote:
>>
>>>I trying to clean up a few things this week and then I will be
>>>travelling until Sept. 14.  Thus, I would greatly appreciate your
>>>taking care of this.
>>
>>So, did anybody take care of this?
> 
> 
> No.

Try the attached patch please. You have to run autoconf after applying.

Built on i686-pc-linux. I will commit under the obviously correct rule if it
works for John.

- Tobi

2004-09-27  Tobias Schlueter  <tobias.schlueter@phyisk.uni-muenchen.de>

	PR libfortran/15960
	* configure.ac: Add autoconf test for isfinite.
	* config.h.in: Add HAVE_ISFINITE.
	* io/write.c (write_float): Use isfinite if present.
Index: config.h.in
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/config.h.in,v
retrieving revision 1.9
diff -u -p -r1.9 config.h.in
--- config.h.in	26 Sep 2004 14:52:03 -0000	1.9
+++ config.h.in	27 Sep 2004 15:30:49 -0000
@@ -75,6 +75,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* libm includes isfinite */
+#undef HAVE_ISFINITE
+
 /* libm includes j0 */
 #undef HAVE_J0
 
Index: configure.ac
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/configure.ac,v
retrieving revision 1.11
diff -u -p -r1.11 configure.ac
--- configure.ac	26 Sep 2004 14:52:03 -0000	1.11
+++ configure.ac	27 Sep 2004 15:30:49 -0000
@@ -180,6 +180,7 @@ AC_CHECK_LIB([m],[expf],[AC_DEFINE([HAVE
 AC_CHECK_LIB([m],[floorf],[AC_DEFINE([HAVE_FLOORF],[1],[libm includes floorf])])
 AC_CHECK_LIB([m],[frexpf],[AC_DEFINE([HAVE_FREXPF],[1],[libm includes frexpf])])
 AC_CHECK_LIB([m],[hypotf],[AC_DEFINE([HAVE_HYPOTF],[1],[libm includes hypotf])])
+AC_CHECK_LIB([m],[isfinite],[AC_DEFINE([HAVE_ISFINITE],[1],[libm includes isfinite])])
 AC_CHECK_LIB([m],[logf],[AC_DEFINE([HAVE_LOGF],[1],[libm includes logf])])
 AC_CHECK_LIB([m],[log10f],[AC_DEFINE([HAVE_LOG10F],[1],[libm includes log10f])])
 AC_CHECK_LIB([m],[nextafter],[AC_DEFINE([HAVE_NEXTAFTER],[1],[libm includes nextafter])])
Index: io/write.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/write.c,v
retrieving revision 1.14
diff -u -p -r1.14 write.c
--- io/write.c	6 Sep 2004 16:33:52 -0000	1.14
+++ io/write.c	27 Sep 2004 15:30:49 -0000
@@ -637,7 +637,11 @@ write_float (fnode *f, const char *sourc
 
   if (f->format != FMT_B && f->format != FMT_O && f->format != FMT_Z)
    {
+#ifdef HAVE_ISFINITE
+     res = isfinite (n);
+#else
      res = finite (n);
+#endif
      if (res == 0)
        {
          nb =  f->u.real.w;

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