From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: gdb-patches@sourceware.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH 057/238] [index] valarith.c: -Wshadow fix
Date: Tue, 13 Dec 2011 03:47:00 -0000 [thread overview]
Message-ID: <1323747545-29987-23-git-send-email-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <1323747545-29987-1-git-send-email-andrew.smirnov@gmail.com>
To ChangeLog:
* valarith.c (value_subscript): Rename index to idx(-Wshadow).
(value_subscripted_rvalue): Ditto.
(value_bitstring_subscript): Ditto.
(value_bit_index): Ditto.
---
gdb/valarith.c | 34 +++++++++++++++++-----------------
1 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 3250cc7..704be1d 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -148,7 +148,7 @@ value_ptrdiff (struct value *arg1, struct value *arg2)
verbosity is set, warn about invalid indices (but still use them). */
struct value *
-value_subscript (struct value *array, LONGEST index)
+value_subscript (struct value *array, LONGEST idx)
{
int c_style = current_language->c_style_arrays;
struct type *tarray;
@@ -164,12 +164,12 @@ value_subscript (struct value *array, LONGEST index)
get_discrete_bounds (range_type, &lowerbound, &upperbound);
if (VALUE_LVAL (array) != lval_memory)
- return value_subscripted_rvalue (array, index, lowerbound);
+ return value_subscripted_rvalue (array, idx, lowerbound);
if (c_style == 0)
{
- if (index >= lowerbound && index <= upperbound)
- return value_subscripted_rvalue (array, index, lowerbound);
+ if (idx >= lowerbound && idx <= upperbound)
+ return value_subscripted_rvalue (array, idx, lowerbound);
/* Emit warning unless we have an array of unknown size.
An array of unknown size has lowerbound 0 and upperbound -1. */
if (upperbound > -1)
@@ -178,12 +178,12 @@ value_subscript (struct value *array, LONGEST index)
c_style = 1;
}
- index -= lowerbound;
+ idx -= lowerbound;
array = value_coerce_array (array);
}
if (c_style)
- return value_ind (value_ptradd (array, index));
+ return value_ind (value_ptradd (array, idx));
else
error (_("not an array or string"));
}
@@ -193,15 +193,15 @@ value_subscript (struct value *array, LONGEST index)
to doubles, but no longer does. */
struct value *
-value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound)
+value_subscripted_rvalue (struct value *array, LONGEST idx, int lowerbound)
{
struct type *array_type = check_typedef (value_type (array));
struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type));
unsigned int elt_size = TYPE_LENGTH (elt_type);
- unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound);
+ unsigned int elt_offs = elt_size * longest_to_int (idx - lowerbound);
struct value *v;
- if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
+ if (idx < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
&& elt_offs >= TYPE_LENGTH (array_type)))
error (_("no such vector element"));
@@ -226,7 +226,7 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound)
struct value *
value_bitstring_subscript (struct type *type,
- struct value *bitstring, LONGEST index)
+ struct value *bitstring, LONGEST idx)
{
struct type *bitstring_type, *range_type;
@@ -239,14 +239,14 @@ value_bitstring_subscript (struct type *type,
range_type = TYPE_INDEX_TYPE (bitstring_type);
get_discrete_bounds (range_type, &lowerbound, &upperbound);
- if (index < lowerbound || index > upperbound)
+ if (idx < lowerbound || idx > upperbound)
error (_("bitstring index out of range"));
- index -= lowerbound;
- offset = index / TARGET_CHAR_BIT;
+ idx -= lowerbound;
+ offset = idx / TARGET_CHAR_BIT;
byte = *((char *) value_contents (bitstring) + offset);
- bit_index = index % TARGET_CHAR_BIT;
+ bit_index = idx % TARGET_CHAR_BIT;
byte >>= (gdbarch_bits_big_endian (get_type_arch (bitstring_type)) ?
TARGET_CHAR_BIT - 1 - bit_index : bit_index);
@@ -1821,7 +1821,7 @@ value_complement (struct value *arg1)
Return -1 if out of range, -2 other error. */
int
-value_bit_index (struct type *type, const gdb_byte *valaddr, int index)
+value_bit_index (struct type *type, const gdb_byte *valaddr, int idx)
{
struct gdbarch *gdbarch = get_type_arch (type);
LONGEST low_bound, high_bound;
@@ -1831,9 +1831,9 @@ value_bit_index (struct type *type, const gdb_byte *valaddr, int index)
if (get_discrete_bounds (range, &low_bound, &high_bound) < 0)
return -2;
- if (index < low_bound || index > high_bound)
+ if (idx < low_bound || idx > high_bound)
return -1;
- rel_index = index - low_bound;
+ rel_index = idx - low_bound;
word = extract_unsigned_integer (valaddr + (rel_index / TARGET_CHAR_BIT), 1,
gdbarch_byte_order (gdbarch));
rel_index %= TARGET_CHAR_BIT;
--
1.7.5.4
next prev parent reply other threads:[~2011-12-13 3:47 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-13 3:41 [PATCH 035/238] [index] python/py-evtregistry.c: " Andrey Smirnov
2011-12-13 3:41 ` [PATCH 037/238] [index] gnu-v2-abi.c: " Andrey Smirnov
2011-12-13 3:41 ` [PATCH 056/238] [index] symtab.c: " Andrey Smirnov
2011-12-13 3:41 ` [PATCH 042/238] [index] exec.c: " Andrey Smirnov
2011-12-13 3:41 ` [PATCH 049/238] [index] completer.c: " Andrey Smirnov
2011-12-13 3:41 ` [PATCH 039/238] [index] findcmd.c: " Andrey Smirnov
2011-12-13 3:41 ` [PATCH 036/238] [index] i386-tdep.c: " Andrey Smirnov
2011-12-13 8:17 ` Mark Kettenis
2011-12-13 12:36 ` Eli Zaretskii
2011-12-13 16:47 ` Mark Kettenis
2011-12-13 3:41 ` [PATCH 047/238] [index] cp-support.c: " Andrey Smirnov
2011-12-13 3:41 ` [PATCH 041/238] [index] f-typeprint.c: " Andrey Smirnov
2011-12-13 3:41 ` [PATCH 058/238] [index] valops.c: " Andrey Smirnov
2011-12-13 3:41 ` [PATCH 038/238] [index] gdbtypes.c: " Andrey Smirnov
2011-12-13 3:41 ` [PATCH 045/238] [index] dwarf2read.c: " Andrey Smirnov
2011-12-13 3:41 ` [PATCH 048/238] [index] cp-abi.c: " Andrey Smirnov
2011-12-13 3:41 ` [PATCH 043/238] [index] eval.c: " Andrey Smirnov
2011-12-13 3:46 ` [PATCH 040/238] [index] f-valprint.c " Andrey Smirnov
2011-12-13 3:46 ` [PATCH 051/238] [index] gnu-v3-abi.c: " Andrey Smirnov
2011-12-13 3:47 ` [PATCH 050/238] [index] coffread.c: " Andrey Smirnov
2011-12-13 3:47 ` [PATCH 060/238] [index] varobj.c: " Andrey Smirnov
2011-12-13 3:47 ` [PATCH 053/238] [index] parse.c: " Andrey Smirnov
2011-12-13 3:47 ` [PATCH 054/238] [index] stabsread.c: " Andrey Smirnov
2011-12-13 3:47 ` [PATCH 044/238] [index] dwarf2read.c: " Andrey Smirnov
2011-12-13 3:47 ` Andrey Smirnov [this message]
2011-12-13 3:48 ` [PATCH 061/238] [index] wrapper.c: " Andrey Smirnov
2011-12-13 3:48 ` [PATCH 046/238] [index] dcache.c: " Andrey Smirnov
2011-12-13 3:49 ` [PATCH 059/238] [index] value.c: " Andrey Smirnov
2011-12-13 3:49 ` [PATCH 055/238] [index] symmisc.c: " Andrey Smirnov
2011-12-13 3:49 ` [PATCH 062/238] [index] mi/mi-cmds.c: " Andrey Smirnov
2011-12-13 7:18 ` [PATCH 052/238] [index] linespec.c: " Andrey Smirnov
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=1323747545-29987-23-git-send-email-andrew.smirnov@gmail.com \
--to=andrew.smirnov@gmail.com \
--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