mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-06 07:28:44 +08:00
bfd, binutils, gas: Remove/mark unused variables
Clang generates a warning on unused (technically, written but not read thereafter) variables. By the default configuration (with "-Werror"), it causes a build failure (unless "--disable-werror" is specified). This commit adds ATTRIBUTE_UNUSED attribute to some of them, which means they are *possibly* unused (can be used but no warnings occur when unused) and removes others. bfd/ChangeLog: * elf32-lm32.c (lm32_elf_size_dynamic_sections): Mark unused rgot_count variable. * elf32-nds32.c (elf32_nds32_unify_relax_group): Remove unused count variable. * mmo.c (mmo_scan): Mark unused lineno variable. binutils/ChangeLog: * windmc.c (write_rc): Remove unused i variable. gas/ChangeLog: * config/tc-riscv.c (riscv_ip): Remove unused argnum variable. ld/ChangeLog: * pe-dll.c (generate_reloc): Remove unused bi and page_count variables.
This commit is contained in:
@ -2067,7 +2067,7 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd,
|
|||||||
struct weak_symbol_list *list_start = NULL, *list_end = NULL;
|
struct weak_symbol_list *list_start = NULL, *list_end = NULL;
|
||||||
int rgot_weak_count = 0;
|
int rgot_weak_count = 0;
|
||||||
int r32_count = 0;
|
int r32_count = 0;
|
||||||
int rgot_count = 0;
|
int rgot_count ATTRIBUTE_UNUSED = 0;
|
||||||
/* Look for deleted sections. */
|
/* Look for deleted sections. */
|
||||||
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
|
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
|
||||||
{
|
{
|
||||||
|
@ -13460,7 +13460,6 @@ elf32_nds32_unify_relax_group (bfd *abfd, asection *asec)
|
|||||||
Elf_Internal_Rela *relocs = NULL;
|
Elf_Internal_Rela *relocs = NULL;
|
||||||
enum elf_nds32_reloc_type rtype;
|
enum elf_nds32_reloc_type rtype;
|
||||||
struct section_id_list_t *node = NULL;
|
struct section_id_list_t *node = NULL;
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -13499,8 +13498,6 @@ elf32_nds32_unify_relax_group (bfd *abfd, asection *asec)
|
|||||||
|
|
||||||
/* Change it. */
|
/* Change it. */
|
||||||
rel->r_addend += relax_group_ptr->bias;
|
rel->r_addend += relax_group_ptr->bias;
|
||||||
/* Debugging count. */
|
|
||||||
count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (false);
|
while (false);
|
||||||
|
@ -1602,7 +1602,7 @@ static bool
|
|||||||
mmo_scan (bfd *abfd)
|
mmo_scan (bfd *abfd)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int lineno = 1;
|
unsigned int lineno ATTRIBUTE_UNUSED = 1;
|
||||||
bool error = false;
|
bool error = false;
|
||||||
bfd_vma vma = 0;
|
bfd_vma vma = 0;
|
||||||
asection *sec = NULL;
|
asection *sec = NULL;
|
||||||
|
@ -765,7 +765,7 @@ static void
|
|||||||
write_rc (FILE *fp)
|
write_rc (FILE *fp)
|
||||||
{
|
{
|
||||||
mc_node_lang *n;
|
mc_node_lang *n;
|
||||||
int i, l;
|
int l;
|
||||||
|
|
||||||
fprintf (fp,
|
fprintf (fp,
|
||||||
"/* Do not edit this file manually.\n"
|
"/* Do not edit this file manually.\n"
|
||||||
@ -773,12 +773,10 @@ write_rc (FILE *fp)
|
|||||||
if (! mc_nodes_lang_count)
|
if (! mc_nodes_lang_count)
|
||||||
return;
|
return;
|
||||||
n = NULL;
|
n = NULL;
|
||||||
i = 0;
|
|
||||||
for (l = 0; l < mc_nodes_lang_count; l++)
|
for (l = 0; l < mc_nodes_lang_count; l++)
|
||||||
{
|
{
|
||||||
if (n && n->lang == mc_nodes_lang[l]->lang)
|
if (n && n->lang == mc_nodes_lang[l]->lang)
|
||||||
continue;
|
continue;
|
||||||
++i;
|
|
||||||
n = mc_nodes_lang[l];
|
n = mc_nodes_lang[l];
|
||||||
fprintf (fp, "\n// Country: %s\n// Language: %s\n#pragma code_page(%u)\n",
|
fprintf (fp, "\n// Country: %s\n// Language: %s\n#pragma code_page(%u)\n",
|
||||||
n->lang->lang_info.country, n->lang->lang_info.name,
|
n->lang->lang_info.country, n->lang->lang_info.name,
|
||||||
|
@ -2303,7 +2303,6 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
|
|||||||
char save_c = 0;
|
char save_c = 0;
|
||||||
struct riscv_opcode *insn;
|
struct riscv_opcode *insn;
|
||||||
unsigned int regno;
|
unsigned int regno;
|
||||||
int argnum;
|
|
||||||
const struct percent_op_match *p;
|
const struct percent_op_match *p;
|
||||||
struct riscv_ip_error error;
|
struct riscv_ip_error error;
|
||||||
error.msg = "unrecognized opcode";
|
error.msg = "unrecognized opcode";
|
||||||
@ -2341,7 +2340,6 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
|
|||||||
error.msg = _("illegal operands");
|
error.msg = _("illegal operands");
|
||||||
error.missing_ext = NULL;
|
error.missing_ext = NULL;
|
||||||
create_insn (ip, insn);
|
create_insn (ip, insn);
|
||||||
argnum = 1;
|
|
||||||
|
|
||||||
imm_expr->X_op = O_absent;
|
imm_expr->X_op = O_absent;
|
||||||
*imm_reloc = BFD_RELOC_UNUSED;
|
*imm_reloc = BFD_RELOC_UNUSED;
|
||||||
@ -2859,7 +2857,6 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
|
|||||||
break; /* end RVV */
|
break; /* end RVV */
|
||||||
|
|
||||||
case ',':
|
case ',':
|
||||||
++argnum;
|
|
||||||
if (*asarg++ == *oparg)
|
if (*asarg++ == *oparg)
|
||||||
continue;
|
continue;
|
||||||
asarg--;
|
asarg--;
|
||||||
|
@ -1510,8 +1510,7 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info)
|
|||||||
int total_relocs = 0;
|
int total_relocs = 0;
|
||||||
int i;
|
int i;
|
||||||
bfd_vma sec_page = (bfd_vma) -1;
|
bfd_vma sec_page = (bfd_vma) -1;
|
||||||
bfd_vma page_ptr, page_count;
|
bfd_vma page_ptr;
|
||||||
int bi;
|
|
||||||
bfd *b;
|
bfd *b;
|
||||||
struct bfd_section *s;
|
struct bfd_section *s;
|
||||||
|
|
||||||
@ -1525,8 +1524,7 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info)
|
|||||||
reloc_data = xmalloc (total_relocs * sizeof (reloc_data_type));
|
reloc_data = xmalloc (total_relocs * sizeof (reloc_data_type));
|
||||||
|
|
||||||
total_relocs = 0;
|
total_relocs = 0;
|
||||||
bi = 0;
|
for (b = info->input_bfds; b; b = b->link.next)
|
||||||
for (bi = 0, b = info->input_bfds; b; bi++, b = b->link.next)
|
|
||||||
{
|
{
|
||||||
arelent **relocs;
|
arelent **relocs;
|
||||||
int relsize, nrelocs;
|
int relsize, nrelocs;
|
||||||
@ -1721,7 +1719,6 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info)
|
|||||||
sec_page = (bfd_vma) -1;
|
sec_page = (bfd_vma) -1;
|
||||||
reloc_sz = 0;
|
reloc_sz = 0;
|
||||||
page_ptr = (bfd_vma) -1;
|
page_ptr = (bfd_vma) -1;
|
||||||
page_count = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < total_relocs; i++)
|
for (i = 0; i < total_relocs; i++)
|
||||||
{
|
{
|
||||||
@ -1740,7 +1737,6 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info)
|
|||||||
page_ptr = reloc_sz;
|
page_ptr = reloc_sz;
|
||||||
reloc_sz += 8;
|
reloc_sz += 8;
|
||||||
sec_page = this_page;
|
sec_page = this_page;
|
||||||
page_count = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bfd_put_16 (abfd, (rva & 0xfff) + (reloc_data[i].type << 12),
|
bfd_put_16 (abfd, (rva & 0xfff) + (reloc_data[i].type << 12),
|
||||||
@ -1753,7 +1749,6 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info)
|
|||||||
reloc_sz += 2;
|
reloc_sz += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
page_count++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (reloc_sz & 3)
|
while (reloc_sz & 3)
|
||||||
|
Reference in New Issue
Block a user