diff mbox series

[v2,3/3] target/hexagon: avoid shadowing globals

Message ID 20231005222206.2784853-4-bcain@quicinc.com (mailing list archive)
State New, archived
Headers show
Series hexagon: GETPC() and shadowing fixes | expand

Commit Message

Brian Cain Oct. 5, 2023, 10:22 p.m. UTC
The typedef `vaddr` is shadowed by `vaddr` identifiers, so we rename the
identifiers to avoid shadowing the type name.

The global `cpu_env` is shadowed by local `cpu_env` arguments, so we
rename the function arguments to avoid shadowing the global.

Signed-off-by: Brian Cain <bcain@quicinc.com>
---
 target/hexagon/genptr.c                 | 56 ++++++++++++-------------
 target/hexagon/genptr.h                 | 18 ++++----
 target/hexagon/mmvec/system_ext_mmvec.c |  4 +-
 target/hexagon/mmvec/system_ext_mmvec.h |  2 +-
 target/hexagon/op_helper.c              |  4 +-
 5 files changed, 42 insertions(+), 42 deletions(-)

Comments

Taylor Simpson Oct. 6, 2023, 4 p.m. UTC | #1
> -----Original Message-----
> From: Brian Cain <bcain@quicinc.com>
> Sent: Thursday, October 5, 2023 4:22 PM
> To: qemu-devel@nongnu.org
> Cc: bcain@quicinc.com; armbru@redhat.com; richard.henderson@linaro.org;
> philmd@linaro.org; peter.maydell@linaro.org; quic_mathbern@quicinc.com;
> stefanha@redhat.com; ale@rev.ng; anjo@rev.ng;
> quic_mliebel@quicinc.com; ltaylorsimpson@gmail.com
> Subject: [PATCH v2 3/3] target/hexagon: avoid shadowing globals
> 
> The typedef `vaddr` is shadowed by `vaddr` identifiers, so we rename the
> identifiers to avoid shadowing the type name.
> 
> The global `cpu_env` is shadowed by local `cpu_env` arguments, so we
> rename the function arguments to avoid shadowing the global.
> 
> Signed-off-by: Brian Cain <bcain@quicinc.com>
> ---
>  target/hexagon/genptr.c                 | 56 ++++++++++++-------------
>  target/hexagon/genptr.h                 | 18 ++++----
>  target/hexagon/mmvec/system_ext_mmvec.c |  4 +-
> target/hexagon/mmvec/system_ext_mmvec.h |  2 +-
>  target/hexagon/op_helper.c              |  4 +-
>  5 files changed, 42 insertions(+), 42 deletions(-)
> 
> diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index
> 217bc7bb5a..11377ac92b 100644
> --- a/target/hexagon/genptr.c
> +++ b/target/hexagon/genptr.c
> @@ -334,28 +334,28 @@ void gen_set_byte_i64(int N, TCGv_i64 result, TCGv
> src)
>      tcg_gen_deposit_i64(result, result, src64, N * 8, 8);  }
> 
> -static inline void gen_load_locked4u(TCGv dest, TCGv vaddr, int
> mem_index)
> +static inline void gen_load_locked4u(TCGv dest, TCGv v_addr, int
> +mem_index)

I'd recommend moving both the type and the arg name to the new line, also indent the new line.
static inline void gen_load_locked4u(TCGv dest, TCGv v_addr,
                                                                  int mem_index)


> 
> -static inline void gen_load_locked8u(TCGv_i64 dest, TCGv vaddr, int
> mem_index)
> +static inline void gen_load_locked8u(TCGv_i64 dest, TCGv v_addr, int
> +mem_index)

Ditto

>  static inline void gen_store_conditional4(DisasContext *ctx,
> -                                          TCGv pred, TCGv vaddr, TCGv src)
> +                                          TCGv pred, TCGv v_addr, TCGv
> + src)

Ditto

>      zero = tcg_constant_tl(0);
> @@ -374,13 +374,13 @@ static inline void
> gen_store_conditional4(DisasContext *ctx,  }
> 
>  static inline void gen_store_conditional8(DisasContext *ctx,
> -                                          TCGv pred, TCGv vaddr, TCGv_i64 src)
> +                                          TCGv pred, TCGv v_addr,
> + TCGv_i64 src)

Indent

> -void mem_gather_store(CPUHexagonState *env, target_ulong vaddr, int
> slot)
> +void mem_gather_store(CPUHexagonState *env, target_ulong v_addr, int
> +slot)

Ditto

> -void mem_gather_store(CPUHexagonState *env, target_ulong vaddr, int
> slot);
> +void mem_gather_store(CPUHexagonState *env, target_ulong v_addr, int
> +slot);

Ditto


