public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] binutils/Dwarf: avoid "shadowing" of glibc function name
@ 2022-08-05 10:31 Jan Beulich
  2022-08-05 11:30 ` Nick Clifton
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2022-08-05 10:31 UTC (permalink / raw)
  To: Binutils, Nick Clifton

As before: Old enough glibc has an (unguarded) declaration of index()
in string.h, which triggers a "shadows a global declaration" warning.
---
I'm going to commit this shortly. Nick - I think this will want going
on the 2.39 branch as well, unless you've closed that already.

--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -2773,7 +2773,7 @@ read_and_display_attr_value (unsigned lo
     case DW_FORM_rnglistx:
       if (!do_loc)
 	{
-	  dwarf_vma base, index;
+	  dwarf_vma base, idx;
 	  const char *suffix = strrchr (section->name, '.');
 	  bool dwo = suffix && strcmp (suffix, ".dwo") == 0;
 
@@ -2781,29 +2781,29 @@ read_and_display_attr_value (unsigned lo
 	    {
 	      if (dwo)
 		{
-		  index = fetch_indexed_value (uvalue, loclists_dwo, 0);
-		  index += (offset_size == 8) ? 20 : 12;
+		  idx = fetch_indexed_value (uvalue, loclists_dwo, 0);
+		  idx += (offset_size == 8) ? 20 : 12;
 		}
 	      else if (debug_info_p == NULL)
 		{
-		  index = fetch_indexed_value (uvalue, loclists, 0);
+		  idx = fetch_indexed_value (uvalue, loclists, 0);
 		}
 	      else
 		{
 		  /* We want to compute:
-		       index = fetch_indexed_value (uvalue, loclists, debug_info_p->loclists_base);
-		       index += debug_info_p->loclists_base;
+		       idx = fetch_indexed_value (uvalue, loclists, debug_info_p->loclists_base);
+		       idx += debug_info_p->loclists_base;
 		      Fortunately we already have that sum cached in the
 		      loc_offsets array.  */
-		  index = debug_info_p->loc_offsets [uvalue];
+		  idx = debug_info_p->loc_offsets [uvalue];
 		}
 	    }
 	  else if (form == DW_FORM_rnglistx)
 	    {
 	      if (dwo)
 		{
-		  index = fetch_indexed_value (uvalue, rnglists_dwo, 0);
-		  index += (offset_size == 8) ? 20 : 12;
+		  idx = fetch_indexed_value (uvalue, rnglists_dwo, 0);
+		  idx += (offset_size == 8) ? 20 : 12;
 		}
 	      else
 		{
@@ -2813,8 +2813,8 @@ read_and_display_attr_value (unsigned lo
 		    base = debug_info_p->rnglists_base;
 		  /* We do not have a cached value this time, so we perform the
 		     computation manually.  */
-		  index = fetch_indexed_value (uvalue, rnglists, base);
-		  index += base;
+		  idx = fetch_indexed_value (uvalue, rnglists, base);
+		  idx += base;
 		}
 	    }
 	  else
@@ -2827,13 +2827,13 @@ read_and_display_attr_value (unsigned lo
 		base = debug_info_p->addr_base;
 
 	      base += uvalue * pointer_size;
-	      index = fetch_indexed_addr (base, pointer_size);
+	      idx = fetch_indexed_addr (base, pointer_size);
 	    }
 
 	  /* We have already displayed the form name.  */
 	  printf (_("%c(index: 0x%s): %s"), delimiter,
 		  dwarf_vmatoa ("x", uvalue),
-		  dwarf_vmatoa ("x", index));
+		  dwarf_vmatoa ("x", idx));
 	}
       break;
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] binutils/Dwarf: avoid "shadowing" of glibc function name
  2022-08-05 10:31 [PATCH] binutils/Dwarf: avoid "shadowing" of glibc function name Jan Beulich
@ 2022-08-05 11:30 ` Nick Clifton
  2022-08-05 11:59   ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Clifton @ 2022-08-05 11:30 UTC (permalink / raw)
  To: Jan Beulich, Binutils

Hi Jan,

> I'm going to commit this shortly. Nick - I think this will want going
> on the 2.39 branch as well, unless you've closed that already.

Ah - I have already started uploading the release tarballs...

Feel free to apply the patch to the branch though.  If we need to make
a 2.39.1 release then it would be good to have it in.

Cheers
   Nick


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] binutils/Dwarf: avoid "shadowing" of glibc function name
  2022-08-05 11:30 ` Nick Clifton
@ 2022-08-05 11:59   ` Alan Modra
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Modra @ 2022-08-05 11:59 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Jan Beulich, Binutils

On Fri, Aug 05, 2022 at 12:30:42PM +0100, Nick Clifton via Binutils wrote:
> Hi Jan,
> 
> > I'm going to commit this shortly. Nick - I think this will want going
> > on the 2.39 branch as well, unless you've closed that already.
> 
> Ah - I have already started uploading the release tarballs...
> 
> Feel free to apply the patch to the branch though.  If we need to make
> a 2.39.1 release then it would be good to have it in.

--disable-werror is the default for released code, and Nick did
set bfd/development.sh to make that happen.  So the shadow warning
will not cause a build error.

The two patches I committed today don't matter too much either.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] binutils/Dwarf: avoid "shadowing" of glibc function name
@ 2023-12-01  8:49 Jan Beulich
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2023-12-01  8:49 UTC (permalink / raw)
  To: Binutils

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;

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-12-01  8:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-05 10:31 [PATCH] binutils/Dwarf: avoid "shadowing" of glibc function name Jan Beulich
2022-08-05 11:30 ` Nick Clifton
2022-08-05 11:59   ` Alan Modra
2023-12-01  8:49 Jan Beulich

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).