From: Tsukasa OI <research_trasio@irq.a4lg.com>
To: Tsukasa OI <research_trasio@irq.a4lg.com>,
Nick Clifton <nickc@redhat.com>, Ian Lance Taylor <ian@airs.com>,
Nelson Chu <nelson@rivosinc.com>
Cc: binutils@sourceware.org
Subject: [PATCH 0/1] bfd, binutils, gas: Mark unused variables
Date: Thu, 15 Sep 2022 03:09:26 +0000 [thread overview]
Message-ID: <cover.1663211266.git.research_trasio@irq.a4lg.com> (raw)
Hello,
[Common Background: Building GNU Binutils / GDB with Clang 15.0.0]
I'm now testing to build GNU Binutils / GDB with latest Clang (15.0.0) and
found some errors by default (when Binutils / GDB is not configured with
"--disable-werror").
While the best compiler to build GNU Binutils / GDB is GNU GCC, testing
other compilers are helpful to discover underlying problems and modernize
Binutils / GDB, even if building entire Binutils / GDB with the latest Clang
is unrealistic. To be sure, I'm not going to finish "porting for Clang".
I will take low-hanging fruits and...
1. make building with Clang easier and/or
2. fix code issues (or non-issues) discovered as Clang warnings.
I made four patchsets in which, applying them all makes it possible to
build GNU Binutils / GDB with Clang (without help of --disable-werrors) for
many (but not all) targets including i386 and RISC-V with Ubuntu 22.04 LTS
(x86_64) host. At least, I think they fix all (at minimum, most of) arch-
independent parts which prevents building with the latest version of Clang.
This is the one of them.
[About this Patchset]
Clang generates a warning on "written but not read thereafter" varibles
("-Wset-but-unused-variable"), making the build failure.
We could just remove practically unused variables but instead I chose to
keep it but with ATTRIBUTE_UNUSED. This is because the most of such
variables may have possible uses in the future.
ATTRIBUTE_UNUSED (__attribute__((unused))) marks a variable *possibly
unused* and suppresses warnings about "written but not read thereafter"
or just "unused" variables. Note that it only means a variable is "possibly
unused". Even if a variable with this attribute is "used", it's completely
safe (removing the attribute when a variable is started to be used is
definitely better, though).
Thanks,
Tsukasa
Tsukasa OI (1):
bfd, binutils, gas: Mark unused variables
bfd/elf32-lm32.c | 5 +----
bfd/elf32-nds32.c | 4 +---
bfd/mmo.c | 7 +------
binutils/windmc.c | 5 ++---
gas/config/tc-riscv.c | 4 +---
ld/pe-dll.c | 11 ++++-------
6 files changed, 10 insertions(+), 26 deletions(-)
base-commit: fe39ffdc202f04397f31557f17170b40bc42b77a
--
2.34.1
next reply other threads:[~2022-09-15 3:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-15 3:09 Tsukasa OI [this message]
2022-09-15 3:09 ` [PATCH 1/1] " Tsukasa OI
2022-09-15 4:17 ` [PATCH 0/1] " Tsukasa OI
2022-09-15 4:17 ` [PATCH 1/1] " Tsukasa OI
2022-09-15 7:29 ` Jan Beulich
2022-09-15 8:25 ` Tsukasa OI
2022-09-15 23:10 ` Hans-Peter Nilsson
2022-09-15 12:46 ` [PATCH v3 0/1] bfd, binutils, gas: Remove/mark " Tsukasa OI
2022-09-15 12:46 ` [PATCH v3 1/1] " Tsukasa OI
2022-09-15 12:58 ` Jan Beulich
2022-09-20 12:50 ` Nick Clifton
2022-09-21 5:54 ` Tsukasa OI
2022-09-21 6:15 ` Jan Beulich
2022-09-21 9:55 ` Nick Clifton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1663211266.git.research_trasio@irq.a4lg.com \
--to=research_trasio@irq.a4lg.com \
--cc=binutils@sourceware.org \
--cc=ian@airs.com \
--cc=nelson@rivosinc.com \
--cc=nickc@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).