[PATCH 0/4] RISC-V: Work towards enabling -Wshadow=local

Alistair Francis posted 4 patches 7 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230925043023.71448-1-alistair.francis@wdc.com
Maintainers: Alistair Francis <Alistair.Francis@wdc.com>, Palmer Dabbelt <palmer@dabbelt.com>, Bin Meng <bin.meng@windriver.com>, Weiwei Li <liweiwei@iscas.ac.cn>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, David Gibson <david@gibson.dropbear.id.au>
hw/riscv/opentitan.c         | 2 +-
softmmu/device_tree.c        | 6 +++---
target/riscv/cpu.c           | 4 ++--
target/riscv/vector_helper.c | 7 ++++---
4 files changed, 10 insertions(+), 9 deletions(-)
[PATCH 0/4] RISC-V: Work towards enabling -Wshadow=local
Posted by Alistair Francis 7 months, 1 week ago
Local variables shadowing other local variables or parameters make the
code needlessly hard to understand.  Bugs love to hide in such code.
Evidence: "[PATCH v3 1/7] migration/rdma: Fix save_page method to fail
on polling error".

This patch removes the local variable shadowing. Tested by adding:

    --extra-cflags='-Wshadow=local -Wno-error=shadow=local -Wno-error=shadow=compatible-local'

To configure

Alistair Francis (4):
  hw/riscv: opentitan: Fixup local variables shadowing
  target/riscv: cpu: Fixup local variables shadowing
  target/riscv: vector_helper: Fixup local variables shadowing
  softmmu/device_tree: Fixup local variables shadowing

 hw/riscv/opentitan.c         | 2 +-
 softmmu/device_tree.c        | 6 +++---
 target/riscv/cpu.c           | 4 ++--
 target/riscv/vector_helper.c | 7 ++++---
 4 files changed, 10 insertions(+), 9 deletions(-)

-- 
2.41.0
Re: [PATCH 0/4] RISC-V: Work towards enabling -Wshadow=local
Posted by Daniel Henrique Barboza 7 months, 1 week ago
CCing Markus since he might want to add these in his shadow-next tree.


Daniel

On 9/25/23 01:30, Alistair Francis wrote:
> Local variables shadowing other local variables or parameters make the
> code needlessly hard to understand.  Bugs love to hide in such code.
> Evidence: "[PATCH v3 1/7] migration/rdma: Fix save_page method to fail
> on polling error".
> 
> This patch removes the local variable shadowing. Tested by adding:
> 
>      --extra-cflags='-Wshadow=local -Wno-error=shadow=local -Wno-error=shadow=compatible-local'
> 
> To configure
> 
> Alistair Francis (4):
>    hw/riscv: opentitan: Fixup local variables shadowing
>    target/riscv: cpu: Fixup local variables shadowing
>    target/riscv: vector_helper: Fixup local variables shadowing
>    softmmu/device_tree: Fixup local variables shadowing
> 
>   hw/riscv/opentitan.c         | 2 +-
>   softmmu/device_tree.c        | 6 +++---
>   target/riscv/cpu.c           | 4 ++--
>   target/riscv/vector_helper.c | 7 ++++---
>   4 files changed, 10 insertions(+), 9 deletions(-)
>
Re: [PATCH 0/4] RISC-V: Work towards enabling -Wshadow=local
Posted by Markus Armbruster 7 months ago
Daniel Henrique Barboza <dbarboza@ventanamicro.com> writes:

> CCing Markus since he might want to add these in his shadow-next tree.

Queued, thanks!