diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-12-03 16:31:09 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-12-14 08:47:48 -0500 |
commit | 9bc8e54b1f1c281c7a4ecf49a4e9300e334beb0a (patch) | |
tree | a14d07055ccb22a4858f58147c5492ca55460425 /bfd/ecofflink.c | |
parent | 78d4da9ae0d3447f28274a00b278f58ca7d8d1b2 (diff) | |
download | gdb-9bc8e54b1f1c281c7a4ecf49a4e9300e334beb0a.zip gdb-9bc8e54b1f1c281c7a4ecf49a4e9300e334beb0a.tar.gz gdb-9bc8e54b1f1c281c7a4ecf49a4e9300e334beb0a.tar.bz2 |
bfd: fix -Wunused errors with clang 13+
Clang 13 and 14 produce some -Wunused-but-set-{variable,parameter} for
situations where gcc doesn't. In particular, when a variable is set and
then used in a way to update its own value. For example, if `i` is only
used in this way:
int i = 2;
i++;
i = i + 1;
gcc won't warn, but clang will.
Fix all such errors found in an --enable-targets=all build. It would be
important for somebody who knows what they're doing to just make sure
that these variables can indeed be deleted, and that there a no cases
where it's a bug, and the variable should actually be used.
The first instance of this error fix by this patch is:
CC elf32-score.lo
/home/simark/src/binutils-gdb/bfd/elf32-score.c:450:11: error: variable 'relocation' set but not used [-Werror,-Wunused-but-set-variable]
bfd_vma relocation;
^
Change-Id: I2f233ce20352645cf388aff3dfa08a651d21a6b6
Diffstat (limited to 'bfd/ecofflink.c')
-rw-r--r-- | bfd/ecofflink.c | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c index 9f72409..44cb1f3 100644 --- a/bfd/ecofflink.c +++ b/bfd/ecofflink.c @@ -2402,9 +2402,6 @@ _bfd_ecoff_locate_line (bfd *abfd, static bool ecoff_collect_shuffle (struct shuffle *l, bfd_byte *buff) { - unsigned long total; - - total = 0; for (; l != (struct shuffle *) NULL; l = l->next) { if (! l->filep) @@ -2416,7 +2413,6 @@ ecoff_collect_shuffle (struct shuffle *l, bfd_byte *buff) != l->size)) return false; } - total += l->size; buff += l->size; } @@ -2451,13 +2447,11 @@ _bfd_ecoff_get_accumulated_ss (void * handle, bfd_byte *buff) { struct accumulate *ainfo = (struct accumulate *) handle; struct string_hash_entry *sh; - unsigned long total; /* The string table is written out from the hash table if this is a final link. */ BFD_ASSERT (ainfo->ss == (struct shuffle *) NULL); *buff++ = '\0'; - total = 1; BFD_ASSERT (ainfo->ss_hash == NULL || ainfo->ss_hash->val == 1); for (sh = ainfo->ss_hash; sh != (struct string_hash_entry *) NULL; @@ -2467,7 +2461,6 @@ _bfd_ecoff_get_accumulated_ss (void * handle, bfd_byte *buff) len = strlen (sh->root.string); memcpy (buff, sh->root.string, len + 1); - total += len + 1; buff += len + 1; } |