public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Binutils <binutils@sourceware.org>
Subject: [PATCH] binutils/Dwarf: avoid "shadowing" of glibc function name
Date: Fri, 1 Dec 2023 09:49:20 +0100	[thread overview]
Message-ID: <107c2a7d-7c60-4278-8437-7bb7191c8ccb@suse.com> (raw)

Yet once again: Old enough glibc has an (unguarded) declaration of
index() in string.h, which triggers a "shadows a global declaration"
warning with at least some gcc versions.

--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -6833,7 +6833,7 @@ display_loclists_list (struct dwarf_sect
   unsigned int pointer_size;
   unsigned int offset_size;
   unsigned int dwarf_version;
-  uint64_t index;
+  uint64_t idx;
 
   /* Initialize it due to a false compiler warning.  */
   uint64_t begin = -1, vbegin = -1;
@@ -6892,28 +6892,28 @@ display_loclists_list (struct dwarf_sect
 	  break;
 
 	case DW_LLE_base_addressx:
-	  READ_ULEB (index, start, section_end);
-	  print_hex (index, pointer_size);
+	  READ_ULEB (idx, start, section_end);
+	  print_hex (idx, pointer_size);
 	  printf (_("(index into .debug_addr) "));
 	  base_address = fetch_indexed_addr
-	    (debug_info_p->addr_base + index * pointer_size, pointer_size);
+	    (debug_info_p->addr_base + idx * pointer_size, pointer_size);
 	  print_hex (base_address, pointer_size);
 	  printf (_("(base address)\n"));
 	  break;
 
 	case DW_LLE_startx_endx:
-	  READ_ULEB (index, start, section_end);
+	  READ_ULEB (idx, start, section_end);
 	  begin = fetch_indexed_addr
-	    (debug_info_p->addr_base + index * pointer_size, pointer_size);
-	  READ_ULEB (index, start, section_end);
+	    (debug_info_p->addr_base + idx * pointer_size, pointer_size);
+	  READ_ULEB (idx, start, section_end);
 	  end = fetch_indexed_addr
-	    (debug_info_p->addr_base + index * pointer_size, pointer_size);
+	    (debug_info_p->addr_base + idx * pointer_size, pointer_size);
 	  break;
 
 	case DW_LLE_startx_length:
-	  READ_ULEB (index, start, section_end);
+	  READ_ULEB (idx, start, section_end);
 	  begin = fetch_indexed_addr
-	    (debug_info_p->addr_base + index * pointer_size, pointer_size);
+	    (debug_info_p->addr_base + idx * pointer_size, pointer_size);
 	  READ_ULEB (end, start, section_end);
 	  end += begin;
 	  break;

             reply	other threads:[~2023-12-01  8:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01  8:49 Jan Beulich [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-08-05 10:31 Jan Beulich
2022-08-05 11:30 ` Nick Clifton
2022-08-05 11:59   ` Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=107c2a7d-7c60-4278-8437-7bb7191c8ccb@suse.com \
    --to=jbeulich@suse.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).