summaryrefslogtreecommitdiff
path: root/libgfortran/libgfortran.h
diff options
context:
space:
mode:
authorsje <sje@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-27 21:12:52 +0000
committersje <sje@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-27 21:12:52 +0000
commit839904a0e3a1859cdfeb5ff23e5263c332f347fa (patch)
treeb153488273b3833bfdf44f1f0c3ac72e033b31c2 /libgfortran/libgfortran.h
parentc0edfcc4dff63bcbbfdb726a7e1f36fd42c53c3c (diff)
downloadgcc-839904a0e3a1859cdfeb5ff23e5263c332f347fa.tar.gz
PR target/23552
* acinclude.m4 (LIBGFOR_CHECK_FOR_BROKEN_ISFINITE): New. (LIBGFOR_CHECK_FOR_BROKEN_ISNAN): New. (LIBGFOR_CHECK_FOR_BROKEN_FPCLASSIFY): New. * configure.ac (LIBGFOR_CHECK_FOR_BROKEN_ISFINITE): Add use. (LIBGFOR_CHECK_FOR_BROKEN_ISNAN): Add use. (LIBGFOR_CHECK_FOR_BROKEN_FPCLASSIFY): Add use. * configure: Regenerate. * config.h.in: Regenerate. * libgfortan.h (isfinite): undef if broken, set if needed. (isnan): undef if broken, set if needed. (fpclassify): undef if broken, set if needed. * io/write.c: Remove TODO comment about working isfinite. * intrinsics/c99_functions.c (round): Use isfinite instead of fpclassify. * intrinsics/c99_functions.c (roundf): Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104710 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/libgfortran.h')
-rw-r--r--libgfortran/libgfortran.h28
1 files changed, 24 insertions, 4 deletions
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index 54aca7e66bc..191d8d48070 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -177,13 +177,33 @@ typedef off_t gfc_offset;
When isfinite is not available, try to use one of the
alternatives, or bail out. */
-#if (!defined(isfinite) || defined(__CYGWIN__))
+
+#if defined(HAVE_BROKEN_ISFINITE) || defined(__CYGWIN__)
#undef isfinite
-#if defined(fpclassify)
+#endif
+
+#if defined(HAVE_BROKEN_ISNAN)
+#undef isnan
+#endif
+
+#if defined(HAVE_BROKEN_FPCLASSIFY)
+#undef fpclassify
+#endif
+
+#if !defined(isfinite)
+#if !defined(fpclassify)
+#define isfinite(x) ((x) - (x) == 0)
+#else
#define isfinite(x) (fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE)
+#endif /* !defined(fpclassify) */
+#endif /* !defined(isfinite) */
+
+#if !defined(isnan)
+#if !defined(fpclassify)
+#define isnan(x) ((x) != (x))
#else
-#define isfinite(x) ((x) - (x) == 0)
-#endif
+#define isnan(x) (fpclassify(x) == FP_NAN)
+#endif /* !defined(fpclassify) */
#endif /* !defined(isfinite) */
/* TODO: find the C99 version of these an move into above ifdef. */