Paul Eggert wrote:
I ran into the following minor glitch when compiling coreutils 6.10 on
Solaris 8 sparc with GCC 4.2.2:
vasnprintf.c: In function 'vasnprintf':
vasnprintf.c:2196: warning: implicit declaration of function 'signbit'
Thanks for reporting this.
Here is a patch to the gnulib signbit module to work around this
problem:
2008-01-24 Paul Eggert [EMAIL PROTECTED]
* m4/signbit.m4 (gl_SIGNBIT): Check that signbit is a macro.
This suppresses a warning when compiling coreutils 6.10 with
GCC 4.2.2 on Solaris 8. In that combination, math.h does not
define signbit, but GCC implements it internally (there is no
library function) and issues a warning.
If GCC implements it as a built-in, with your patch, we'll reject the
built-in and provide substitutes in the form of functions. But it's
more efficient to use the GCC built-ins then. The warning goes away
if one uses __builtin_signbit instead of signbit.
I'm applying this:
2008-01-25 Paul Eggert [EMAIL PROTECTED]
Bruno Haible [EMAIL PROTECTED]
* m4/signbit.m4 (gl_SIGNBIT): Require a macro definition. Test whether
the GCC builtins for signbits are present and set
REPLACE_SIGNBIT_USING_GCC if so.
* lib/math.in.h (signbit): Define using GCC builtins if
REPLACE_SIGNBIT_USING_GCC is set.
* m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize
REPLACE_SIGNBIT_USING_GCC.
* modules/math (Makefile.am): Substitute REPLACE_SIGNBIT_USING_GCC.
*** lib/math.in.h.orig 2008-01-26 02:25:45.0 +0100
--- lib/math.in.h 2008-01-26 00:41:20.0 +0100
***
*** 353,358
--- 353,366
#if @GNULIB_SIGNBIT@
+ # if @REPLACE_SIGNBIT_USING_GCC@
+ # undef signbit
+/* GCC 4.0 and newer provides three built-ins for signbit. */
+ # define signbit(x) \
+(sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \
+ sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \
+ __builtin_signbitf (x))
+ # endif
# if @REPLACE_SIGNBIT@
# undef signbit
extern int gl_signbitf (float arg);
*** m4/math_h.m4.orig 2008-01-26 02:25:45.0 +0100
--- m4/math_h.m42008-01-26 00:40:25.0 +0100
***
*** 1,5
! # math_h.m4 serial 8
! dnl Copyright (C) 2007 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.
--- 1,5
! # math_h.m4 serial 9
! 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.
***
*** 36,65
GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF])
GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL])
dnl Assume proper GNU behavior unless another module says otherwise.
! HAVE_DECL_ACOSL=1;AC_SUBST([HAVE_DECL_ACOSL])
! HAVE_DECL_ASINL=1;AC_SUBST([HAVE_DECL_ASINL])
! HAVE_DECL_ATANL=1;AC_SUBST([HAVE_DECL_ATANL])
! HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL])
! HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL])
! HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL])
! HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL])
! HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL])
! HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL])
! HAVE_DECL_SQRTL=1;AC_SUBST([HAVE_DECL_SQRTL])
! HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL])
! HAVE_DECL_TRUNC=1;AC_SUBST([HAVE_DECL_TRUNC])
! HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF])
! HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL])
! REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF])
! REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL])
! REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF])
! REPLACE_FLOORL=0; AC_SUBST([REPLACE_FLOORL])
! REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP])
! REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL])
! REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE])
! REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL])
! REPLACE_ROUND=0; AC_SUBST([REPLACE_ROUND])
! REPLACE_ROUNDF=0; AC_SUBST([REPLACE_ROUNDF])
! REPLACE_ROUNDL=0; AC_SUBST([REPLACE_ROUNDL])
! REPLACE_SIGNBIT=0;AC_SUBST([REPLACE_SIGNBIT])
])
--- 36,66
GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF])
GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL])
dnl Assume proper GNU behavior unless another module says otherwise.
! HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL])
! HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL])
! HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL])
! HAVE_DECL_COSL=1;AC_SUBST([HAVE_DECL_COSL])
! HAVE_DECL_EXPL=1;AC_SUBST([HAVE_DECL_EXPL])
! HAVE_DECL_FREXPL=1;