This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 036/238] [index] i386-tdep.c: -Wshadow fix


> From: Andrey Smirnov <andrew.smirnov@gmail.com>
> Date: Mon, 12 Dec 2011 19:38:39 -0800
> 
> To ChangeLog:
> 	* i386-tdep.c (i386_record_lea_modrm_addr): Rename `index' to
> 	`idx'(-Wshadow).
> ---
>  gdb/i386-tdep.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)

My position on this is unchanged.  I think 'index' is a perfectly good
variable name, and I consider it a misfeature of -Wshadow that it
complains about this, which is fixed in recent GCC's.

Please drop the changes in this class from your set.

> diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
> index a4e3a22..e28a257 100644
> --- a/gdb/i386-tdep.c
> +++ b/gdb/i386-tdep.c
> @@ -3621,7 +3621,7 @@ i386_record_lea_modrm_addr (struct i386_record_s *irp, uint64_t *addr)
>        int havesib = 0;
>        uint8_t scale = 0;
>        uint8_t byte;
> -      uint8_t index = 0;
> +      uint8_t idx = 0;
>        uint8_t base = irp->rm;
>  
>        if (base == 4)
> @@ -3637,7 +3637,7 @@ i386_record_lea_modrm_addr (struct i386_record_s *irp, uint64_t *addr)
>  	    }
>  	  irp->addr++;
>  	  scale = (byte >> 6) & 3;
> -	  index = ((byte >> 3) & 7) | irp->rex_x;
> +	  idx = ((byte >> 3) & 7) | irp->rex_x;
>  	  base = (byte & 7);
>  	}
>        base |= irp->rex_b;
> @@ -3703,9 +3703,9 @@ i386_record_lea_modrm_addr (struct i386_record_s *irp, uint64_t *addr)
>        else
>          *addr = (uint32_t) (offset64 + *addr);
>  
> -      if (havesib && (index != 4 || scale != 0))
> +      if (havesib && (idx != 4 || scale != 0))
>  	{
> -	  regcache_raw_read_unsigned (irp->regcache, irp->regmap[index],
> +	  regcache_raw_read_unsigned (irp->regcache, irp->regmap[idx],
>                                        &offset64);
>  	  if (irp->aflag == 2)
>  	    *addr += offset64 << scale;
> -- 
> 1.7.5.4
> 
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]