From patchwork Sat Jun 25 14:45:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 13373 Received: (qmail 41260 invoked by alias); 25 Jun 2016 14:46:25 -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 41245 invoked by uid 89); 25 Jun 2016 14:46:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=2016-06-25 X-HELO: gproxy8-pub.mail.unifiedlayer.com Received: from gproxy8-pub.mail.unifiedlayer.com (HELO gproxy8-pub.mail.unifiedlayer.com) (67.222.33.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Sat, 25 Jun 2016 14:46:14 +0000 Received: (qmail 29868 invoked by uid 0); 25 Jun 2016 14:46:12 -0000 Received: from unknown (HELO cmgw4) (10.0.90.85) by gproxy8.mail.unifiedlayer.com with SMTP; 25 Jun 2016 14:46:12 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw4 with id B2m71t00R2f2jeq012mAUX; Sat, 25 Jun 2016 08:46:12 -0600 X-Authority-Analysis: v=2.1 cv=ecGuId0H c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=PnD2wP_eR3oA:10 a=7XZj0uCbPdcA:10 a=pD_ry4oyNxEA:10 a=zstS-IiYAAAA:8 a=BzObnAOqAAAA:8 a=s7bgqs-e0xbvb2fZMXAA:9 a=4G6NA9xxw8l3yy4pmD5M:22 a=PuSIgb6VMkSJ0_1bSHE4:22 Received: from [75.171.172.174] (port=52250 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1bGoqU-000136-S9; Sat, 25 Jun 2016 08:46:07 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [FYI] Fix formatting in rust-lang.c Date: Sat, 25 Jun 2016 08:45:59 -0600 Message-Id: <1466865959-7247-1-git-send-email-tom@tromey.com> X-Identified-User: {36111:box522.bluehost.com:elynrobi:tromey.com} {sentby:smtp auth 75.171.172.174 authed with tom+tromey.com} X-Exim-ID: 1bGoqU-000136-S9 X-Source-Sender: (bapiya.Home) [75.171.172.174]:52250 X-Source-Auth: tom+tromey.com X-Email-Count: 0 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== This fixes up a few formatting nits in rust-lang.c. Built and regtested on x86-64 Fedora 23. 2016-06-25 Tom Tromey * rust-lang.c (rust_get_disr_info, rust_print_type): Fix formatting. --- gdb/ChangeLog | 5 +++++ gdb/rust-lang.c | 42 ++++++++++++++++++++---------------------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ba49b2b..e98a565 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2016-06-25 Tom Tromey + + * rust-lang.c (rust_get_disr_info, rust_print_type): Fix + formatting. + 2016-06-25 Manish Goregaokar PR gdb/20239 diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 0e9c62c..0c56a0f 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -147,15 +147,15 @@ rust_get_disr_info (struct type *type, const gdb_byte *valaddr, field is zero. */ while ((token = strsep (&tail, "$")) != NULL) { - if (sscanf (token, "%lu", &fieldno) != 1) - { - /* We have reached the enum name, - which cannot start with a digit. */ - break; - } + if (sscanf (token, "%lu", &fieldno) != 1) + { + /* We have reached the enum name, which cannot start + with a digit. */ + break; + } if (fieldno >= TYPE_NFIELDS (member_type)) - error (_("%s refers to field after end of member type"), - RUST_ENUM_PREFIX); + error (_("%s refers to field after end of member type"), + RUST_ENUM_PREFIX); embedded_offset += TYPE_FIELD_BITPOS (member_type, fieldno) / 8; member_type = TYPE_FIELD_TYPE (member_type, fieldno); @@ -163,10 +163,7 @@ rust_get_disr_info (struct type *type, const gdb_byte *valaddr, if (token >= name + strlen (TYPE_FIELD_NAME (type, 0))) error (_("Invalid form for %s"), RUST_ENUM_PREFIX); - value = unpack_long (member_type, - valaddr + embedded_offset); - - + value = unpack_long (member_type, valaddr + embedded_offset); if (value == 0) { @@ -879,16 +876,17 @@ rust_print_type (struct type *type, const char *varstring, } fputs_filtered ("{\n", stream); - if (strncmp (TYPE_FIELD_NAME (type, 0), RUST_ENUM_PREFIX, - strlen (RUST_ENUM_PREFIX)) == 0) { - const char *zero_field = strrchr (TYPE_FIELD_NAME (type, 0), '$'); - if (zero_field != NULL && strlen (zero_field) > 1) - { - fprintfi_filtered (level + 2, stream, "%s,\n", zero_field+1); - /* There is no explicit discriminant field, skip nothing. */ - skip_to = 0; - } - } + if (strncmp (TYPE_FIELD_NAME (type, 0), RUST_ENUM_PREFIX, + strlen (RUST_ENUM_PREFIX)) == 0) + { + const char *zero_field = strrchr (TYPE_FIELD_NAME (type, 0), '$'); + if (zero_field != NULL && strlen (zero_field) > 1) + { + fprintfi_filtered (level + 2, stream, "%s,\n", zero_field + 1); + /* There is no explicit discriminant field, skip nothing. */ + skip_to = 0; + } + } for (i = 0; i < TYPE_NFIELDS (type); ++i) {