public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: Andrew Carlotti <andrew.carlotti@arm.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Unable to build the AArch64 binutils sources with NDEBUG defined
Date: Mon, 22 Jan 2024 17:08:22 +0000	[thread overview]
Message-ID: <5ccdf111-bb4c-4dfc-b280-268c5f99cd91@redhat.com> (raw)

Hi Andrew,

   Sorry for picking on you with an AArch64 build problem,
   but you seem to active in the sources at the moment and
   this should not be a big issue to solve:

   If you build the AArch64 binutils sources with NDEBUG defined,
   the assert() function call becomes a no-op and this in turn
   leads to some compile time warnings about unused variables.
   Since we treat compile time warnings as errors, this means
   that the build fails.  For example:

   $ .../configure --quiet --target=aarch64-linux-gnu CFLAGS="-O2 -g -DNDEBUG"
   $ make all-binutils
   [...]
   opcodes/aarch64-asm.c: In function 'aarch64_ins_sve_strided_reglist':
   opcodes/aarch64-asm.c:1328:16: error: unused variable 'mask' [-Werror=unused-variable]

   There are a couple more like this.

   Fixing them is either a case of replacing the assert() with an "if () return <fail>"
   type statement, or marking the variable as possibly unused:

diff --git a/opcodes/aarch64-asm.c b/opcodes/aarch64-asm.c
index 565c4b10559..29e96e244bb 100644
--- a/opcodes/aarch64-asm.c
+++ b/opcodes/aarch64-asm.c
@@ -1325,7 +1325,7 @@ aarch64_ins_sve_strided_reglist (const aarch64_operand *self,
                                    ATTRIBUTE_UNUSED)
  {
    unsigned int num_regs = get_operand_specific_data (self);
-  unsigned int mask = 16 | (16 / num_regs - 1);
+  unsigned int mask ATTRIBUTE_UNUSED = 16 | (16 / num_regs - 1);
    unsigned int val = info->reglist.first_regno;
    assert ((val & mask) == val);
    insert_field (self->fields[0], code, val >> 4, 0);

   If you do not have the time to look into this issue, please let me know
   and I will fix the problems myself.

Cheers
   Nick


             reply	other threads:[~2024-01-22 17:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 17:08 Nick Clifton [this message]
2024-01-23 18:30 ` [PATCH] aarch64: Eliminate unused variable warnings with -DNDEBUG Andrew Carlotti
2024-01-24 11:47   ` 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=5ccdf111-bb4c-4dfc-b280-268c5f99cd91@redhat.com \
    --to=nickc@redhat.com \
    --cc=andrew.carlotti@arm.com \
    --cc=binutils@sourceware.org \
    /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).