* [PATCH] target/sparc: Clean up global variable shadowing
@ 2023-10-09 9:24 Philippe Mathieu-Daudé
2023-10-09 21:52 ` Mark Cave-Ayland
2023-10-10 16:58 ` Richard Henderson
0 siblings, 2 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-10-09 9:24 UTC (permalink / raw)
To: qemu-devel
Cc: Mark Cave-Ayland, Artyom Tarasenko, Philippe Mathieu-Daudé
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)
{
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] */
{
--
2.41.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] target/sparc: Clean up global variable shadowing
2023-10-09 9:24 [PATCH] target/sparc: Clean up global variable shadowing Philippe Mathieu-Daudé
@ 2023-10-09 21:52 ` Mark Cave-Ayland
2023-10-10 16:58 ` Richard Henderson
1 sibling, 0 replies; 3+ messages in thread
From: Mark Cave-Ayland @ 2023-10-09 21:52 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel; +Cc: Artyom Tarasenko
On 09/10/2023 10: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)
> {
> 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] */
> {
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
ATB,
Mark.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] target/sparc: Clean up global variable shadowing
2023-10-09 9:24 [PATCH] target/sparc: Clean up global variable shadowing Philippe Mathieu-Daudé
2023-10-09 21:52 ` Mark Cave-Ayland
@ 2023-10-10 16:58 ` Richard Henderson
1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2023-10-10 16:58 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Mark Cave-Ayland, Artyom Tarasenko
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~
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-10 16:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-09 9:24 [PATCH] target/sparc: Clean up global variable shadowing Philippe Mathieu-Daudé
2023-10-09 21:52 ` Mark Cave-Ayland
2023-10-10 16:58 ` Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).