Mercurial > hg > octave-nkf > gnulib-hg
changeset 9647:56547f123073
Use the GCC built-in when available.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 26 Jan 2008 13:23:24 +0100 |
parents | a113e473cc98 |
children | b0279d822a0e |
files | ChangeLog lib/isnanf.h m4/isnanf.m4 |
diffstat | 3 files changed, 22 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-01-26 Bruno Haible <bruno@clisp.org> + + * 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. + 2008-01-26 Bruno Haible <bruno@clisp.org> Rename isnan, applicable to 'double' only, to isnand.
--- a/lib/isnanf.h +++ b/lib/isnanf.h @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +17,11 @@ #if HAVE_ISNANF_IN_LIBC /* Get declaration of isnan macro or (older) isnanf function. */ # include <math.h> -# ifdef isnan +# if __GNUC__ >= 4 + /* GCC 4.0 and newer provides three built-ins for isnan. */ +# undef isnanf +# define isnanf(x) __builtin_isnanf ((float)(x)) +# elif defined isnan # undef isnanf # define isnanf(x) isnan ((float)(x)) # endif
--- a/m4/isnanf.m4 +++ b/m4/isnanf.m4 @@ -1,5 +1,5 @@ -# isnanf.m4 serial 4 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# isnanf.m4 serial 5 +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, dnl with or without modifications, as long as this notice is preserved. @@ -33,7 +33,10 @@ [gl_cv_func_isnanf_no_libm], [ AC_TRY_LINK([#include <math.h> - #ifdef isnan + #if __GNUC__ >= 4 + # undef isnanf + # define isnanf(x) __builtin_isnanf ((float)(x)) + #elif defined isnan # undef isnanf # define isnanf(x) isnan ((float)(x)) #endif @@ -54,7 +57,10 @@ [ AC_TRY_RUN([ #include <math.h> -#ifdef isnan +#if __GNUC__ >= 4 +# undef isnanf +# define isnanf(x) __builtin_isnanf ((float)(x)) +#elif defined isnan # undef isnanf # define isnanf(x) isnan ((float)(x)) #endif