The analyze_read() methods on GuestSource, GuestPairSource,
SystemSource, and SystemPairSource were no-ops because these
source registers do not need read-tracking in the analyze phase.
However, gen_analyze_funcs.py unconditionally declares the
register-number variable (e.g. GsN) via decl_reg_num() for all
registers that are read or written. When building with
hexagon-softmmu, the generated analyze function bodies are
compiled (outside the #ifndef CONFIG_USER_ONLY guard), and the
declared-but-unreferenced register-number variable triggers
-Werror=unused-variable under both gcc and clang.
Emit a (void) cast on the register number from analyze_read() to
suppress the warning.
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
---
target/hexagon/hex_common.py | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/target/hexagon/hex_common.py b/target/hexagon/hex_common.py
index 1e2c2e46506..85745ef48c2 100755
--- a/target/hexagon/hex_common.py
+++ b/target/hexagon/hex_common.py
@@ -1075,7 +1075,9 @@ def decl_tcg(self, f, tag, regno):
gen_read_greg({self.reg_tcg()}, {self.reg_num});
"""))
def analyze_read(self, f, regno):
- pass
+ f.write(code_fmt(f"""\
+ (void){self.reg_num};
+ """))
class GuestPairDest(GuestRegister, Pair, Dest):
def decl_tcg(self, f, tag, regno):
@@ -1100,7 +1102,9 @@ def decl_tcg(self, f, tag, regno):
gen_read_greg_pair({self.reg_tcg()}, {self.reg_num});
"""))
def analyze_read(self, f, regno):
- pass
+ f.write(code_fmt(f"""\
+ (void){self.reg_num};
+ """))
class SystemDest(Register, Single, Dest):
def decl_tcg(self, f, tag, regno):
@@ -1125,7 +1129,9 @@ def decl_tcg(self, f, tag, regno):
gen_read_sreg({self.reg_tcg()}, {self.reg_num});
"""))
def analyze_read(self, f, regno):
- pass
+ f.write(code_fmt(f"""\
+ (void){self.reg_num};
+ """))
class SystemPairDest(Register, Pair, Dest):
def decl_tcg(self, f, tag, regno):
@@ -1150,7 +1156,9 @@ def decl_tcg(self, f, tag, regno):
gen_read_sreg_pair({self.reg_tcg()}, {self.reg_num});
"""))
def analyze_read(self, f, regno):
- pass
+ f.write(code_fmt(f"""\
+ (void){self.reg_num};
+ """))
def init_registers():
regs = {
--
2.34.1