]> sourceware.org Git - cgen.git/commitdiff
sim: mark local insn var as unused [PR sim/31181]
authorMike Frysinger <vapier@gentoo.org>
Thu, 21 Dec 2023 04:26:13 +0000 (23:26 -0500)
committerMike Frysinger <vapier@gentoo.org>
Thu, 21 Dec 2023 17:27:23 +0000 (12:27 -0500)
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

index 19c0d4677424eb5fcfc8e9d9554c0bc8750a3914..5284da0741660d252670159d87ebef5e3f26a27d 100644 (file)
@@ -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 = "
+       "    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")
+       " = "
        (if (adata-integral-insn? CURRENT-ARCH)
            "entire_insn;\n"
            "base_insn;\n"))
This page took 0.034128 seconds and 5 git commands to generate.