public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] sim: mark local insn var as unused [PR sim/31181]
@ 2023-12-21  4:28 Mike Frysinger
  2023-12-22  0:40 ` [PATCH v2] " Mike Frysinger
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2023-12-21  4:28 UTC (permalink / raw)
  To: cgen

Some insns are fully decoded by the time they execute here, and don't
need to extract any more fields.  This leads to the local insn var
being unused which triggers compiler warnings.  Mark it as unused so
we don't require ports to stub it themselves.

Bug: https://sourceware.org/PR31181
---
 sim-decode.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sim-decode.scm b/sim-decode.scm
index 19c0d4677424..2c276a77046b 100644
--- a/sim-decode.scm
+++ b/sim-decode.scm
@@ -436,7 +436,13 @@ void
    "    const IDESC *idesc = &" IDESC-TABLE-VAR "[itype];\n"
    (if (> (length (sfmt-iflds sfmt)) 0)
        (string-append
-	"    CGEN_INSN_WORD insn = "
+	"    "
+	; Some insns are fully decoded by the time they get here, so they won't
+	; access the insn variable.  Mark it as unused to avoid warnings.
+	(if (adata-integral-insn? CURRENT-ARCH)
+	    ""
+	    "ATTRIBUTE_UNUSED ")
+	"CGEN_INSN_WORD insn = "
 	(if (adata-integral-insn? CURRENT-ARCH)
 	    "entire_insn;\n"
 	    "base_insn;\n"))
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-22 10:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-21  4:28 [PATCH] sim: mark local insn var as unused [PR sim/31181] Mike Frysinger
2023-12-22  0:40 ` [PATCH v2] " Mike Frysinger
2023-12-22 10:35   ` Jose E. Marchesi

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).