From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111158 invoked by alias); 31 Oct 2016 03:03:32 -0000 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 Received: (qmail 110924 invoked by uid 89); 31 Oct 2016 03:03:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:4.86_1, H*F:U*tom X-HELO: gproxy5-pub.mail.unifiedlayer.com Received: from gproxy5-pub.mail.unifiedlayer.com (HELO gproxy5-pub.mail.unifiedlayer.com) (67.222.38.55) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Mon, 31 Oct 2016 03:03:13 +0000 Received: (qmail 28287 invoked by uid 0); 31 Oct 2016 03:03:12 -0000 Received: from unknown (HELO cmgw2) (10.0.90.83) by gproxy5.mail.unifiedlayer.com with SMTP; 31 Oct 2016 03:03:12 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw2 with id 23371u00x2f2jeq0133AsS; Sun, 30 Oct 2016 21:03:10 -0600 X-Authority-Analysis: v=2.1 cv=PIacp5aC 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=CH0kA5CcgfcA:10 a=BzObnAOqAAAA:8 a=OtwAdbj-9_sfdZq4KgMA:9 a=PuSIgb6VMkSJ0_1bSHE4:22 Received: from 174-16-143-211.hlrn.qwest.net ([174.16.143.211]:32904 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_1) (envelope-from ) id 1c12sO-0008TR-U3; Sun, 30 Oct 2016 21:03:09 -0600 From: Tom Tromey To: Manish Goregaokar Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH] Fix handling of discriminantless univariant enums in Rust References: <87pomiwo1z.fsf@tromey.com> <87lgx6wntm.fsf@tromey.com> <87d1iiwlvx.fsf@tromey.com> Date: Mon, 31 Oct 2016 03:03:00 -0000 In-Reply-To: (Manish Goregaokar's message of "Sat, 29 Oct 2016 20:39:48 -0700") Message-ID: <874m3tw784.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-BWhitelist: no X-Exim-ID: 1c12sO-0008TR-U3 X-Source-Sender: 174-16-143-211.hlrn.qwest.net (bapiya) [174.16.143.211]:32904 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-SW-Source: 2016-10/txt/msg00850.txt.bz2 >>>>> "Manish" == Manish Goregaokar writes: Manish> + else if (TYPE_NFIELDS (type) == 1) { Manish> + /* Sometimes univariant enums are encoded without a Manish> + discriminant. In that case, treating it as an encoded enum Manish> + with the first field being the actual type works. */ Manish> + const char* field_name = TYPE_NAME (TYPE_FIELD_TYPE (type, 0)); Manish> + ret.name = concat (TYPE_NAME (type), "::", Manish> + rust_last_path_segment (field_name), Manish> + (char *) NULL); Manish> + ret.field_no = RUST_ENCODED_ENUM_REAL; Manish> + ret.is_encoded = 1; Manish> + return ret; Manish> + } Manish> if (strcmp (TYPE_FIELD_NAME (disr_type, 0), "RUST$ENUM$DISR") != 0) This still should follow GNU style. And I think a blank line after the "}". Manish> +gdb_test "print parametrized.next.val" " = Manish> \\(simple::ParametrizedStruct \\*\\) $hex" Patch mangled by mail program. No biggie but it's a pain if one wants to try it out. Manish> $hex\\}, value: 0\\}" Manish> \ No newline at end of file Please add a newline. Tom