]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix unused variable warnings
authorAlan Modra <amodra@gmail.com>
Fri, 18 Jul 2025 05:10:17 +0000 (14:40 +0930)
committerAlan Modra <amodra@gmail.com>
Fri, 18 Jul 2025 06:29:20 +0000 (15:59 +0930)
bfd/coff-mips.c
bfd/elf32-arm.c
bfd/elf32-bfin.c
bfd/elf32-csky.c
bfd/elf32-microblaze.c
bfd/elf32-nds32.c
bfd/elf64-ppc.c
bfd/elfnn-aarch64.c

index 8c4d4f7bf733b9c276c49f58190d9c6463d19b74..1213a15935874d7f6af26205019c203ccfcaaaea 100644 (file)
@@ -801,7 +801,6 @@ mips_relocate_section (bfd *output_bfd,
   bool gp_undefined;
   struct external_reloc *ext_rel;
   struct external_reloc *ext_rel_end;
-  unsigned int i;
   bool got_lo;
   struct internal_reloc lo_int_rel;
   bfd_size_type amt;
@@ -861,7 +860,7 @@ mips_relocate_section (bfd *output_bfd,
 
   ext_rel = (struct external_reloc *) external_relocs;
   ext_rel_end = ext_rel + input_section->reloc_count;
-  for (i = 0; ext_rel < ext_rel_end; ext_rel++, i++)
+  for (; ext_rel < ext_rel_end; ext_rel++)
     {
       struct internal_reloc int_rel;
       bool use_lo = false;
index a9d92ffcef9409093c5b47ab2eb754b4c24606df..e4376f0afacbcbaa761e185647f16e67b5f5c66d 100644 (file)
@@ -6527,16 +6527,15 @@ elf32_arm_size_stubs (bfd *output_bfd,
   while (1)
     {
       bfd *input_bfd;
-      unsigned int bfd_indx;
       asection *stub_sec;
       enum elf32_arm_stub_type stub_type;
       bool stub_changed = false;
       unsigned prev_num_a8_fixes = num_a8_fixes;
 
       num_a8_fixes = 0;
-      for (input_bfd = info->input_bfds, bfd_indx = 0;
+      for (input_bfd = info->input_bfds;
           input_bfd != NULL;
-          input_bfd = input_bfd->link.next, bfd_indx++)
+          input_bfd = input_bfd->link.next)
        {
          Elf_Internal_Shdr *symtab_hdr;
          asection *section;
index 69317b3f865c6f725268a362ba3e51e6936a00de..249c6b52af0df6b599e7c5ff5be4c29768936c30 100644 (file)
@@ -1376,7 +1376,6 @@ bfin_relocate_section (bfd * output_bfd,
   asection *sgot;
   Elf_Internal_Rela *rel;
   Elf_Internal_Rela *relend;
-  int i = 0;
 
   dynobj = elf_hash_table (info)->dynobj;
   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
@@ -1387,7 +1386,7 @@ bfin_relocate_section (bfd * output_bfd,
 
   rel = relocs;
   relend = relocs + input_section->reloc_count;
-  for (; rel < relend; rel++, i++)
+  for (; rel < relend; rel++)
     {
       int r_type;
       reloc_howto_type *howto;
index a03f0021dbad0742242feff6509a8903a0e29710..2a08659f06f58e832d11e4b29ebfa45f05120f92 100644 (file)
@@ -3446,13 +3446,12 @@ elf32_csky_size_stubs (bfd *output_bfd,
   while (1)
     {
       bfd *input_bfd;
-      unsigned int bfd_indx;
       asection *stub_sec;
       bool stub_changed = false;
 
-      for (input_bfd = info->input_bfds, bfd_indx = 0;
+      for (input_bfd = info->input_bfds;
           input_bfd != NULL;
-          input_bfd = input_bfd->link.next, bfd_indx++)
+          input_bfd = input_bfd->link.next)
        {
          Elf_Internal_Shdr *symtab_hdr;
          asection *section;
index 57c37c530746e630be5690abf839c5d912d9f2f8..db7ed46577940805fbf7de88ba4445e4f058b3f8 100644 (file)
@@ -1765,7 +1765,6 @@ microblaze_elf_relax_section (bfd *abfd,
   Elf_Internal_Rela *irel, *irelend;
   bfd_byte *contents = NULL;
   bfd_byte *free_contents = NULL;
-  int rel_count;
   unsigned int shndx;
   size_t i, sym_index;
   asection *o;
@@ -1818,8 +1817,7 @@ microblaze_elf_relax_section (bfd *abfd,
     goto error_return;
 
   irelend = internal_relocs + sec->reloc_count;
-  rel_count = 0;
-  for (irel = internal_relocs; irel < irelend; irel++, rel_count++)
+  for (irel = internal_relocs; irel < irelend; irel++)
     {
       bfd_vma symval;
       if ((ELF32_R_TYPE (irel->r_info) != (int) R_MICROBLAZE_64_PCREL)
@@ -1935,10 +1933,9 @@ microblaze_elf_relax_section (bfd *abfd,
   if (sdata->relax_count > 0)
     {
       shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
-      rel_count = 0;
       sdata->relax[sdata->relax_count].addr = sec->size;
 
-      for (irel = internal_relocs; irel < irelend; irel++, rel_count++)
+      for (irel = internal_relocs; irel < irelend; irel++)
        {
          bfd_vma nraddr;
 
index 3627b30af9c023e324a3c29bd58fde2325964525..bcd7c42e300ed47a7048e2b71b790f0b7eaa6024 100644 (file)
@@ -4344,7 +4344,6 @@ nds32_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       Elf_Internal_Shdr *symtab_hdr;
       asection *sgot;
       char *local_tls_type;
-      unsigned long symndx;
       bfd_vma *local_tlsdesc_gotent;
 
       if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
@@ -4386,8 +4385,8 @@ nds32_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       sgot = elf_hash_table (info)->sgot;
       local_tls_type = elf32_nds32_local_got_tls_type (ibfd);
       local_tlsdesc_gotent = elf32_nds32_local_tlsdesc_gotent (ibfd);
-      for (symndx = 0; local_got < end_local_got;
-          ++local_got, ++local_tls_type, ++local_tlsdesc_gotent, ++symndx)
+      for (; local_got < end_local_got;
+          ++local_got, ++local_tls_type, ++local_tlsdesc_gotent)
        {
          if (*local_got > 0)
            {
index 3e768dca8d6081cfe3c6166feb76728ce2a7a16a..00c1c32ffd2baa7b5b9c4b8811b789674ac942d9 100644 (file)
@@ -13819,15 +13819,14 @@ ppc64_elf_size_stubs (struct bfd_link_info *info)
   while (1)
     {
       bfd *input_bfd;
-      unsigned int bfd_indx;
       struct map_stub *group;
 
       htab->stub_iteration += 1;
       htab->relr_count = 0;
 
-      for (input_bfd = info->input_bfds, bfd_indx = 0;
+      for (input_bfd = info->input_bfds;
           input_bfd != NULL;
-          input_bfd = input_bfd->link.next, bfd_indx++)
+          input_bfd = input_bfd->link.next)
        {
          Elf_Internal_Shdr *symtab_hdr;
          asection *section;
index 0425e62c8e3a9b0aae38d6e3bbd6aba71578c6be..cec579cd455a3714dd128aa8f47ed6fd4c869def 100644 (file)
@@ -8465,10 +8465,9 @@ elfNN_aarch64_modify_headers (bfd *abfd,
                              struct bfd_link_info *info)
 {
   struct elf_segment_map *m;
-  unsigned int segment_count = 0;
   Elf_Internal_Phdr *p;
 
-  for (m = elf_seg_map (abfd); m != NULL; m = m->next, segment_count++)
+  for (m = elf_seg_map (abfd); m != NULL; m = m->next)
     {
       /* We are only interested in the memory tag segment that will be dumped
         to a core file.  If we have no memory tags or this isn't a core file we