From: Goncalo Gomes <goncalo@promisc.org>
To: gdb-patches@sourceware.org
Subject: Re: Minor refactoring of tdep-i386.c and exceptions.h to fix multiple gcc shadow warnings
Date: Mon, 06 Aug 2012 13:44:00 -0000 [thread overview]
Message-ID: <CADF=+baKat7ergm+=pgFe1af4nzR5aist=65xVvoHvFEU=8o4w@mail.gmail.com> (raw)
In-Reply-To: <CADF=+bZrKF-PEFTfXQVOvT1+vAwRyY4h-BjUeC5JawvQUhYDSA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 454 bytes --]
On Mon, Aug 6, 2012 at 2:42 PM, Goncalo Gomes <goncalo@promisc.org> wrote:
> The attached patch fixes all the warnings in tdep-i386.c resulting from
> enabling shadow warnings in gcc. This is the revised version of the
> patch I sent in yesterday after applying Sergio's comments.
>
> http://sourceware.org/ml/gdb-patches/2012-08/msg00152.html
>
This time with the patch and changelog attached.
--
Goncalo <goncalo@promisc.org>
http://promisc.org/
[-- Attachment #2: enable-gcc-shadow-warnings-0001.patch --]
[-- Type: application/octet-stream, Size: 5121 bytes --]
diff --git a/gdb/exceptions.h b/gdb/exceptions.h
index 0c59a25..1e8f2ec 100644
--- a/gdb/exceptions.h
+++ b/gdb/exceptions.h
@@ -145,9 +145,9 @@ int exceptions_state_mc_action_iter_1 (void);
#define TRY_CATCH(EXCEPTION,MASK) \
{ \
- EXCEPTIONS_SIGJMP_BUF *buf = \
+ EXCEPTIONS_SIGJMP_BUF *trycatch_sjbuf = \
exceptions_state_mc_init (&(EXCEPTION), (MASK)); \
- EXCEPTIONS_SIGSETJMP (*buf); \
+ EXCEPTIONS_SIGSETJMP (*trycatch_sjbuf); \
} \
while (exceptions_state_mc_action_iter ()) \
while (exceptions_state_mc_action_iter_1 ())
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 84e9794..0fca62d 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -2336,7 +2336,7 @@ i386_16_byte_align_p (struct type *type)
static CORE_ADDR
i386_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr,
- struct value **args, int nargs, struct type *value_type,
+ struct value **args, int nargs, struct type *valtype,
CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
struct regcache *regcache)
{
@@ -2514,7 +2514,7 @@ i386_store_return_value (struct gdbarch *gdbarch, struct type *type,
if (TYPE_CODE (type) == TYPE_CODE_FLT)
{
- ULONGEST fstat;
+ ULONGEST fpstat;
gdb_byte buf[I386_MAX_REGISTER_SIZE];
if (tdep->st0_regnum < 0)
@@ -2538,9 +2538,9 @@ i386_store_return_value (struct gdbarch *gdbarch, struct type *type,
actual value doesn't really matter, but 7 is what a normal
function return would end up with if the program started out
with a freshly initialized FPU. */
- regcache_raw_read_unsigned (regcache, I387_FSTAT_REGNUM (tdep), &fstat);
- fstat |= (7 << 11);
- regcache_raw_write_unsigned (regcache, I387_FSTAT_REGNUM (tdep), fstat);
+ regcache_raw_read_unsigned (regcache, I387_FSTAT_REGNUM (tdep), &fpstat);
+ fpstat |= (7 << 11);
+ regcache_raw_write_unsigned (regcache, I387_FSTAT_REGNUM (tdep), fpstat);
/* Mark %st(1) through %st(7) as empty. Since we set the top of
the floating-point register stack to 7, the appropriate value
@@ -2825,12 +2825,12 @@ i386_mmx_regnum_to_fp_regnum (struct regcache *regcache, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
int mmxreg, fpreg;
- ULONGEST fstat;
+ ULONGEST fpstat;
int tos;
mmxreg = regnum - tdep->mm0_regnum;
- regcache_raw_read_unsigned (regcache, I387_FSTAT_REGNUM (tdep), &fstat);
- tos = (fstat >> 11) & 0x7;
+ regcache_raw_read_unsigned (regcache, I387_FSTAT_REGNUM (tdep), &fpstat);
+ tos = (fpstat >> 11) & 0x7;
fpreg = (mmxreg + tos) % 8;
return (I387_ST0_REGNUM (tdep) + fpreg);
@@ -3561,8 +3561,8 @@ i386_stap_parse_special_token (struct gdbarch *gdbarch,
const char *start;
char *base;
int len_base;
- char *index;
- int len_index;
+ char *idx;
+ int len_idx;
struct stoken base_token, index_token;
if (*s == '+')
@@ -3608,16 +3608,16 @@ i386_stap_parse_special_token (struct gdbarch *gdbarch,
while (isalnum (*s))
++s;
- len_index = s - start;
- index = alloca (len_index + 1);
- strncpy (index, start, len_index);
- index[len_index] = '\0';
+ len_idx = s - start;
+ idx = alloca (len_idx + 1);
+ strncpy (idx, start, len_idx);
+ idx[len_idx] = '\0';
if (user_reg_map_name_to_regnum (gdbarch,
- index, len_index) == -1)
+ idx, len_idx) == -1)
error (_("Invalid register name `%s' "
"on expression `%s'."),
- index, p->saved_arg);
+ idx, p->saved_arg);
if (*s != ',' && *s != ')')
break;
@@ -3662,8 +3662,8 @@ i386_stap_parse_special_token (struct gdbarch *gdbarch,
write_exp_elt_opcode (BINOP_ADD);
write_exp_elt_opcode (OP_REGISTER);
- index_token.ptr = index;
- index_token.length = len_index;
+ index_token.ptr = idx;
+ index_token.length = len_idx;
write_exp_string (index_token);
write_exp_elt_opcode (OP_REGISTER);
@@ -3970,7 +3970,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)
@@ -3980,7 +3980,7 @@ i386_record_lea_modrm_addr (struct i386_record_s *irp, uint64_t *addr)
return -1;
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;
@@ -4028,9 +4028,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;
[-- Attachment #3: enable-gcc-shadow-warnings-0001.changelog --]
[-- Type: application/octet-stream, Size: 398 bytes --]
2012-08-05 Goncalo Gomes <goncalo@promisc.org>
* exceptions.h (TRY_CATCH): Rename `buf' to `trycatch_sjbuf'.
* i386-tdep.c (i386_push_dummy_code): Rename `value_type` to `valtype`.
(i386_mmx_regnum_to_fp_regnum): Rename `fstat` to `fpstat`.
(i386_stap_parse_special_token): Rename `index` to `idx`;
Rename `len_index` to `len_idx`.
(i386_record_lea_modrm_addr): Rename `index` to `idx`.
next prev parent reply other threads:[~2012-08-06 13:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-06 13:42 Goncalo Gomes
2012-08-06 13:44 ` Goncalo Gomes [this message]
2012-08-06 13:44 ` Sergio Durigan Junior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADF=+baKat7ergm+=pgFe1af4nzR5aist=65xVvoHvFEU=8o4w@mail.gmail.com' \
--to=goncalo@promisc.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox