From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender-0.a4lg.com [IPv6:2401:2500:203:30b:4000:6bfe:4757:0]) by sourceware.org (Postfix) with ESMTPS id 2BA55385737B for ; Thu, 15 Sep 2022 04:18:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2BA55385737B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=irq.a4lg.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=irq.a4lg.com Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id D8A0B30008A; Thu, 15 Sep 2022 04:18:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1663215490; bh=OHe9gCMxNPBxD1R16zvSY/F95ekejApkeiEE2RA/Cvs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Mime-Version:Content-Transfer-Encoding; b=rD2Zt7UPvegmxV1WDuRmWhzr2/BHNWu5m+Jd/qS+e/pgbVHYzPqK8/OPk/MJANGkm gHdOni3JgU2atvLqRq9ZLVUmu481FgykHdWCKDKXh16J4MHOftfp08mStcYlmMQFKr +vTG5Tqzw7FyZBRrl9jViOmfA+QHWfeSU/VuIRkA= From: Tsukasa OI To: Tsukasa OI , Nick Clifton , Ian Lance Taylor , Nelson Chu Cc: binutils@sourceware.org Subject: [PATCH 1/1] bfd, binutils, gas: Mark unused variables Date: Thu, 15 Sep 2022 04:17:56 +0000 Message-Id: <41d8346fa386205b021320b71b3db50898c27bd7.1663215243.git.research_trasio@irq.a4lg.com> In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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, instead of just removing those variables, adds ATTRIBUTE_UNUSED attribute to them, which means they are *possibly* unused (can be used but no warnings occur when unused). bfd/ChangeLog: * elf32-lm32.c (lm32_elf_size_dynamic_sections): Mark unused rgot_count variable. * elf32-nds32.c (elf32_nds32_unify_relax_group): Mark unused count variable. * mmo.c (mmo_scan): Mark unused lineno variable. binutils/ChangeLog: * windmc.c (write_rc): Mark unused i variable. gas/ChangeLog: * config/tc-riscv.c (riscv_ip): Mark unused argnum variable. ld/ChangeLog: * pe-dll.c (generate_reloc): Mark unused bi and page_count variables. --- bfd/elf32-lm32.c | 2 +- bfd/elf32-nds32.c | 2 +- bfd/mmo.c | 2 +- binutils/windmc.c | 3 ++- gas/config/tc-riscv.c | 2 +- ld/pe-dll.c | 5 +++-- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c index 4830ab21dfa..64b3edef466 100644 --- a/bfd/elf32-lm32.c +++ b/bfd/elf32-lm32.c @@ -2067,7 +2067,7 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd, struct weak_symbol_list *list_start = NULL, *list_end = NULL; int rgot_weak_count = 0; int r32_count = 0; - int rgot_count = 0; + int rgot_count ATTRIBUTE_UNUSED = 0; /* Look for deleted sections. */ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next) { diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c index 82c20592d6d..5d2eb62ffe3 100644 --- a/bfd/elf32-nds32.c +++ b/bfd/elf32-nds32.c @@ -13460,7 +13460,7 @@ elf32_nds32_unify_relax_group (bfd *abfd, asection *asec) Elf_Internal_Rela *relocs = NULL; enum elf_nds32_reloc_type rtype; struct section_id_list_t *node = NULL; - int count = 0; + int count ATTRIBUTE_UNUSED = 0; do { diff --git a/bfd/mmo.c b/bfd/mmo.c index fd92a346bc7..ddcdd35a15f 100644 --- a/bfd/mmo.c +++ b/bfd/mmo.c @@ -1602,7 +1602,7 @@ static bool mmo_scan (bfd *abfd) { unsigned int i; - unsigned int lineno = 1; + unsigned int lineno ATTRIBUTE_UNUSED = 1; bool error = false; bfd_vma vma = 0; asection *sec = NULL; diff --git a/binutils/windmc.c b/binutils/windmc.c index b47da91f1bb..9cb30c0ddfd 100644 --- a/binutils/windmc.c +++ b/binutils/windmc.c @@ -765,7 +765,8 @@ static void write_rc (FILE *fp) { mc_node_lang *n; - int i, l; + int l; + int i ATTRIBUTE_UNUSED; fprintf (fp, "/* Do not edit this file manually.\n" diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index df2e201fb74..509cd2ed624 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -2303,7 +2303,7 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr, char save_c = 0; struct riscv_opcode *insn; unsigned int regno; - int argnum; + int argnum ATTRIBUTE_UNUSED; const struct percent_op_match *p; struct riscv_ip_error error; error.msg = "unrecognized opcode"; diff --git a/ld/pe-dll.c b/ld/pe-dll.c index 92c33f528c8..ae7f3d8328c 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -1510,8 +1510,9 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info) int total_relocs = 0; int i; bfd_vma sec_page = (bfd_vma) -1; - bfd_vma page_ptr, page_count; - int bi; + bfd_vma page_ptr; + bfd_vma page_count ATTRIBUTE_UNUSED; + int bi ATTRIBUTE_UNUSED; bfd *b; struct bfd_section *s; -- 2.34.1