Otherwise,
Reviewed-by: Taylor Simpson <ltaylorsimpson@gmail.com>
Brian Cain Oct. 8, 2023, 1:49 p.m. UTC | #2
> -----Original Message-----
> From: ltaylorsimpson@gmail.com <ltaylorsimpson@gmail.com>
> Sent: Friday, October 6, 2023 11:01 AM
> To: Brian Cain <bcain@quicinc.com>; qemu-devel@nongnu.org
> Cc: armbru@redhat.com; richard.henderson@linaro.org; philmd@linaro.org;
> peter.maydell@linaro.org; Matheus Bernardino (QUIC)
> <quic_mathbern@quicinc.com>; stefanha@redhat.com; ale@rev.ng;
> anjo@rev.ng; Marco Liebel (QUIC) <quic_mliebel@quicinc.com>
> Subject: RE: [PATCH v2 3/3] target/hexagon: avoid shadowing globals
> 
> WARNING: This email originated from outside of Qualcomm. Please be wary of
> any links or attachments, and do not enable macros.
> 
> > -----Original Message-----
> > From: Brian Cain <bcain@quicinc.com>
> > Sent: Thursday, October 5, 2023 4:22 PM
> > To: qemu-devel@nongnu.org
> > Cc: bcain@quicinc.com; armbru@redhat.com; richard.henderson@linaro.org;
> > philmd@linaro.org; peter.maydell@linaro.org; quic_mathbern@quicinc.com;
> > stefanha@redhat.com; ale@rev.ng; anjo@rev.ng;
> > quic_mliebel@quicinc.com; ltaylorsimpson@gmail.com
> > Subject: [PATCH v2 3/3] target/hexagon: avoid shadowing globals
> >
> > The typedef `vaddr` is shadowed by `vaddr` identifiers, so we rename the
> > identifiers to avoid shadowing the type name.
> >
> > The global `cpu_env` is shadowed by local `cpu_env` arguments, so we
> > rename the function arguments to avoid shadowing the global.
> >
> > Signed-off-by: Brian Cain <bcain@quicinc.com>
> > ---
> >  target/hexagon/genptr.c                 | 56 ++++++++++++-------------
> >  target/hexagon/genptr.h                 | 18 ++++----
> >  target/hexagon/mmvec/system_ext_mmvec.c |  4 +-
> > target/hexagon/mmvec/system_ext_mmvec.h |  2 +-
> >  target/hexagon/op_helper.c              |  4 +-
> >  5 files changed, 42 insertions(+), 42 deletions(-)
> >
> > diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index
> > 217bc7bb5a..11377ac92b 100644
> > --- a/target/hexagon/genptr.c
> > +++ b/target/hexagon/genptr.c
> > @@ -334,28 +334,28 @@ void gen_set_byte_i64(int N, TCGv_i64 result,
> TCGv
> > src)
> >      tcg_gen_deposit_i64(result, result, src64, N * 8, 8);  }
> >
> > -static inline void gen_load_locked4u(TCGv dest, TCGv vaddr, int
> > mem_index)
> > +static inline void gen_load_locked4u(TCGv dest, TCGv v_addr, int
> > +mem_index)
> 
> I'd recommend moving both the type and the arg name to the new line, also
> indent the new line.
> static inline void gen_load_locked4u(TCGv dest, TCGv v_addr,
>                                                                   int mem_index)
> 
> 
> >
> > -static inline void gen_load_locked8u(TCGv_i64 dest, TCGv vaddr, int
> > mem_index)
> > +static inline void gen_load_locked8u(TCGv_i64 dest, TCGv v_addr, int
> > +mem_index)
> 
> Ditto
> 
> >  static inline void gen_store_conditional4(DisasContext *ctx,
> > -                                          TCGv pred, TCGv vaddr, TCGv src)
> > +                                          TCGv pred, TCGv v_addr, TCGv
> > + src)
> 
> Ditto
> 
> >      zero = tcg_constant_tl(0);
> > @@ -374,13 +374,13 @@ static inline void
> > gen_store_conditional4(DisasContext *ctx,  }
> >
> >  static inline void gen_store_conditional8(DisasContext *ctx,
> > -                                          TCGv pred, TCGv vaddr, TCGv_i64 src)
> > +                                          TCGv pred, TCGv v_addr,
> > + TCGv_i64 src)
> 
> Indent
> 
> > -void mem_gather_store(CPUHexagonState *env, target_ulong vaddr, int
> > slot)
> > +void mem_gather_store(CPUHexagonState *env, target_ulong v_addr, int
> > +slot)
> 
> Ditto
> 
> > -void mem_gather_store(CPUHexagonState *env, target_ulong vaddr, int
> > slot);
> > +void mem_gather_store(CPUHexagonState *env, target_ulong v_addr, int
> > +slot);
> 
> Ditto

I could be mistaken but AFAICT none of these lines are wrapped in the way they're quoted above  in my patch (nor the baseline).  I don't think any of these lines exceed 80 columns, so they shouldn't need wrapping, either.

I double checked how it's displayed at the archive https://lists.gnu.org/archive/html/qemu-devel/2023-10/msg01667.html to make sure that it wasn't a misconfiguration of my mailer.  For another perspective - refer to the commit used to create this patch: https://github.com/quic/qemu/commit/7f20565d403d16337ab6d69ee663121a3eef71e6

Is your review comment that "these lines should be wrapped and when you do, make sure you do it like this"?  Or "if you are going to wrap them, wrap them like this"?  Or something else?

> Otherwise,
> Reviewed-by: Taylor Simpson <ltaylorsimpson@gmail.com>
>
Philippe Mathieu-Daudé Oct. 9, 2023, 6:09 a.m. UTC | #3
Hi Brian,

On 6/10/23 00:22, Brian Cain wrote:
> The typedef `vaddr` is shadowed by `vaddr` identifiers, so we rename the
> identifiers to avoid shadowing the type name.

This one surprises me, since we have other occurences:

