[binutils-gdb/binutils-2_31-branch] BFD/ELF: Correct a `remove' global shadowing error for pre-4.8 GCC

Maciej W.Rozycki macro@sourceware.org
Tue Jul 10 23:47:00 GMT 2018


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=df402ddcce738ad2ef24ec7c86611a59ef217fdd

commit df402ddcce738ad2ef24ec7c86611a59ef217fdd
Author: Maciej W. Rozycki <macro@mips.com>
Date:   Wed Jul 11 00:42:43 2018 +0100

    BFD/ELF: Correct a `remove' global shadowing error for pre-4.8 GCC
    
    Remove `-Wshadow' compilation errors:
    
    cc1: warnings being treated as errors
    .../bfd/elflink.c: In function 'bfd_elf_final_link':
    .../bfd/elflink.c:11722: error: declaration of 'remove' shadows a global declaration
    /usr/include/stdio.h:154: error: shadowed declaration is here
    
    which for versions of GCC before 4.8 prevent support for ELF targets
    from being built.  See also GCC PR c/53066.
    
    	bfd/
    	* elflink.c (bfd_elf_final_link): Rename `remove' local variable
    	to `remove_section'.
    
    (cherry picked from commit 5270eddc6ed6b5d8e4e2817491bb44b784fa6f81)

Diff:
---
 bfd/ChangeLog | 5 +++++
 bfd/elflink.c | 8 ++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index d79eb23..f643c80 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-10  Maciej W. Rozycki  <macro@mips.com>
+
+	* elflink.c (bfd_elf_final_link): Rename `remove' local variable
+	to `remove_section'.
+
 2018-07-09  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR ld/23388
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 138efac..eb3b619 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -11715,7 +11715,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
   std_attrs_section = get_elf_backend_data (abfd)->obj_attrs_section;
   for (o = abfd->sections; o != NULL; o = o->next)
     {
-      bfd_boolean remove = FALSE;
+      bfd_boolean remove_section = FALSE;
 
       if ((std_attrs_section && strcmp (o->name, std_attrs_section) == 0)
 	  || strcmp (o->name, ".gnu.attributes") == 0)
@@ -11739,14 +11739,14 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
 	  if (attr_size)
 	    attr_section = o;
 	  else
-	    remove = TRUE;
+	    remove_section = TRUE;
 	}
       else if ((o->flags & SEC_GROUP) != 0 && o->size == 0)
 	{
 	  /* Remove empty group section from linker output.  */
-	  remove = TRUE;
+	  remove_section = TRUE;
 	}
-      if (remove)
+      if (remove_section)
 	{
 	  o->flags |= SEC_EXCLUDE;
 	  bfd_section_list_remove (abfd, o);



More information about the Binutils-cvs mailing list