• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisión9f27c36482d98a00d63fe76f7d740d5de4873ead (tree)
Tiempo2020-06-29 10:50:45
AutorHans-Peter Nilsson <hp@bitr...>
CommiterHans-Peter Nilsson

Log Message

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.

Cambiar Resumen

Diferencia incremental

--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
1+2020-06-29 Hans-Peter Nilsson <hp@bitrange.com>
2+
3+ * dwarf.c (display_debug_str_offsets): Rename local variable
4+ index to idx. Move to top of function.
5+
16 2020-06-29 Alan Modra <amodra@gmail.com>
27
38 * dwarf.c: Use C style comments.
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -6848,6 +6848,8 @@ static int
68486848 display_debug_str_offsets (struct dwarf_section *section,
68496849 void *file ATTRIBUTE_UNUSED)
68506850 {
6851+ unsigned long idx;
6852+
68516853 if (section->size == 0)
68526854 {
68536855 printf (_("\nThe %s section is empty.\n"), section->name);
@@ -6910,8 +6912,7 @@ display_debug_str_offsets (struct dwarf_section *section,
69106912 printf (_(" Index Offset [String]\n"));
69116913 }
69126914
6913- unsigned long index;
6914- for (index = 0; length >= entry_length && curr < end; index ++)
6915+ for (idx = 0; length >= entry_length && curr < end; idx++)
69156916 {
69166917 dwarf_vma offset;
69176918 const unsigned char * string;
@@ -6919,11 +6920,11 @@ display_debug_str_offsets (struct dwarf_section *section,
69196920 SAFE_BYTE_GET_AND_INC (offset, curr, entry_length, end);
69206921 if (dwo)
69216922 string = (const unsigned char *)
6922- fetch_indexed_string (index, NULL, entry_length, dwo);
6923+ fetch_indexed_string (idx, NULL, entry_length, dwo);
69236924 else
69246925 string = fetch_indirect_string (offset);
69256926
6926- printf (" %8lu %8s %s\n", index, dwarf_vmatoa ("x", offset),
6927+ printf (" %8lu %8s %s\n", idx, dwarf_vmatoa ("x", offset),
69276928 string);
69286929 }
69296930 }