[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 03/22] target/arm/hvf: Clean up local variable shadowing
From: |
Peter Maydell |
Subject: |
Re: [PATCH v2 03/22] target/arm/hvf: Clean up local variable shadowing |
Date: |
Fri, 8 Sep 2023 13:26:19 +0100 |
On Mon, 4 Sept 2023 at 17:12, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Per Peter Maydell analysis [*]:
>
> The hvf_vcpu_exec() function is not documented, but in practice
> its caller expects it to return either EXCP_DEBUG (for "this was
> a guest debug exception you need to deal with") or something else
> (presumably the intention being 0 for OK).
>
> The hvf_sysreg_read() and hvf_sysreg_write() functions are also not
> documented, but they return 0 on success, or 1 for a completely
> unrecognized sysreg where we've raised the UNDEF exception (but
> not if we raised an UNDEF exception for an unrecognized GIC sysreg --
> I think this is a bug). We use this return value to decide whether
> we need to advance the PC past the insn or not. It's not the same
> as the return value we want to return from hvf_vcpu_exec().
>
> Retain the variable as locally scoped but give it a name that
> doesn't clash with the other function-scoped variable.
>
> This fixes:
>
> target/arm/hvf/hvf.c:1936:13: error: declaration shadows a local variable
> [-Werror,-Wshadow]
> int ret = 0;
> ^
> target/arm/hvf/hvf.c:1807:9: note: previous declaration is here
> int ret;
> ^
> [*]
> CAFEAcA_e+fU6JKtS+W63wr9cCJ6btu_hT_ydZWOwC0kBkDYYYQ@mail.gmail.com/">https://lore.kernel.org/qemu-devel/CAFEAcA_e+fU6JKtS+W63wr9cCJ6btu_hT_ydZWOwC0kBkDYYYQ@mail.gmail.com/
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
- [PATCH v2 00/22] (few more) Steps towards enabling -Wshadow, Philippe Mathieu-Daudé, 2023/09/04
- [PATCH v2 01/22] tcg: Clean up local variable shadowing, Philippe Mathieu-Daudé, 2023/09/04
- [PATCH v2 02/22] target/arm/tcg: Clean up local variable shadowing, Philippe Mathieu-Daudé, 2023/09/04
- [PATCH v2 03/22] target/arm/hvf: Clean up local variable shadowing, Philippe Mathieu-Daudé, 2023/09/04
- Re: [PATCH v2 03/22] target/arm/hvf: Clean up local variable shadowing,
Peter Maydell <=
- [PATCH v2 04/22] target/mips: Clean up local variable shadowing, Philippe Mathieu-Daudé, 2023/09/04
- [PATCH v2 05/22] target/m68k: Clean up local variable shadowing, Philippe Mathieu-Daudé, 2023/09/04
- [PATCH v2 06/22] target/tricore: Clean up local variable shadowing, Philippe Mathieu-Daudé, 2023/09/04
- [PATCH v2 07/22] hw/arm/armv7m: Clean up local variable shadowing, Philippe Mathieu-Daudé, 2023/09/04
- [PATCH v2 08/22] hw/arm/virt: Clean up local variable shadowing, Philippe Mathieu-Daudé, 2023/09/04
- [PATCH v2 09/22] hw/arm/allwinner: Clean up local variable shadowing, Philippe Mathieu-Daudé, 2023/09/04
- [PATCH v2 10/22] hw/arm/aspeed: Clean up local variable shadowing, Philippe Mathieu-Daudé, 2023/09/04
- [PATCH v2 11/22] hw/ide/ahci: Clean up local variable shadowing, Philippe Mathieu-Daudé, 2023/09/04