Commit 8aea63e965 for qemu.org
commit 8aea63e9650df7ece512be227b01f648ab52e069
Author: Brian Cain <brian.cain@oss.qualcomm.com>
Date: Thu Jul 16 11:41:32 2026 -0700
target/hexagon: fix -Wshadow=local build error on GCC 14
With --disable-hexagon-idef-parser, tcg_funcs_generated.c.inc fails
to build under GCC 14 with:
error: declaration of 'HALF' shadows a previous local
[-Werror=shadow=local]
This became a hard error with GCC ced651b7757e `c23: tag compatibility
rules for enums`.
After that GCC change, DECL_FILE_SCOPE_P is false for all
enumerators, so shadowing now falls under -Wshadow=local.
Rename the local variable to tmp_half to avoid the collision.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h
index a28af0c245..40e03781d3 100644
--- a/target/hexagon/gen_tcg.h
+++ b/target/hexagon/gen_tcg.h
@@ -414,7 +414,7 @@
#define fGEN_TCG_STORE(SHORTCODE) \
do { \
- TCGv HALF G_GNUC_UNUSED = tcg_temp_new(); \
+ TCGv tmp_half G_GNUC_UNUSED = tcg_temp_new(); \
TCGv BYTE G_GNUC_UNUSED = tcg_temp_new(); \
SHORTCODE; \
} while (0)
@@ -422,7 +422,7 @@
#define fGEN_TCG_STORE_pcr(SHIFT, STORE) \
do { \
TCGv ireg = tcg_temp_new(); \
- TCGv HALF G_GNUC_UNUSED = tcg_temp_new(); \
+ TCGv tmp_half G_GNUC_UNUSED = tcg_temp_new(); \
TCGv BYTE G_GNUC_UNUSED = tcg_temp_new(); \
tcg_gen_mov_tl(EA, RxV); \
gen_read_ireg(ireg, MuV, SHIFT); \
diff --git a/target/hexagon/macros.h b/target/hexagon/macros.h
index 21ab8ae5bb..8a32d5f79c 100644
--- a/target/hexagon/macros.h
+++ b/target/hexagon/macros.h
@@ -576,8 +576,8 @@ static inline TCGv gen_read_ireg(TCGv result, TCGv val, int shift)
} while (0)
#ifdef QEMU_GENERATE
-#define fGETHALF(N, SRC) gen_get_half(HALF, N, SRC, true)
-#define fGETUHALF(N, SRC) gen_get_half(HALF, N, SRC, false)
+#define fGETHALF(N, SRC) gen_get_half(tmp_half, N, SRC, true)
+#define fGETUHALF(N, SRC) gen_get_half(tmp_half, N, SRC, false)
#else
#define fGETHALF(N, SRC) ((int16_t)((SRC >> ((N) * 16)) & 0xffff))
#define fGETUHALF(N, SRC) ((uint16_t)((SRC >> ((N) * 16)) & 0xffff))