[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: vasnprintf.c shadowing warnings cause "make distcheck" failure
From: |
Bruno Haible |
Subject: |
Re: vasnprintf.c shadowing warnings cause "make distcheck" failure |
Date: |
Sat, 17 May 2008 02:40:40 +0200 |
User-agent: |
KMail/1.5.4 |
Jim Meyering wrote:
> vasnprintf.c uses variables named exp and remainder, and they shadow
> math functions. This poses a problem for me, since coreutils' "make
> distcheck" requires a clean build with -Werror -Wshadow.
Ouch. It's a pity that "gcc -Wshadow" has a useful part (when it warns about
two variables inside a single function) and a useless part (when the outer
identifier comes from a global declaration in an include file), and gcc
does not offer to get the useful part alone.
> Bruno, any objection to this change?
The added lines come too early (in line 88, but <math.h> is included in
line 144). It lacks comments. And the identifiers that you chose will
not be available by tab-completion to the developer whose debugs in gdb.
I'm applying this instead:
2008-05-16 Jim Meyering <address@hidden>
Bruno Haible <address@hidden>
Avoid some warnings from "gcc -Wshadow".
* lib/vasnprintf.c (exp, remainder): Define to different identifiers.
*** lib/vasnprintf.c.orig 2008-05-17 02:33:17.000000000 +0200
--- lib/vasnprintf.c 2008-05-17 02:32:13.000000000 +0200
***************
*** 200,205 ****
--- 200,212 ----
/* Here we need to call the native sprintf, not rpl_sprintf. */
#undef sprintf
+ /* Avoid some warnings from "gcc -Wshadow".
+ This file doesn't use the exp() and remainder() functions. */
+ #undef exp
+ #define exp expo
+ #undef remainder
+ #define remainder rem
+
#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE
|| NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL
/* Determine the decimal-point character according to the current locale. */
# ifndef decimal_point_char_defined