From patchwork Fri Oct 9 21:41:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Brobecker X-Patchwork-Id: 9026 Received: (qmail 19665 invoked by alias); 9 Oct 2015 21:42:13 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 19583 invoked by uid 89); 9 Oct 2015 21:42:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 09 Oct 2015 21:42:09 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id F2BCA29080 for ; Fri, 9 Oct 2015 17:42:07 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id jUlY3glfTXVN for ; Fri, 9 Oct 2015 17:42:07 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id C591228F8A for ; Fri, 9 Oct 2015 17:42:07 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 645FA42BBB; Fri, 9 Oct 2015 14:42:06 -0700 (PDT) From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [PATCH 3/8] Reorder variable declarations in ada_value_primitive_packed_val Date: Fri, 9 Oct 2015 14:41:56 -0700 Message-Id: <1444426921-19985-4-git-send-email-brobecker@adacore.com> In-Reply-To: <1444426921-19985-1-git-send-email-brobecker@adacore.com> References: <1444426921-19985-1-git-send-email-brobecker@adacore.com> This patch just changes the order in which local variables are declared so as to group the logically-related variables together. No code change otherwise. gdb/ChangeLog: * ada-lang.c (ada_value_primitive_packed_val): Reorder local variable declarations. --- gdb/ChangeLog | 5 +++++ gdb/ada-lang.c | 22 +++++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ff3e7d5..968992e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2015-10-09 Joel Brobecker + * ada-lang.c (ada_value_primitive_packed_val): Reorder local + variable declarations. + +2015-10-09 Joel Brobecker + * ada-lang.c (ada_value_primitive_packed_val): Change the type of local variables src and unpacked to "gdb_type *" instead of "unsigned char *". diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index a5e68d5..1dbbb07 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -2398,19 +2398,23 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr, struct type *type) { struct value *v; - int src_idx, /* Index into the source area */ - unpacked_idx, /* Index into the unpacked buffer */ - srcBitsLeft, /* Number of source bits left to move */ - src_bytes_left, /* Number of source bytes left to process. */ - unpacked_bytes_left, /* Number of bytes left to set in unpacked. */ - unusedLS, /* Number of bits in next significant - byte of source that are unused */ - accumSize; /* Number of meaningful bits in accum */ + gdb_byte *src; /* First byte containing data to unpack */ + int src_len = (bit_size + bit_offset + HOST_CHAR_BIT - 1) / 8; + int src_idx; /* Index into the source area */ + int src_bytes_left; /* Number of source bytes left to process. */ + int srcBitsLeft; /* Number of source bits left to move */ + int unusedLS; /* Number of bits in next significant + byte of source that are unused */ + gdb_byte *unpacked; + int unpacked_idx; /* Index into the unpacked buffer */ + int unpacked_bytes_left; /* Number of bytes left to set in unpacked. */ + unsigned long accum; /* Staging area for bits being transferred */ + int accumSize; /* Number of meaningful bits in accum */ unsigned char sign; - int src_len = (bit_size + bit_offset + HOST_CHAR_BIT - 1) / 8; + /* Transmit bytes from least to most significant; delta is the direction the indices move. */ int delta = gdbarch_bits_big_endian (get_type_arch (type)) ? -1 : 1;