From 3e4b5182b4adda8d229d96e307a44a75eda086d3 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 26 Jan 2008 15:37:59 +0100 Subject: [PATCH] Make use of GCC's __builtin_isnan. --- ChangeLog | 5 +++++ lib/isnand.h | 6 +++++- m4/isnand.m4 | 11 +++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0756be850..2dd3da12f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2008-01-26 Bruno Haible + * m4/isnand.m4 (gl_FUNC_ISNAND_NO_LIBM): Test the GCC >= 4.0 built-in. + * lib/isnand.h (isnand): Use the GCC >= 4.0 built-in. + +2008-01-26 Bruno Haible + * m4/isnanf.m4 (gl_HAVE_ISNANF_NO_LIBM, gl_ISNANF_WORKS): Test the GCC >= 4.0 built-in. * lib/isnanf.h (isnanf): Use the GCC >= 4.0 built-in. diff --git a/lib/isnand.h b/lib/isnand.h index c58697f17..d248b2f5e 100644 --- a/lib/isnand.h +++ b/lib/isnand.h @@ -17,7 +17,11 @@ #if HAVE_ISNAND_IN_LIBC /* Get declaration of isnan macro. */ # include -# ifdef isnan +# if __GNUC__ >= 4 + /* GCC 4.0 and newer provides three built-ins for isnan. */ +# undef isnand +# define isnand(x) __builtin_isnan ((double)(x)) +# else # undef isnand # define isnand(x) isnan ((double)(x)) # endif diff --git a/m4/isnand.m4 b/m4/isnand.m4 index 4f747eae0..7783b424e 100644 --- a/m4/isnand.m4 +++ b/m4/isnand.m4 @@ -1,4 +1,4 @@ -# isnand.m4 serial 1 +# isnand.m4 serial 2 dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -12,8 +12,15 @@ AC_DEFUN([gl_FUNC_ISNAND_NO_LIBM], [gl_cv_func_isnand_no_libm], [ AC_TRY_LINK([#include + #if __GNUC__ >= 4 + # undef isnand + # define isnand(x) __builtin_isnan ((double)(x)) + #else + # undef isnand + # define isnand(x) isnan ((double)(x)) + #endif double x;], - [return isnan (x);], + [return isnand (x);], [gl_cv_func_isnand_no_libm=yes], [gl_cv_func_isnand_no_libm=no]) ]) -- 2.11.0