Jim Meyering wrote: > printf-frexp.c evokes a shadowing warning on at least a debian unstable > system, and now that coreutils uses it (via vasprintf-posix), it causes > the "make distcheck" build to fail: > > printf-frexp.c: In function 'printf_frexp': > printf-frexp.c:65: error: declaration of 'exp' shadows a global declaration > /usr/include/bits/mathcalls.h:101: error: shadowed declaration is here > make[5]: *** [printf-frexp.o] Error 1
As always, I remind that gnulib does not support "gcc -Werror". But since it's about coreutils and since the parameter name here is a misnomer anyway, I'm applying this: 2007-10-07 Bruno Haible <[EMAIL PROTECTED]> Avoid gcc warnings "declaration of 'exp' shadows a global declaration". * lib/math.in.h (frexp, frexpl): Change parameter name to 'expptr'. * lib/frexp.c (FUNC): Likewise. * lib/printf-frexp.h (printf_frexp): Likewise. * lib/printf-frexpl.h (printf_frexpl): Likewise. * lib/printf-frexp.c (FUNC): Likewise. Suggested by Jim Meyering. --- lib/frexp.c.orig 2007-10-07 22:08:43.000000000 +0200 +++ lib/frexp.c 2007-10-07 22:03:39.000000000 +0200 @@ -53,7 +53,7 @@ #endif DOUBLE -FUNC (DOUBLE x, int *exp) +FUNC (DOUBLE x, int *expptr) { int sign; int exponent; @@ -62,7 +62,7 @@ /* Test for NaN, infinity, and zero. */ if (ISNAN (x) || x + x == x) { - *exp = 0; + *expptr = 0; return x; } @@ -161,6 +161,6 @@ END_ROUNDING (); - *exp = exponent; + *expptr = exponent; return x; } --- lib/math.in.h.orig 2007-10-07 22:08:43.000000000 +0200 +++ lib/math.in.h 2007-10-07 22:08:35.000000000 +0200 @@ -38,11 +38,11 @@ If x finite and nonzero: 0.5 <= |mantissa| < 1.0. If x is zero: mantissa = x, exp = 0. If x is infinite or NaN: mantissa = x, exp unspecified. - Store exp and return mantissa. */ + Store exp in *EXPPTR and return mantissa. */ #if @GNULIB_FREXP@ # if @REPLACE_FREXP@ # define frexp rpl_frexp -extern double frexp (double x, int *exp); +extern double frexp (double x, int *expptr); # endif #elif defined GNULIB_POSIXCHECK # undef frexp @@ -173,12 +173,12 @@ If x finite and nonzero: 0.5 <= |mantissa| < 1.0. If x is zero: mantissa = x, exp = 0. If x is infinite or NaN: mantissa = x, exp unspecified. - Store exp and return mantissa. */ + Store exp in *EXPPTR and return mantissa. */ #if @GNULIB_FREXPL@ && @REPLACE_FREXPL@ # define frexpl rpl_frexpl #endif #if (@GNULIB_FREXPL@ && @REPLACE_FREXPL@) || [EMAIL PROTECTED]@ -extern long double frexpl (long double x, int *exp); +extern long double frexpl (long double x, int *expptr); #endif #if [EMAIL PROTECTED]@ && defined GNULIB_POSIXCHECK # undef frexpl --- lib/printf-frexp.c.orig 2007-10-07 22:08:43.000000000 +0200 +++ lib/printf-frexp.c 2007-10-07 22:03:46.000000000 +0200 @@ -62,7 +62,7 @@ #endif DOUBLE -FUNC (DOUBLE x, int *exp) +FUNC (DOUBLE x, int *expptr) { int exponent; DECL_ROUNDING @@ -183,6 +183,6 @@ END_ROUNDING (); - *exp = exponent; + *expptr = exponent; return x; } --- lib/printf-frexp.h.orig 2007-10-07 22:08:43.000000000 +0200 +++ lib/printf-frexp.h 2007-10-07 22:02:53.000000000 +0200 @@ -19,5 +19,5 @@ where exp >= DBL_MIN_EXP - 1, mantissa < 2.0, if x is not a denormalized number then mantissa >= 1.0. - Store exp and return mantissa. */ -extern double printf_frexp (double x, int *exp); + Store exp in *EXPPTR and return mantissa. */ +extern double printf_frexp (double x, int *expptr); --- lib/printf-frexpl.h.orig 2007-10-07 22:08:43.000000000 +0200 +++ lib/printf-frexpl.h 2007-10-07 22:03:11.000000000 +0200 @@ -19,5 +19,5 @@ where exp >= LDBL_MIN_EXP - 1, mantissa < 2.0, if x is not a denormalized number then mantissa >= 1.0. - Store exp and return mantissa. */ -extern long double printf_frexpl (long double x, int *exp); + Store exp in *EXPPTR and return mantissa. */ +extern long double printf_frexpl (long double x, int *expptr);