target/hexagon: fix -Wshadow=local build error on GCC 14
PATCH 1/1 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.
--- target/hexagon/gen_tcg.h | 4 ++-- target/hexagon/macros.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
target/hexagon/gen_tcg.h +2 -2
@@ -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); \
target/hexagon/macros.h +2 -2
@@ -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))
Signature · 1 line
2.34.1
Quoted 12 lines · Brian Cain
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
ced651b7757ec23: tag compatibility rules for enums.After that GCC change,
DECL_FILE_SCOPE_Pis false for all enumerators, so shadowing now falls under -Wshadow=local.
Quoted 8 lines
Rename the local variable to
tmp_halfto avoid the collision.Signed-off-by Brian Cain <[email protected]>--- target/hexagon/gen_tcg.h | 4 ++-- target/hexagon/macros.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)