include/exec/memory.h:751:bool memory_get_xlat_addr(IOMMUTLBEntry 
*iotlb, void **vaddr,
	include/qemu/plugin.h:199:void qemu_plugin_vcpu_mem_cb(CPUState *cpu, 
uint64_t vaddr,
target/arm/internals.h:643:G_NORETURN void 
arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
target/i386/tcg/helper-tcg.h:70:G_NORETURN void 
handle_unaligned_access(CPUX86State *env, vaddr vaddr,
...

$ git grep -w vaddr, | wc -l
      207

What is the error/warning like?

> The global `cpu_env` is shadowed by local `cpu_env` arguments, so we
> rename the function arguments to avoid shadowing the global.
> 
> Signed-off-by: Brian Cain <bcain@quicinc.com>
> ---
>   target/hexagon/genptr.c                 | 56 ++++++++++++-------------
>   target/hexagon/genptr.h                 | 18 ++++----
>   target/hexagon/mmvec/system_ext_mmvec.c |  4 +-
>   target/hexagon/mmvec/system_ext_mmvec.h |  2 +-
>   target/hexagon/op_helper.c              |  4 +-
>   5 files changed, 42 insertions(+), 42 deletions(-)
> 
> diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c
> index 217bc7bb5a..11377ac92b 100644
> --- a/target/hexagon/genptr.c
> +++ b/target/hexagon/genptr.c
> @@ -334,28 +334,28 @@ void gen_set_byte_i64(int N, TCGv_i64 result, TCGv src)
>       tcg_gen_deposit_i64(result, result, src64, N * 8, 8);
>   }
>   
> -static inline void gen_load_locked4u(TCGv dest, TCGv vaddr, int mem_index)
> +static inline void gen_load_locked4u(TCGv dest, TCGv v_addr, int mem_index)
>   {
> -    tcg_gen_qemu_ld_tl(dest, vaddr, mem_index, MO_TEUL);
> -    tcg_gen_mov_tl(hex_llsc_addr, vaddr);
> +    tcg_gen_qemu_ld_tl(dest, v_addr, mem_index, MO_TEUL);
> +    tcg_gen_mov_tl(hex_llsc_addr, v_addr);
>       tcg_gen_mov_tl(hex_llsc_val, dest);
>   }
Philippe Mathieu-Daudé Oct. 9, 2023, 6:43 a.m. UTC | #4
On 9/10/23 08:09, Philippe Mathieu-Daudé wrote:
> Hi Brian,
> 
> On 6/10/23 00:22, Brian Cain wrote:
>> The typedef `vaddr` is shadowed by `vaddr` identifiers, so we rename the
>> identifiers to avoid shadowing the type name.
> 
> This one surprises me, since we have other occurences:
> 
> include/exec/memory.h:751:bool memory_get_xlat_addr(IOMMUTLBEntry 
> *iotlb, void **vaddr,
>      include/qemu/plugin.h:199:void qemu_plugin_vcpu_mem_cb(CPUState 
> *cpu, uint64_t vaddr,
> target/arm/internals.h:643:G_NORETURN void 
> arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
> target/i386/tcg/helper-tcg.h:70:G_NORETURN void 
> handle_unaligned_access(CPUX86State *env, vaddr vaddr,
> ...
> 
> $ git grep -w vaddr, | wc -l
>       207
> 
> What is the error/warning like?

OK I could reproduce, I suppose you are building with Clang which
doesn't support shadow-local so you get global warnings too (as
mentioned in this patch subject...):

In file included from ../../gdbstub/trace.h:1,
                  from ../../gdbstub/softmmu.c:30:
trace/trace-gdbstub.h: In function '_nocheck__trace_gdbstub_hit_watchpoint':
trace/trace-gdbstub.h:903:106: error: declaration of 'vaddr' shadows a 
global declaration [-Werror=shadow]
   903 | static inline void _nocheck__trace_gdbstub_hit_watchpoint(const 
char * type, int cpu_gdb_index, uint64_t vaddr)
       | 
                                 ~~~~~~~~~^~~~~
In file included from include/sysemu/accel-ops.h:13,
                  from include/sysemu/cpus.h:4,
                  from ../../gdbstub/softmmu.c:21:
include/exec/cpu-common.h:21:18: note: shadowed declaration is here
    21 | typedef uint64_t vaddr;
       |                  ^~~~~
trace/trace-gdbstub.h: In function 'trace_gdbstub_hit_watchpoint':
trace/trace-gdbstub.h:923:96: error: declaration of 'vaddr' shadows a 
global declaration [-Werror=shadow]
   923 | static inline void trace_gdbstub_hit_watchpoint(const char * 
type, int cpu_gdb_index, uint64_t vaddr)
       | 
                       ~~~~~~~~~^~~~~
include/exec/cpu-common.h:21:18: note: shadowed declaration is here
    21 | typedef uint64_t vaddr;
       |                  ^~~~~

Clang users got confused by this, IIUC Markus and Thomas idea is
to only enable these warnings for GCC, enforcing them for Clang
users via CI (until Clang get this option supported). Personally
I'd rather enable the warning once for all, waiting for Clang
support (or clean/enable global shadowing for GCC too).

See this thread:
https://lore.kernel.org/qemu-devel/11abc551-188e-85c0-fe55-b2b58d35105d@redhat.com/

Regards,

Phil.
Taylor Simpson Oct. 9, 2023, 6:59 p.m. UTC | #5
> -----Original Message-----
> From: Brian Cain <bcain@quicinc.com>
> Sent: Sunday, October 8, 2023 7:50 AM
> To: ltaylorsimpson@gmail.com; qemu-devel@nongnu.org
> Cc: armbru@redhat.com; richard.henderson@linaro.org; philmd@linaro.org;
> peter.maydell@linaro.org; Matheus Bernardino (QUIC)
> <quic_mathbern@quicinc.com>; stefanha@redhat.com; ale@rev.ng;
> anjo@rev.ng; Marco Liebel (QUIC) <quic_mliebel@quicinc.com>
> Subject: RE: [PATCH v2 3/3] target/hexagon: avoid shadowing globals
> 
> 
> 
> > -----Original Message-----
> > From: ltaylorsimpson@gmail.com <ltaylorsimpson@gmail.com>
> > Sent: Friday, October 6, 2023 11:01 AM
> > To: Brian Cain <bcain@quicinc.com>; qemu-devel@nongnu.org
> > Cc: armbru@redhat.com; richard.henderson@linaro.org;
> > philmd@linaro.org; peter.maydell@linaro.org; Matheus Bernardino (QUIC)
> > <quic_mathbern@quicinc.com>; stefanha@redhat.com; ale@rev.ng;
> > anjo@rev.ng; Marco Liebel (QUIC) <quic_mliebel@quicinc.com>
> > Subject: RE: [PATCH v2 3/3] target/hexagon: avoid shadowing globals
> >
> > WARNING: This email originated from outside of Qualcomm. Please be
> > wary of any links or attachments, and do not enable macros.
> >
> > > -----Original Message-----
> > > From: Brian Cain <bcain@quicinc.com>
> > > Sent: Thursday, October 5, 2023 4:22 PM
> > > To: qemu-devel@nongnu.org
> > > Cc: bcain@quicinc.com; armbru@redhat.com;
> > > richard.henderson@linaro.org; philmd@linaro.org;
> > > peter.maydell@linaro.org; quic_mathbern@quicinc.com;
> > > stefanha@redhat.com; ale@rev.ng; anjo@rev.ng;
> > > quic_mliebel@quicinc.com; ltaylorsimpson@gmail.com
> > > Subject: [PATCH v2 3/3] target/hexagon: avoid shadowing globals
> > >
> > > The typedef `vaddr` is shadowed by `vaddr` identifiers, so we rename
> > > the identifiers to avoid shadowing the type name.
> > >
> > > The global `cpu_env` is shadowed by local `cpu_env` arguments, so we
> > > rename the function arguments to avoid shadowing the global.
> > >
> > > Signed-off-by: Brian Cain <bcain@quicinc.com>
> > > ---
> > >  target/hexagon/genptr.c                 | 56 ++++++++++++-------------
> > >  target/hexagon/genptr.h                 | 18 ++++----
> > >  target/hexagon/mmvec/system_ext_mmvec.c |  4 +-
> > > target/hexagon/mmvec/system_ext_mmvec.h |  2 +-
> > >  target/hexagon/op_helper.c              |  4 +-
> > >  5 files changed, 42 insertions(+), 42 deletions(-)
> > >
> > > diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index
> > > 217bc7bb5a..11377ac92b 100644
> > > --- a/target/hexagon/genptr.c
> > > +++ b/target/hexagon/genptr.c
> > > @@ -334,28 +334,28 @@ void gen_set_byte_i64(int N, TCGv_i64 result,
> > TCGv
> > > src)
> > >      tcg_gen_deposit_i64(result, result, src64, N * 8, 8);  }
> > >
> > > -static inline void gen_load_locked4u(TCGv dest, TCGv vaddr, int
> > > mem_index)
> > > +static inline void gen_load_locked4u(TCGv dest, TCGv v_addr, int
> > > +mem_index)
> >
> > I'd recommend moving both the type and the arg name to the new line,
> > also indent the new line.
> > static inline void gen_load_locked4u(TCGv dest, TCGv v_addr,
> >                                                                   int
> > mem_index)
> >
> >
> I could be mistaken but AFAICT none of these lines are wrapped in the way
> they're quoted above  in my patch (nor the baseline).  I don't think any of
> these lines exceed 80 columns, so they shouldn't need wrapping, either.
> 
> I double checked how it's displayed at the archive
> https://lists.gnu.org/archive/html/qemu-devel/2023-10/msg01667.html to
> make sure that it wasn't a misconfiguration of my mailer.  For another
> perspective - refer to the commit used to create this patch:
> https://github.com/quic/qemu/commit/7f20565d403d16337ab6d69ee663121
> a3eef71e6
> 
> Is your review comment that "these lines should be wrapped and when you
> do, make sure you do it like this"?  Or "if you are going to wrap them, wrap
> them like this"?  Or something else?

Yes.  It looked like some adding the v_ would sometimes put the line over the 80 character size.
If so, wrap them as described.  If not, no wrapping is needed.


> 
> > Otherwise,
> > Reviewed-by: Taylor Simpson <ltaylorsimpson@gmail.com>
> >
Brian Cain Oct. 9, 2023, 8:53 p.m. UTC | #6
> -----Original Message-----
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Sent: Monday, October 9, 2023 1:43 AM
> To: Brian Cain <bcain@quicinc.com>; qemu-devel@nongnu.org
> Cc: armbru@redhat.com; richard.henderson@linaro.org;
> peter.maydell@linaro.org; Matheus Bernardino (QUIC)
> <quic_mathbern@quicinc.com>; stefanha@redhat.com; ale@rev.ng;
> anjo@rev.ng; Marco Liebel (QUIC) <quic_mliebel@quicinc.com>;
> ltaylorsimpson@gmail.com; Thomas Huth <thuth@redhat.com>; Daniel P.
> Berrangé <berrange@redhat.com>
> Subject: Re: [PATCH v2 3/3] target/hexagon: avoid shadowing globals
> 
> WARNING: This email originated from outside of Qualcomm. Please be wary of
> any links or attachments, and do not enable macros.
> 
> On 9/10/23 08:09, Philippe Mathieu-Daudé wrote:
> > Hi Brian,
> >
> > On 6/10/23 00:22, Brian Cain wrote:
> >> The typedef `vaddr` is shadowed by `vaddr` identifiers, so we rename the
> >> identifiers to avoid shadowing the type name.
> >
> > This one surprises me, since we have other occurences:
> >
> > include/exec/memory.h:751:bool memory_get_xlat_addr(IOMMUTLBEntry
> > *iotlb, void **vaddr,
> >      include/qemu/plugin.h:199:void qemu_plugin_vcpu_mem_cb(CPUState
> > *cpu, uint64_t vaddr,
> > target/arm/internals.h:643:G_NORETURN void
> > arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
> > target/i386/tcg/helper-tcg.h:70:G_NORETURN void
> > handle_unaligned_access(CPUX86State *env, vaddr vaddr,
> > ...
> >
> > $ git grep -w vaddr, | wc -l
> >       207
> >
> > What is the error/warning like?
> 
> OK I could reproduce, I suppose you are building with Clang which
> doesn't support shadow-local so you get global warnings too (as
> mentioned in this patch subject...):

No -- I generally build with gcc and only double-check the clang results to make sure I don't see any new failures there.

But I've not tested "-Wshadow" with clang yet.  I found these by adding "-Wshadow=global" to "-Wshadow=local".  I thought it might be useful to address these too while we're here.

> In file included from ../../gdbstub/trace.h:1,
>                   from ../../gdbstub/softmmu.c:30:
> trace/trace-gdbstub.h: In function '_nocheck__trace_gdbstub_hit_watchpoint':
> trace/trace-gdbstub.h:903:106: error: declaration of 'vaddr' shadows a
> global declaration [-Werror=shadow]
>    903 | static inline void _nocheck__trace_gdbstub_hit_watchpoint(const
> char * type, int cpu_gdb_index, uint64_t vaddr)
>        |
>                                  ~~~~~~~~~^~~~~
> In file included from include/sysemu/accel-ops.h:13,
>                   from include/sysemu/cpus.h:4,
>                   from ../../gdbstub/softmmu.c:21:
> include/exec/cpu-common.h:21:18: note: shadowed declaration is here
>     21 | typedef uint64_t vaddr;
>        |                  ^~~~~
> trace/trace-gdbstub.h: In function 'trace_gdbstub_hit_watchpoint':
> trace/trace-gdbstub.h:923:96: error: declaration of 'vaddr' shadows a
> global declaration [-Werror=shadow]
>    923 | static inline void trace_gdbstub_hit_watchpoint(const char *
> type, int cpu_gdb_index, uint64_t vaddr)
>        |
>                        ~~~~~~~~~^~~~~
> include/exec/cpu-common.h:21:18: note: shadowed declaration is here
>     21 | typedef uint64_t vaddr;
>        |                  ^~~~~
> 
> Clang users got confused by this, IIUC Markus and Thomas idea is
> to only enable these warnings for GCC, enforcing them for Clang
> users via CI (until Clang get this option supported). Personally
> I'd rather enable the warning once for all, waiting for Clang
> support (or clean/enable global shadowing for GCC too).

Hopefully it's helpful or at least benign if we address the shadowed globals under target/hexagon/ for now, even if "-Wshadow=global" is not enabled.

> See this thread:
> https://lore.kernel.org/qemu-devel/11abc551-188e-85c0-fe55-
> b2b58d35105d@redhat.com/
> 
> Regards,
> 
> Phil.
Markus Armbruster Oct. 10, 2023, 4:57 a.m. UTC | #7
Philippe Mathieu-Daudé <philmd@linaro.org> writes:

> On 9/10/23 08:09, Philippe Mathieu-Daudé wrote:
>> Hi Brian,
>> On 6/10/23 00:22, Brian Cain wrote:
>>> The typedef `vaddr` is shadowed by `vaddr` identifiers, so we rename the
>>> identifiers to avoid shadowing the type name.
>> This one surprises me, since we have other occurences:
>> include/exec/memory.h:751:bool memory_get_xlat_addr(IOMMUTLBEntry *iotlb, void **vaddr,
>>      include/qemu/plugin.h:199:void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr,
>> target/arm/internals.h:643:G_NORETURN void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
>> target/i386/tcg/helper-tcg.h:70:G_NORETURN void handle_unaligned_access(CPUX86State *env, vaddr vaddr,
>> ...
>> $ git grep -w vaddr, | wc -l
>>       207
>> What is the error/warning like?
>
> OK I could reproduce, I suppose you are building with Clang which
> doesn't support shadow-local so you get global warnings too (as
> mentioned in this patch subject...):
>
> In file included from ../../gdbstub/trace.h:1,
>                  from ../../gdbstub/softmmu.c:30:
> trace/trace-gdbstub.h: In function '_nocheck__trace_gdbstub_hit_watchpoint':
> trace/trace-gdbstub.h:903:106: error: declaration of 'vaddr' shadows a global declaration [-Werror=shadow]
>   903 | static inline void _nocheck__trace_gdbstub_hit_watchpoint(const char * type, int cpu_gdb_index, uint64_t vaddr)
>       |                                  ~~~~~~~~~^~~~~
> In file included from include/sysemu/accel-ops.h:13,
>                  from include/sysemu/cpus.h:4,
>                  from ../../gdbstub/softmmu.c:21:
> include/exec/cpu-common.h:21:18: note: shadowed declaration is here
>    21 | typedef uint64_t vaddr;
>       |                  ^~~~~
> trace/trace-gdbstub.h: In function 'trace_gdbstub_hit_watchpoint':
> trace/trace-gdbstub.h:923:96: error: declaration of 'vaddr' shadows a global declaration [-Werror=shadow]
>   923 | static inline void trace_gdbstub_hit_watchpoint(const char * type, int cpu_gdb_index, uint64_t vaddr)
>       |                        ~~~~~~~~~^~~~~
> include/exec/cpu-common.h:21:18: note: shadowed declaration is here
>    21 | typedef uint64_t vaddr;
>       |                  ^~~~~
>
> Clang users got confused by this, IIUC Markus and Thomas idea is
> to only enable these warnings for GCC, enforcing them for Clang
> users via CI (until Clang get this option supported). Personally
> I'd rather enable the warning once for all, waiting for Clang
> support (or clean/enable global shadowing for GCC too).
>
> See this thread:
> https://lore.kernel.org/qemu-devel/11abc551-188e-85c0-fe55-b2b58d35105d@redhat.com/

The idea to enable some variation of -Wshadow goes back to this thread:

    Subject: Re: [RFC PATCH] docs/style: permit inline loop variables
    Date: Thu, 24 Aug 2023 14:18:53 +0100
    Message-ID: <CAFEAcA8wobO5F16vYhbQCjeadfN5Zwx5CQ7L4vQ3fh8c_6ngJg@mail.gmail.com>
    https://lore.kernel.org/qemu-devel/CAFEAcA8wobO5F16vYhbQCjeadfN5Zwx5CQ7L4vQ3fh8c_6ngJg@mail.gmail.com/

I've been aiming at -Wshadow=local because (1) it seemed more practical
(a lot less cleanup needed before we can enable the warning), and (2)
local shadowing is basically always foolish and fully our own fault.

No objection to additional -Wshadow work as long as I'm not the one
doing it :)
Philippe Mathieu-Daudé Oct. 10, 2023, 5:22 a.m. UTC | #8
On 9/10/23 22:53, Brian Cain wrote:
>> On 9/10/23 08:09, Philippe Mathieu-Daudé wrote:
>>> On 6/10/23 00:22, Brian Cain wrote:
>>>> The typedef `vaddr` is shadowed by `vaddr` identifiers, so we rename the
>>>> identifiers to avoid shadowing the type name.
>>>
>>> This one surprises me, since we have other occurences:
>>>
>>> include/exec/memory.h:751:bool memory_get_xlat_addr(IOMMUTLBEntry
>>> *iotlb, void **vaddr,
>>>       include/qemu/plugin.h:199:void qemu_plugin_vcpu_mem_cb(CPUState
>>> *cpu, uint64_t vaddr,
>>> target/arm/internals.h:643:G_NORETURN void
>>> arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
>>> target/i386/tcg/helper-tcg.h:70:G_NORETURN void
>>> handle_unaligned_access(CPUX86State *env, vaddr vaddr,
>>> ...
>>>
>>> $ git grep -w vaddr, | wc -l
>>>        207
>>>
>>> What is the error/warning like?
>>
>> OK I could reproduce, I suppose you are building with Clang which
>> doesn't support shadow-local so you get global warnings too (as
>> mentioned in this patch subject...):
> 
> No -- I generally build with gcc and only double-check the clang results to make sure I don't see any new failures there.
> 
> But I've not tested "-Wshadow" with clang yet.  I found these by adding "-Wshadow=global" to "-Wshadow=local".  I thought it might be useful to address these too while we're here.
> 
>> In file included from ../../gdbstub/trace.h:1,
>>                    from ../../gdbstub/softmmu.c:30:
>> trace/trace-gdbstub.h: In function '_nocheck__trace_gdbstub_hit_watchpoint':
>> trace/trace-gdbstub.h:903:106: error: declaration of 'vaddr' shadows a
>> global declaration [-Werror=shadow]
>>     903 | static inline void _nocheck__trace_gdbstub_hit_watchpoint(const
>> char * type, int cpu_gdb_index, uint64_t vaddr)
>>         |
>>                                   ~~~~~~~~~^~~~~
>> In file included from include/sysemu/accel-ops.h:13,
>>                    from include/sysemu/cpus.h:4,
>>                    from ../../gdbstub/softmmu.c:21:
>> include/exec/cpu-common.h:21:18: note: shadowed declaration is here
>>      21 | typedef uint64_t vaddr;
>>         |                  ^~~~~
>> trace/trace-gdbstub.h: In function 'trace_gdbstub_hit_watchpoint':
>> trace/trace-gdbstub.h:923:96: error: declaration of 'vaddr' shadows a
>> global declaration [-Werror=shadow]
>>     923 | static inline void trace_gdbstub_hit_watchpoint(const char *
>> type, int cpu_gdb_index, uint64_t vaddr)
>>         |
>>                         ~~~~~~~~~^~~~~
>> include/exec/cpu-common.h:21:18: note: shadowed declaration is here
>>      21 | typedef uint64_t vaddr;
>>         |                  ^~~~~

If we have to clean that for -Wshadow=global, I'm tempted to rename
the typedef as 'vaddr_t' and keep the 'vaddr' variable names.

Richard, Anton, what do you think?

>> Clang users got confused by this, IIUC Markus and Thomas idea is
>> to only enable these warnings for GCC, enforcing them for Clang
>> users via CI (until Clang get this option supported). Personally
>> I'd rather enable the warning once for all, waiting for Clang
>> support (or clean/enable global shadowing for GCC too).
> 
> Hopefully it's helpful or at least benign if we address the shadowed globals under target/hexagon/ for now, even if "-Wshadow=global" is not enabled.
> 
>> See this thread:
>> https://lore.kernel.org/qemu-devel/11abc551-188e-85c0-fe55-
>> b2b58d35105d@redhat.com/
>>
>> Regards,
>>
>> Phil.
Markus Armbruster Oct. 10, 2023, 6:04 a.m. UTC | #9
Philippe Mathieu-Daudé <philmd@linaro.org> writes:

[...]

> If we have to clean that for -Wshadow=global, I'm tempted to rename
> the typedef as 'vaddr_t' and keep the 'vaddr' variable names.

POSIX reserves suffix _t, see
https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_02_02

Do we care?

> Richard, Anton, what do you think?

[...]
Philippe Mathieu-Daudé Oct. 10, 2023, 7:34 a.m. UTC | #10
On 10/10/23 08:04, Markus Armbruster wrote:
> Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> 
> [...]
> 
>> If we have to clean that for -Wshadow=global, I'm tempted to rename
>> the typedef as 'vaddr_t' and keep the 'vaddr' variable names.
> 
> POSIX reserves suffix _t, see
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_02_02

Alternatives: tvaddr, VAddr, TargetVirtualAddress.

Naming is hard.

> Do we care?
> 
>> Richard, Anton, what do you think?
> 
> [...]
>
Thomas Huth Oct. 10, 2023, 9:10 a.m. UTC | #11
On 10/10/2023 09.34, Philippe Mathieu-Daudé wrote:
> On 10/10/23 08:04, Markus Armbruster wrote:
>> Philippe Mathieu-Daudé <philmd@linaro.org> writes:
>>
>> [...]
>>
>>> If we have to clean that for -Wshadow=global, I'm tempted to rename
>>> the typedef as 'vaddr_t' and keep the 'vaddr' variable names.
>>
>> POSIX reserves suffix _t, see
>> https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_02_02
> 
> Alternatives: tvaddr, VAddr, TargetVirtualAddress.
> 
> Naming is hard.
> 
>> Do we care?

According to our docs/devel/style.rst :

"Scalar type
names are lower_case_with_underscores_ending_with_a_t, like the POSIX
uint64_t and family.  Note that this last convention contradicts POSIX
and is therefore likely to be changed."

Maybe this would be a good point in time now to revisit our coding style, 
update it and then to change the "vaddr" type accordingly?

My 0.02 €: If enum types should already be in CamelCase, why not also use 
that for scalar types? So I'd vote for VirtAddr or VAddr here.

  Thomas
Brian Cain Oct. 18, 2023, 3:11 a.m. UTC | #12
> -----Original Message-----
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Sent: Tuesday, October 10, 2023 12:23 AM
> To: Brian Cain <bcain@quicinc.com>; richard.henderson@linaro.org;
> anjo@rev.ng
> Cc: armbru@redhat.com; peter.maydell@linaro.org; Matheus Bernardino
> (QUIC) <quic_mathbern@quicinc.com>; stefanha@redhat.com; ale@rev.ng;
> Marco Liebel (QUIC) <quic_mliebel@quicinc.com>; ltaylorsimpson@gmail.com;
> Thomas Huth <thuth@redhat.com>; Daniel P. Berrangé
> <berrange@redhat.com>; qemu-devel@nongnu.org
> Subject: Re: [PATCH v2 3/3] target/hexagon: avoid shadowing globals
> 
> WARNING: This email originated from outside of Qualcomm. Please be wary of
> any links or attachments, and do not enable macros.
> 
> On 9/10/23 22:53, Brian Cain wrote:
> >> On 9/10/23 08:09, Philippe Mathieu-Daudé wrote:
> >>> On 6/10/23 00:22, Brian Cain wrote:
> >>>> The typedef `vaddr` is shadowed by `vaddr` identifiers, so we rename the
> >>>> identifiers to avoid shadowing the type name.
> >>>
> >>> This one surprises me, since we have other occurences:
> >>>
> >>> include/exec/memory.h:751:bool memory_get_xlat_addr(IOMMUTLBEntry
> >>> *iotlb, void **vaddr,
> >>>       include/qemu/plugin.h:199:void qemu_plugin_vcpu_mem_cb(CPUState
> >>> *cpu, uint64_t vaddr,
> >>> target/arm/internals.h:643:G_NORETURN void
> >>> arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
> >>> target/i386/tcg/helper-tcg.h:70:G_NORETURN void
> >>> handle_unaligned_access(CPUX86State *env, vaddr vaddr,
> >>> ...
> >>>
> >>> $ git grep -w vaddr, | wc -l
> >>>        207
> >>>
> >>> What is the error/warning like?
> >>
> >> OK I could reproduce, I suppose you are building with Clang which
> >> doesn't support shadow-local so you get global warnings too (as
> >> mentioned in this patch subject...):
> >
> > No -- I generally build with gcc and only double-check the clang results to
> make sure I don't see any new failures there.
> >
> > But I've not tested "-Wshadow" with clang yet.  I found these by adding "-
> Wshadow=global" to "-Wshadow=local".  I thought it might be useful to
> address these too while we're here.
> >
> >> In file included from ../../gdbstub/trace.h:1,
> >>                    from ../../gdbstub/softmmu.c:30:
> >> trace/trace-gdbstub.h: In function
> '_nocheck__trace_gdbstub_hit_watchpoint':
> >> trace/trace-gdbstub.h:903:106: error: declaration of 'vaddr' shadows a
> >> global declaration [-Werror=shadow]
> >>     903 | static inline void _nocheck__trace_gdbstub_hit_watchpoint(const
> >> char * type, int cpu_gdb_index, uint64_t vaddr)
> >>         |
> >>                                   ~~~~~~~~~^~~~~
> >> In file included from include/sysemu/accel-ops.h:13,
> >>                    from include/sysemu/cpus.h:4,
> >>                    from ../../gdbstub/softmmu.c:21:
> >> include/exec/cpu-common.h:21:18: note: shadowed declaration is here
> >>      21 | typedef uint64_t vaddr;
> >>         |                  ^~~~~
> >> trace/trace-gdbstub.h: In function 'trace_gdbstub_hit_watchpoint':
> >> trace/trace-gdbstub.h:923:96: error: declaration of 'vaddr' shadows a
> >> global declaration [-Werror=shadow]
> >>     923 | static inline void trace_gdbstub_hit_watchpoint(const char *
> >> type, int cpu_gdb_index, uint64_t vaddr)
> >>         |
> >>                         ~~~~~~~~~^~~~~
> >> include/exec/cpu-common.h:21:18: note: shadowed declaration is here
> >>      21 | typedef uint64_t vaddr;
> >>         |                  ^~~~~
> 
> If we have to clean that for -Wshadow=global, I'm tempted to rename
> the typedef as 'vaddr_t' and keep the 'vaddr' variable names.
> 
> Richard, Anton, what do you think?

Feels like I may have strolled into uncharted territory.  I'll just drop the patch that is intended to address -Wshadow=global and resurrect it if/when we decide to take that on in general.

> >> Clang users got confused by this, IIUC Markus and Thomas idea is
> >> to only enable these warnings for GCC, enforcing them for Clang
> >> users via CI (until Clang get this option supported). Personally
> >> I'd rather enable the warning once for all, waiting for Clang
> >> support (or clean/enable global shadowing for GCC too).
> >
> > Hopefully it's helpful or at least benign if we address the shadowed globals
> under target/hexagon/ for now, even if "-Wshadow=global" is not enabled.
> >
> >> See this thread:
> >> https://lore.kernel.org/qemu-devel/11abc551-188e-85c0-fe55-
> >> b2b58d35105d@redhat.com/
> >>
> >> Regards,
> >>
> >> Phil.
diff mbox series

Patch

diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c
index 217bc7bb5a..11377ac92b 100644
--- a/target/hexagon/genptr.c
+++ b/target/hexagon/genptr.c
@@ -334,28 +334,28 @@  void gen_set_byte_i64(int N, TCGv_i64 result, TCGv src)
     tcg_gen_deposit_i64(result, result, src64, N * 8, 8);
 }
 
-static inline void gen_load_locked4u(TCGv dest, TCGv vaddr, int mem_index)
+static inline void gen_load_locked4u(TCGv dest, TCGv v_addr, int mem_index)
 {
-    tcg_gen_qemu_ld_tl(dest, vaddr, mem_index, MO_TEUL);
-    tcg_gen_mov_tl(hex_llsc_addr, vaddr);
+    tcg_gen_qemu_ld_tl(dest, v_addr, mem_index, MO_TEUL);
+    tcg_gen_mov_tl(hex_llsc_addr, v_addr);
     tcg_gen_mov_tl(hex_llsc_val, dest);
 }
 
-static inline void gen_load_locked8u(TCGv_i64 dest, TCGv vaddr, int mem_index)
+static inline void gen_load_locked8u(TCGv_i64 dest, TCGv v_addr, int mem_index)
 {
-    tcg_gen_qemu_ld_i64(dest, vaddr, mem_index, MO_TEUQ);
-    tcg_gen_mov_tl(hex_llsc_addr, vaddr);
+    tcg_gen_qemu_ld_i64(dest, v_addr, mem_index, MO_TEUQ);
+    tcg_gen_mov_tl(hex_llsc_addr, v_addr);
     tcg_gen_mov_i64(hex_llsc_val_i64, dest);
 }
 
 static inline void gen_store_conditional4(DisasContext *ctx,
-                                          TCGv pred, TCGv vaddr, TCGv src)
+                                          TCGv pred, TCGv v_addr, TCGv src)
 {
     TCGLabel *fail = gen_new_label();
     TCGLabel *done = gen_new_label();
     TCGv one, zero, tmp;
 
-    tcg_gen_brcond_tl(TCG_COND_NE, vaddr, hex_llsc_addr, fail);
+    tcg_gen_brcond_tl(TCG_COND_NE, v_addr, hex_llsc_addr, fail);
 
     one = tcg_constant_tl(0xff);
     zero = tcg_constant_tl(0);
@@ -374,13 +374,13 @@  static inline void gen_store_conditional4(DisasContext *ctx,
 }
 
 static inline void gen_store_conditional8(DisasContext *ctx,
-                                          TCGv pred, TCGv vaddr, TCGv_i64 src)
+                                          TCGv pred, TCGv v_addr, TCGv_i64 src)
 {
     TCGLabel *fail = gen_new_label();
     TCGLabel *done = gen_new_label();
     TCGv_i64 one, zero, tmp;
 
-    tcg_gen_brcond_tl(TCG_COND_NE, vaddr, hex_llsc_addr, fail);
+    tcg_gen_brcond_tl(TCG_COND_NE, v_addr, hex_llsc_addr, fail);
 
     one = tcg_constant_i64(0xff);
     zero = tcg_constant_i64(0);
@@ -407,57 +407,57 @@  static TCGv gen_slotval(DisasContext *ctx)
 }
 #endif
 
-void gen_store32(TCGv vaddr, TCGv src, int width, uint32_t slot)
+void gen_store32(TCGv v_addr, TCGv src, int width, uint32_t slot)
 {
-    tcg_gen_mov_tl(hex_store_addr[slot], vaddr);
+    tcg_gen_mov_tl(hex_store_addr[slot], v_addr);
     tcg_gen_movi_tl(hex_store_width[slot], width);
     tcg_gen_mov_tl(hex_store_val32[slot], src);
 }
 
-void gen_store1(TCGv_env cpu_env, TCGv vaddr, TCGv src, uint32_t slot)
+void gen_store1(TCGv_env cpu_env_, TCGv v_addr, TCGv src, uint32_t slot)
 {
-    gen_store32(vaddr, src, 1, slot);
+    gen_store32(v_addr, src, 1, slot);
 }
 
-void gen_store1i(TCGv_env cpu_env, TCGv vaddr, int32_t src, uint32_t slot)
+void gen_store1i(TCGv_env cpu_env_, TCGv v_addr, int32_t src, uint32_t slot)
 {
     TCGv tmp = tcg_constant_tl(src);
-    gen_store1(cpu_env, vaddr, tmp, slot);
+    gen_store1(cpu_env_, v_addr, tmp, slot);
 }
 
-void gen_store2(TCGv_env cpu_env, TCGv vaddr, TCGv src, uint32_t slot)
+void gen_store2(TCGv_env cpu_env_, TCGv v_addr, TCGv src, uint32_t slot)
 {
-    gen_store32(vaddr, src, 2, slot);
+    gen_store32(v_addr, src, 2, slot);
 }
 
-void gen_store2i(TCGv_env cpu_env, TCGv vaddr, int32_t src, uint32_t slot)
+void gen_store2i(TCGv_env cpu_env_, TCGv v_addr, int32_t src, uint32_t slot)
 {
     TCGv tmp = tcg_constant_tl(src);
-    gen_store2(cpu_env, vaddr, tmp, slot);
+    gen_store2(cpu_env_, v_addr, tmp, slot);
 }
 
-void gen_store4(TCGv_env cpu_env, TCGv vaddr, TCGv src, uint32_t slot)
+void gen_store4(TCGv_env cpu_env_, TCGv v_addr, TCGv src, uint32_t slot)
 {
-    gen_store32(vaddr, src, 4, slot);
+    gen_store32(v_addr, src, 4, slot);
 }
 
-void gen_store4i(TCGv_env cpu_env, TCGv vaddr, int32_t src, uint32_t slot)
+void gen_store4i(TCGv_env cpu_env_, TCGv v_addr, int32_t src, uint32_t slot)
 {
     TCGv tmp = tcg_constant_tl(src);
-    gen_store4(cpu_env, vaddr, tmp, slot);
+    gen_store4(cpu_env_, v_addr, tmp, slot);
 }
 
-void gen_store8(TCGv_env cpu_env, TCGv vaddr, TCGv_i64 src, uint32_t slot)
+void gen_store8(TCGv_env cpu_env_, TCGv v_addr, TCGv_i64 src, uint32_t slot)
 {
-    tcg_gen_mov_tl(hex_store_addr[slot], vaddr);
+    tcg_gen_mov_tl(hex_store_addr[slot], v_addr);
     tcg_gen_movi_tl(hex_store_width[slot], 8);
     tcg_gen_mov_i64(hex_store_val64[slot], src);
 }
 
-void gen_store8i(TCGv_env cpu_env, TCGv vaddr, int64_t src, uint32_t slot)
+void gen_store8i(TCGv_env cpu_env_, TCGv v_addr, int64_t src, uint32_t slot)
 {
     TCGv_i64 tmp = tcg_constant_i64(src);
-    gen_store8(cpu_env, vaddr, tmp, slot);
+    gen_store8(cpu_env_, v_addr, tmp, slot);
 }
 
 TCGv gen_8bitsof(TCGv result, TCGv value)
diff --git a/target/hexagon/genptr.h b/target/hexagon/genptr.h
index a4b43c2910..b1289a3e78 100644
--- a/target/hexagon/genptr.h
+++ b/target/hexagon/genptr.h
@@ -24,15 +24,15 @@ 
 
 extern const SemanticInsn opcode_genptr[];
 
-void gen_store32(TCGv vaddr, TCGv src, int width, uint32_t slot);
-void gen_store1(TCGv_env cpu_env, TCGv vaddr, TCGv src, uint32_t slot);
-void gen_store2(TCGv_env cpu_env, TCGv vaddr, TCGv src, uint32_t slot);
-void gen_store4(TCGv_env cpu_env, TCGv vaddr, TCGv src, uint32_t slot);
-void gen_store8(TCGv_env cpu_env, TCGv vaddr, TCGv_i64 src, uint32_t slot);
-void gen_store1i(TCGv_env cpu_env, TCGv vaddr, int32_t src, uint32_t slot);
-void gen_store2i(TCGv_env cpu_env, TCGv vaddr, int32_t src, uint32_t slot);
-void gen_store4i(TCGv_env cpu_env, TCGv vaddr, int32_t src, uint32_t slot);
-void gen_store8i(TCGv_env cpu_env, TCGv vaddr, int64_t src, uint32_t slot);
+void gen_store32(TCGv v_addr, TCGv src, int width, uint32_t slot);
+void gen_store1(TCGv_env cpu_env_, TCGv v_addr, TCGv src, uint32_t slot);
+void gen_store2(TCGv_env cpu_env_, TCGv v_addr, TCGv src, uint32_t slot);
+void gen_store4(TCGv_env cpu_env_, TCGv v_addr, TCGv src, uint32_t slot);
+void gen_store8(TCGv_env cpu_env_, TCGv v_addr, TCGv_i64 src, uint32_t slot);
+void gen_store1i(TCGv_env cpu_env_, TCGv v_addr, int32_t src, uint32_t slot);
+void gen_store2i(TCGv_env cpu_env_, TCGv v_addr, int32_t src, uint32_t slot);
+void gen_store4i(TCGv_env cpu_env_, TCGv v_addr, int32_t src, uint32_t slot);
+void gen_store8i(TCGv_env cpu_env_, TCGv v_addr, int64_t src, uint32_t slot);
 TCGv gen_read_reg(TCGv result, int num);
 TCGv gen_read_preg(TCGv pred, uint8_t num);
 TCGv get_result_gpr(DisasContext *ctx, int rnum);
diff --git a/target/hexagon/mmvec/system_ext_mmvec.c b/target/hexagon/mmvec/system_ext_mmvec.c
index 8351f2cc01..c339eee38b 100644
--- a/target/hexagon/mmvec/system_ext_mmvec.c
+++ b/target/hexagon/mmvec/system_ext_mmvec.c
@@ -19,12 +19,12 @@ 
 #include "cpu.h"
 #include "mmvec/system_ext_mmvec.h"
 
-void mem_gather_store(CPUHexagonState *env, target_ulong vaddr, int slot)
+void mem_gather_store(CPUHexagonState *env, target_ulong v_addr, int slot)
 {
     size_t size = sizeof(MMVector);
 
     env->vstore_pending[slot] = 1;
-    env->vstore[slot].va   = vaddr;
+    env->vstore[slot].va   = v_addr;
     env->vstore[slot].size = size;
     memcpy(&env->vstore[slot].data.ub[0], &env->tmp_VRegs[0], size);
 
diff --git a/target/hexagon/mmvec/system_ext_mmvec.h b/target/hexagon/mmvec/system_ext_mmvec.h
index bcefbffdf2..6a711fcb69 100644
--- a/target/hexagon/mmvec/system_ext_mmvec.h
+++ b/target/hexagon/mmvec/system_ext_mmvec.h
@@ -18,7 +18,7 @@ 
 #ifndef HEXAGON_SYSTEM_EXT_MMVEC_H
 #define HEXAGON_SYSTEM_EXT_MMVEC_H
 
-void mem_gather_store(CPUHexagonState *env, target_ulong vaddr, int slot);
+void mem_gather_store(CPUHexagonState *env, target_ulong v_addr, int slot);
 void mem_vector_scatter_init(CPUHexagonState *env);
 void mem_vector_gather_init(CPUHexagonState *env);
 
diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c
index da10ac5847..aeafd78887 100644
--- a/target/hexagon/op_helper.c
+++ b/target/hexagon/op_helper.c
@@ -577,12 +577,12 @@  void HELPER(probe_pkt_scalar_hvx_stores)(CPUHexagonState *env, int mask)
  * wasn't cancelled), we have to do the store first.
  */
 static void check_noshuf(CPUHexagonState *env, bool pkt_has_store_s1,
-                         uint32_t slot, target_ulong vaddr, int size,
+                         uint32_t slot, target_ulong v_addr, int size,
                          uintptr_t ra)
 {
     if (slot == 0 && pkt_has_store_s1 &&
         ((env->slot_cancelled & (1 << 1)) == 0)) {
-        probe_read(env, vaddr, size, MMU_USER_IDX, ra);
+        probe_read(env, v_addr, size, MMU_USER_IDX, ra);
         commit_store(env, 1, ra);
     }
 }