target/sparc: Clean up global variable shadowing
PATCH 1/1 target/sparc: Clean up global variable shadowing
Fix:
target/sparc/translate.c:2823:66: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] static void gen_load_trap_state_at_tl(TCGv_ptr r_tsptr, TCGv_env tcg_env)
^
include/tcg/tcg.h:579:17: note: previous declaration is here
extern TCGv_env tcg_env;
^--- target/sparc/translate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
target/sparc/translate.c +3 -3
@@ -2820,19 +2820,19 @@ static void gen_fmovq(DisasContext *dc, DisasCompare *cmp, int rd, int rs) }#ifndef CONFIG_USER_ONLY -static void gen_load_trap_state_at_tl (TCGv_ptr r_tsptr,TCGv_env tcg_env) +static void gen_load_trap_state_at_tl (TCGv_ptr r_tsptr,TCGv_env env) {TCGv_i32 r_tl =tcg_temp_new_i32 ();/* load env->tl into r_tl */ -tcg_gen_ld_i32 (r_tl, tcg_env, offsetof(CPUSPARCState , tl)); +tcg_gen_ld_i32 (r_tl, env, offsetof(CPUSPARCState , tl));/* tl = [0 ... MAXTL_MASK] where MAXTL_MASK must be power of 2 */ tcg_gen_andi_i32 (r_tl, r_tl,MAXTL_MASK );/* calculate offset to current trap state from env->ts, reuse r_tl */ tcg_gen_muli_i32 (r_tl, r_tl,sizeof (trap_state)); -tcg_gen_addi_ptr (r_tsptr, tcg_env, offsetof(CPUSPARCState , ts)); +tcg_gen_addi_ptr (r_tsptr, env, offsetof(CPUSPARCState , ts));/* tsptr = env->ts[env->tl & MAXTL_MASK] */ {
Signature · 1 line
2.41.0
Quoted 31 lines · Philippe Mathieu-Daudé
Fix:
target/sparc/translate.c:2823:66: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] static voidgen_load_trap_state_at_tl(TCGv_ptr r_tsptr, TCGv_env tcg_env)^ include/tcg/tcg.h:579:17: note: previous declaration is here extern TCGv_env tcg_env; ^Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/sparc/translate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)target/sparc/translate.c +2
-2@@ -2820,19 +2820,19 @@ static void gen_fmovq(DisasContext *dc, DisasCompare *cmp, int rd, int rs) }#ifndef CONFIG_USER_ONLY -static void gen_load_trap_state_at_tl (TCGv_ptr r_tsptr,TCGv_env tcg_env) +static void gen_load_trap_state_at_tl (TCGv_ptr r_tsptr,TCGv_env env) {TCGv_i32 r_tl =tcg_temp_new_i32 ();/* load env->tl into r_tl */ -tcg_gen_ld_i32 (r_tl, tcg_env, offsetof(CPUSPARCState , tl)); +tcg_gen_ld_i32 (r_tl, env, offsetof(CPUSPARCState , tl));
target/sparc/translate.c static void gen_fmovq(DisasContext *dc, DisasCompare *cmp, int rd, int rs) · line 2838
Quoted 10 lines
target/sparc/translate.c +1
-1/* tl = [0 ... MAXTL_MASK] where MAXTL_MASK must be power of 2 */ tcg_gen_andi_i32 (r_tl, r_tl,MAXTL_MASK );/* calculate offset to current trap state from env->ts, reuse r_tl */ tcg_gen_muli_i32 (r_tl, r_tl,sizeof (trap_state)); -tcg_gen_addi_ptr (r_tsptr, tcg_env, offsetof(CPUSPARCState , ts)); +tcg_gen_addi_ptr (r_tsptr, env, offsetof(CPUSPARCState , ts));/* tsptr = env->ts[env->tl & MAXTL_MASK] */ {
ATB,
Mark.
Quoted 19 lines · Philippe Mathieu-Daudé
Fix:
target/sparc/translate.c:2823:66: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] static voidgen_load_trap_state_at_tl(TCGv_ptr r_tsptr, TCGv_env tcg_env)^ include/tcg/tcg.h:579:17: note: previous declaration is here extern TCGv_env tcg_env; ^Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/sparc/translate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)target/sparc/translate.c +0
-0
target/sparc/translate.c static void gen_fmovq(DisasContext *dc, DisasCompare *cmp, int rd, int rs) · line 2823
Quoted 5 lines
target/sparc/translate.c +1
-1@@ -2820,19 +2820,19 @@ static void gen_fmovq(DisasContext *dc, DisasCompare *cmp, int rd, int rs) }#ifndef CONFIG_USER_ONLY -static void gen_load_trap_state_at_tl (TCGv_ptr r_tsptr,TCGv_env tcg_env) +static void gen_load_trap_state_at_tl (TCGv_ptr r_tsptr,TCGv_env env)
Better to eliminate the argument entirely...
target/sparc/translate.c static void gen_fmovq(DisasContext *dc, DisasCompare *cmp, int rd, int rs) · line 2828
Quoted 6 lines
target/sparc/translate.c +1
-1{TCGv_i32 r_tl =tcg_temp_new_i32 ();/* load env->tl into r_tl */ -tcg_gen_ld_i32 (r_tl, tcg_env, offsetof(CPUSPARCState , tl)); +tcg_gen_ld_i32 (r_tl, env, offsetof(CPUSPARCState , tl));
... so that this *does* reference the global.
r~