From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15210 invoked by alias); 13 Dec 2011 03:47:01 -0000 Received: (qmail 15178 invoked by uid 22791); 13 Dec 2011 03:47:00 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-iy0-f169.google.com (HELO mail-iy0-f169.google.com) (209.85.210.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Dec 2011 03:46:47 +0000 Received: by iahk25 with SMTP id k25so11429390iah.0 for ; Mon, 12 Dec 2011 19:46:46 -0800 (PST) Received: by 10.50.173.74 with SMTP id bi10mr17905783igc.4.1323747685150; Mon, 12 Dec 2011 19:41:25 -0800 (PST) Received: from localhost.localdomain (c-24-18-115-186.hsd1.wa.comcast.net. [24.18.115.186]) by mx.google.com with ESMTPS id e2sm81168651ibe.0.2011.12.12.19.41.24 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 12 Dec 2011 19:41:24 -0800 (PST) From: Andrey Smirnov To: gdb-patches@sourceware.org Cc: Andrey Smirnov Subject: [PATCH 057/238] [index] valarith.c: -Wshadow fix Date: Tue, 13 Dec 2011 03:47:00 -0000 Message-Id: <1323747545-29987-23-git-send-email-andrew.smirnov@gmail.com> In-Reply-To: <1323747545-29987-1-git-send-email-andrew.smirnov@gmail.com> References: <1323747545-29987-1-git-send-email-andrew.smirnov@gmail.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-12/txt/msg00380.txt.bz2 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