From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 109086 invoked by alias); 30 Oct 2016 02:48:00 -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 108871 invoked by uid 89); 30 Oct 2016 02:47:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=wind, H*r:4.86_1, H*F:U*tom, H*RU:cmgw4 X-HELO: gproxy1.mail.unifiedlayer.com Received: from gproxy1-pub.mail.unifiedlayer.com (HELO gproxy1.mail.unifiedlayer.com) (69.89.25.95) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 30 Oct 2016 02:47:27 +0000 Received: from cmgw4 (cmgw5 [10.0.90.85]) by gproxy1.mail.unifiedlayer.com (Postfix) with ESMTP id 5F9B7175B83 for ; Sat, 29 Oct 2016 20:47:25 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw4 with id 1enN1u00L2f2jeq01enR85; Sat, 29 Oct 2016 20:47:25 -0600 X-Authority-Analysis: v=2.1 cv=IecUBwaa 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=wLlIXMJSBqoX6T2Hn5kA:9 a=PuSIgb6VMkSJ0_1bSHE4:22 Received: from 174-16-143-211.hlrn.qwest.net ([174.16.143.211]:58502 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_1) (envelope-from ) id 1c0g9a-0003DJ-4K; Sat, 29 Oct 2016 20:47:22 -0600 From: Tom Tromey To: Manish Goregaokar Cc: gdb-patches@sourceware.org, Tom Tromey Subject: Re: [PATCH] Fix handling of discriminantless univariant enums in Rust References: Date: Sun, 30 Oct 2016 02:48:00 -0000 In-Reply-To: (Manish Goregaokar's message of "Thu, 27 Oct 2016 16:51:42 -0700") Message-ID: <87pomiwo1z.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: 1c0g9a-0003DJ-4K X-Source-Sender: 174-16-143-211.hlrn.qwest.net (bapiya) [174.16.143.211]:58502 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-SW-Source: 2016-10/txt/msg00841.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> + } This needs some small changes to conform to the GNU coding style. Also, I suspect this will wind up doing the wrong thing in the STRUCTOP_ANONYMOUS case in rust_evaluate_subexp. In particular I wonder if an additional "print univariant.0.a" test will work correctly? Tom