[PATCH 1/6] contrib/plugins/execlog: fix warning

Pierrick Bouvier posted 6 patches 3 months, 1 week ago
There is a newer version of this series
[PATCH 1/6] contrib/plugins/execlog: fix warning
Posted by Pierrick Bouvier 3 months, 1 week ago
Found on debian stable.

../contrib/plugins/execlog.c: In function ‘vcpu_tb_trans’:
../contrib/plugins/execlog.c:236:22: error: declaration of ‘n’ shadows a previous local [-Werror=shadow=local]
  236 |             for (int n = 0; n < all_reg_names->len; n++) {
      |                      ^
../contrib/plugins/execlog.c:184:12: note: shadowed declaration is here
  184 |     size_t n = qemu_plugin_tb_n_insns(tb);
      |

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 contrib/plugins/execlog.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c
index 1c1601cc0b4..d67d0107613 100644
--- a/contrib/plugins/execlog.c
+++ b/contrib/plugins/execlog.c
@@ -181,8 +181,8 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
     bool check_regs_this = rmatches;
     bool check_regs_next = false;
 
-    size_t n = qemu_plugin_tb_n_insns(tb);
-    for (size_t i = 0; i < n; i++) {
+    size_t n_insns = qemu_plugin_tb_n_insns(tb);
+    for (size_t i = 0; i < n_insns; i++) {
         char *insn_disas;
         uint64_t insn_vaddr;
 
-- 
2.39.2


Re: [PATCH 1/6] contrib/plugins/execlog: fix warning
Posted by Alexandre IOOSS 3 months, 1 week ago
On 8/15/24 01:36, Pierrick Bouvier wrote:
> Found on debian stable.
> 
> ../contrib/plugins/execlog.c: In function ‘vcpu_tb_trans’:
> ../contrib/plugins/execlog.c:236:22: error: declaration of ‘n’ shadows a previous local [-Werror=shadow=local]
>    236 |             for (int n = 0; n < all_reg_names->len; n++) {
>        |                      ^
> ../contrib/plugins/execlog.c:184:12: note: shadowed declaration is here
>    184 |     size_t n = qemu_plugin_tb_n_insns(tb);
>        |
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   contrib/plugins/execlog.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c
> index 1c1601cc0b4..d67d0107613 100644
> --- a/contrib/plugins/execlog.c
> +++ b/contrib/plugins/execlog.c
> @@ -181,8 +181,8 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
>       bool check_regs_this = rmatches;
>       bool check_regs_next = false;
>   
> -    size_t n = qemu_plugin_tb_n_insns(tb);
> -    for (size_t i = 0; i < n; i++) {
> +    size_t n_insns = qemu_plugin_tb_n_insns(tb);
> +    for (size_t i = 0; i < n_insns; i++) {
>           char *insn_disas;
>           uint64_t insn_vaddr;
>   

Reviewed-by: Alexandre Iooss <erdnaxe@crans.org>


Re: [PATCH 1/6] contrib/plugins/execlog: fix warning
Posted by Thomas Huth 3 months, 1 week ago
On 15/08/2024 01.36, Pierrick Bouvier wrote:
> Found on debian stable.
> 
> ../contrib/plugins/execlog.c: In function ‘vcpu_tb_trans’:
> ../contrib/plugins/execlog.c:236:22: error: declaration of ‘n’ shadows a previous local [-Werror=shadow=local]
>    236 |             for (int n = 0; n < all_reg_names->len; n++) {
>        |                      ^
> ../contrib/plugins/execlog.c:184:12: note: shadowed declaration is here
>    184 |     size_t n = qemu_plugin_tb_n_insns(tb);
>        |
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   contrib/plugins/execlog.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c
> index 1c1601cc0b4..d67d0107613 100644
> --- a/contrib/plugins/execlog.c
> +++ b/contrib/plugins/execlog.c
> @@ -181,8 +181,8 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
>       bool check_regs_this = rmatches;
>       bool check_regs_next = false;
>   
> -    size_t n = qemu_plugin_tb_n_insns(tb);
> -    for (size_t i = 0; i < n; i++) {
> +    size_t n_insns = qemu_plugin_tb_n_insns(tb);
> +    for (size_t i = 0; i < n_insns; i++) {
>           char *insn_disas;
>           uint64_t insn_vaddr;
>   

Reviewed-by: Thomas Huth <thuth@redhat.com>