diff mbox series

disas/m68k: clean up local variable shadowing

Message ID 20230925084455.395150-1-laurent@vivier.eu (mailing list archive)
State New, archived
Headers show
Series disas/m68k: clean up local variable shadowing | expand

Commit Message

Laurent Vivier Sept. 25, 2023, 8:44 a.m. UTC
Fix following warnings

.../disas/m68k.c: In function ‘print_insn_arg’:
.../disas/m68k.c:1635:13: warning: declaration of ‘val’ shadows a previous local [-Wshadow=compatible-local]
 1635 |         int val = fetch_arg (buffer, place, 5, info);
      |             ^~~
.../disas/m68k.c:1093:7: note: shadowed declaration is here
 1093 |   int val = 0;
      |       ^~~

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 disas/m68k.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Thomas Huth Sept. 26, 2023, 4:30 p.m. UTC | #1
On 25/09/2023 10.44, Laurent Vivier wrote:
> Fix following warnings
> 
> .../disas/m68k.c: In function ‘print_insn_arg’:
> .../disas/m68k.c:1635:13: warning: declaration of ‘val’ shadows a previous local [-Wshadow=compatible-local]
>   1635 |         int val = fetch_arg (buffer, place, 5, info);
>        |             ^~~
> .../disas/m68k.c:1093:7: note: shadowed declaration is here
>   1093 |   int val = 0;
>        |       ^~~
> 
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>   disas/m68k.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/disas/m68k.c b/disas/m68k.c
> index aefaecfbd6cb..1f16e295ab41 100644
> --- a/disas/m68k.c
> +++ b/disas/m68k.c
> @@ -1632,10 +1632,10 @@ print_insn_arg (const char *d,
>       case '2':
>       case '3':
>         {
> -	int val = fetch_arg (buffer, place, 5, info);
> +	int reg = fetch_arg (buffer, place, 5, info);
>           const char *name = 0;
>   
> -	switch (val)
> +	switch (reg)
>   	  {
>   	  case 2: name = "%tt0"; break;
>   	  case 3: name = "%tt1"; break;
> @@ -1655,12 +1655,12 @@ print_insn_arg (const char *d,
>   	      int break_reg = ((buffer[3] >> 2) & 7);
>   
>   	      (*info->fprintf_func)
> -		(info->stream, val == 0x1c ? "%%bad%d" : "%%bac%d",
> +		(info->stream, reg == 0x1c ? "%%bad%d" : "%%bac%d",
>   		 break_reg);
>   	    }
>   	    break;
>   	  default:
> -	    (*info->fprintf_func) (info->stream, "<mmu register %d>", val);
> +	    (*info->fprintf_func) (info->stream, "<mmu register %d>", reg);
>   	  }
>   	if (name)
>   	  (*info->fprintf_func) (info->stream, "%s", name);

Reviewed-by: Thomas Huth <thuth@redhat.com>
Markus Armbruster Sept. 29, 2023, 6:58 a.m. UTC | #2
Laurent Vivier <laurent@vivier.eu> writes:

> Fix following warnings
>
> .../disas/m68k.c: In function ‘print_insn_arg’:
> .../disas/m68k.c:1635:13: warning: declaration of ‘val’ shadows a previous local [-Wshadow=compatible-local]
>  1635 |         int val = fetch_arg (buffer, place, 5, info);
>       |             ^~~
> .../disas/m68k.c:1093:7: note: shadowed declaration is here
>  1093 |   int val = 0;
>       |       ^~~
>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>

Queued, thanks!
diff mbox series

Patch

diff --git a/disas/m68k.c b/disas/m68k.c
index aefaecfbd6cb..1f16e295ab41 100644
--- a/disas/m68k.c
+++ b/disas/m68k.c
@@ -1632,10 +1632,10 @@  print_insn_arg (const char *d,
     case '2':
     case '3':
       {
-	int val = fetch_arg (buffer, place, 5, info);
+	int reg = fetch_arg (buffer, place, 5, info);
         const char *name = 0;
 
-	switch (val)
+	switch (reg)
 	  {
 	  case 2: name = "%tt0"; break;
 	  case 3: name = "%tt1"; break;
@@ -1655,12 +1655,12 @@  print_insn_arg (const char *d,
 	      int break_reg = ((buffer[3] >> 2) & 7);
 
 	      (*info->fprintf_func)
-		(info->stream, val == 0x1c ? "%%bad%d" : "%%bac%d",
+		(info->stream, reg == 0x1c ? "%%bad%d" : "%%bac%d",
 		 break_reg);
 	    }
 	    break;
 	  default:
-	    (*info->fprintf_func) (info->stream, "<mmu register %d>", val);
+	    (*info->fprintf_func) (info->stream, "<mmu register %d>", reg);
 	  }
 	if (name)
 	  (*info->fprintf_func) (info->stream, "%s", name);