public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Carlotti <andrew.carlotti@arm.com>
To: Nick Clifton <nickc@redhat.com>
Cc: Binutils <binutils@sourceware.org>
Subject: [PATCH] aarch64: Eliminate unused variable warnings with -DNDEBUG
Date: Tue, 23 Jan 2024 18:30:52 +0000	[thread overview]
Message-ID: <bb1e06e9-e1e6-6f74-c888-b11e8387e1d5@e124511.cambridge.arm.com> (raw)
In-Reply-To: <5ccdf111-bb4c-4dfc-b280-268c5f99cd91@redhat.com>

Ok for master and 2.42 branch?

Incidentally, while two of these sections of code were added recently, the
issue in aarch64-dis.c has been present since July 2022.


diff --git a/opcodes/aarch64-asm.c b/opcodes/aarch64-asm.c
index 565c4b10559d1800c39f118d225088da5c1c3e36..29e96e244bb2d01ec5514f5d66acc2ff0c724503 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);
diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c
index f63b74706f6da606d3df848bd722e5c2ae3f3ecb..82d2f8f8251f0f48e06a85360ebfdf258247de20 100644
--- a/opcodes/aarch64-dis.c
+++ b/opcodes/aarch64-dis.c
@@ -3686,8 +3686,9 @@ get_style_text (enum disassembler_style style)
 
       for (i = 0; i <= 0xf; ++i)
 	{
-	  int res = snprintf (&formats[i][0], sizeof (formats[i]), "%c%x%c",
-			      STYLE_MARKER_CHAR, i, STYLE_MARKER_CHAR);
+	  int res ATTRIBUTE_UNUSED
+	    = snprintf (&formats[i][0], sizeof (formats[i]), "%c%x%c",
+			STYLE_MARKER_CHAR, i, STYLE_MARKER_CHAR);
 	  assert (res == 3);
 	}
 
diff --git a/opcodes/aarch64-opc.c b/opcodes/aarch64-opc.c
index 5b76f2cfa2191fc388adf55ad174f4a1829202f3..965c1c0698c5ab97abde32cd502ae342ad9e34a1 100644
--- a/opcodes/aarch64-opc.c
+++ b/opcodes/aarch64-opc.c
@@ -3335,12 +3335,11 @@ aarch64_match_operands_constraint (aarch64_inst *inst,
 	       invalid tying and invalid qualifiers, the error about
 	       qualifiers would suggest several alternative instructions
 	       that also have invalid tying.  */
-	    enum aarch64_operand_class op_class1
+	    enum aarch64_operand_class op_class
 	       = aarch64_get_operand_class (inst->operands[0].type);
-	    enum aarch64_operand_class op_class2
-	       = aarch64_get_operand_class (inst->operands[i].type);
-	    assert (op_class1 == op_class2);
-	    if (op_class1 == AARCH64_OPND_CLASS_SVE_REGLIST
+	    assert (aarch64_get_operand_class (inst->operands[i].type)
+		    == op_class);
+	    if (op_class == AARCH64_OPND_CLASS_SVE_REGLIST
 		? ((inst->operands[0].reglist.first_regno
 		    != inst->operands[i].reglist.first_regno)
 		   || (inst->operands[0].reglist.num_regs

  reply	other threads:[~2024-01-23 18:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 17:08 Unable to build the AArch64 binutils sources with NDEBUG defined Nick Clifton
2024-01-23 18:30 ` Andrew Carlotti [this message]
2024-01-24 11:47   ` [PATCH] aarch64: Eliminate unused variable warnings with -DNDEBUG 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=bb1e06e9-e1e6-6f74-c888-b11e8387e1d5@e124511.cambridge.arm.com \
    --to=andrew.carlotti@arm.com \
    --cc=binutils@sourceware.org \
    --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).