binutils/dwarf.c: Correct an `index' global shadowing error for pre-4.8 GCC
authorHans-Peter Nilsson <hp@bitrange.com>
Mon, 29 Jun 2020 01:50:45 +0000 (03:50 +0200)
committerHans-Peter Nilsson <hp@bitrange.com>
Mon, 29 Jun 2020 01:50:45 +0000 (03:50 +0200)
commit9f27c36482d98a00d63fe76f7d740d5de4873ead
treebe7aa89b55ef2125380dd0bf283ecaee6747ae14
parent07d22f648e56d7276fa7a4a73438005448c406fb
binutils/dwarf.c: Correct an `index' global shadowing error for pre-4.8 GCC

In older gcc, shadowing a function name with a local variable name is
flagged as an error, certainly a bug but which is usually worked
around in binutils:

gcc -DHAVE_CONFIG_H -I. -I$SRC/binutils  -I. -I$SRC/binutils -I../bfd -I$SRC/binutils/../bfd -I$SRC/binutils/../include -DLOCALEDIR="\"/usr/local/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -I$SRC/binutils/../zlib -g -O2 -MT dwarf.o -MD -MP -MF $depbase.Tpo -c -o dwarf.o $SRC/binutils/dwarf.c &&\
mv -f $depbase.Tpo $depbase.Po
cc1: warnings being treated as errors
$SRC/binutils/dwarf.c: In function 'display_debug_str_offsets':
$SRC/binutils/dwarf.c:6913: error: declaration of 'index' shadows a global declaration
/usr/include/string.h:309: error: shadowed declaration is here
make[4]: *** [dwarf.o] Error 1

See also GCC PR c/53066.  This is just another one that crept in since
I and others last had to use an old version.  The name "idx" was used
in the preceding function, display_debug_addr.  Also, it was declared
c99 style (after a statement in the block).  Committed as obvious.

binutils:
* dwarf.c (display_debug_str_offsets): Rename local variable
index to idx.  Move to top of function.
binutils/ChangeLog
binutils/dwarf.c
This page took 0.0307730000000001 seconds and 4 git commands to generate.