[binutils-gdb/binutils-2_45-branch] bfd: drop unused elt_no

Alan Modra amodra@sourceware.org
Sun Jul 27 23:40:10 GMT 2025


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

commit f4290b2509788d1a284d8287cf078041d427c96e
Author: Sam James <sam@gentoo.org>
Date:   Thu Jul 17 13:16:31 2025 +0100

    bfd: drop unused elt_no
    
    GCC trunk recently had improvements to its -Wunused-but-set-variable which
    picked up that elt_no isn't used at all in the end.
    
            * archive.c (_bfd_compute_and_write_armap): Drop unused elt_no.
    
    (cherry picked from commit 11153b13a56dae4ddd068ccf812ebc295783edf9)

Diff:
---
 bfd/archive.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/bfd/archive.c b/bfd/archive.c
index 8e20554d781..c61d4b12658 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -2299,7 +2299,6 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
 {
   char *first_name = NULL;
   bfd *current;
-  file_ptr elt_no = 0;
   struct orl *map = NULL;
   unsigned int orl_max = 1024;		/* Fine initial default.  */
   unsigned int orl_count = 0;
@@ -2334,7 +2333,7 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
   /* Map over each element.  */
   for (current = arch->archive_head;
        current != NULL;
-       current = current->archive_next, elt_no++)
+       current = current->archive_next)
     {
       if (bfd_check_format (current, bfd_object)
 	  && (bfd_get_file_flags (current) & HAS_SYMS) != 0)


More information about the Binutils-cvs mailing list