qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
	Artyom Tarasenko <atar4qemu@gmail.com>
Subject: Re: [PATCH] target/sparc: Clean up global variable shadowing
Date: Tue, 10 Oct 2023 09:58:22 -0700	[thread overview]
Message-ID: <22c8b7c1-d8ef-4eea-9431-d1ad3cbb681d@linaro.org> (raw)
In-Reply-To: <20231009092434.50356-1-philmd@linaro.org>

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~


      parent reply	other threads:[~2023-10-10 16:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22c8b7c1-d8ef-4eea-9431-d1ad3cbb681d@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=atar4qemu@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).