qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] target/sparc: Clean up global variable shadowing


From: Richard Henderson
Subject: Re: [PATCH] target/sparc: Clean up global variable shadowing
Date: Tue, 10 Oct 2023 09:58:22 -0700
User-agent: Mozilla Thunderbird

On 10/9/23 02:24, Philippe Mathieu-Daudé wrote:
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;
                   ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
  target/sparc/translate.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/sparc/translate.c b/target/sparc/translate.c
index f92ff80ac8..26ed371109 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -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...

  {
      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~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]