public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Tsukasa OI <research_trasio@irq.a4lg.com>
Cc: binutils@sourceware.org, Nick Clifton <nickc@redhat.com>,
	Ian Lance Taylor <ian@airs.com>, Nelson Chu <nelson@rivosinc.com>
Subject: Re: [PATCH 1/1] bfd, binutils, gas: Mark unused variables
Date: Thu, 15 Sep 2022 09:29:27 +0200	[thread overview]
Message-ID: <73538f81-579a-d712-9f34-84170a437491@suse.com> (raw)
In-Reply-To: <41d8346fa386205b021320b71b3db50898c27bd7.1663215243.git.research_trasio@irq.a4lg.com>

On 15.09.2022 06:17, Tsukasa OI via Binutils wrote:
> 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).

May I ask why you chose to do so? I can see such a variable being consumed
inside an #ifdef, but being declared unconditionally as a reason, but
(looking just at code I'm a little familiar with) ...

> --- 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";
> --- 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;
>  

... in both of these cases there's truly no reading of the values,
so I don't see why they would need maintaining.

Jan

  reply	other threads:[~2022-09-15  7:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-15  3:09 [PATCH 0/1] " Tsukasa OI
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 [this message]
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=73538f81-579a-d712-9f34-84170a437491@suse.com \
    --to=jbeulich@suse.com \
    --cc=binutils@sourceware.org \
    --cc=ian@airs.com \
    --cc=nelson@rivosinc.com \
    --cc=nickc@redhat.com \
    --cc=research_trasio@irq.a4lg.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).