From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 107400 invoked by alias); 27 Jun 2016 16:26: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 107383 invoked by uid 89); 27 Jun 2016 16:26:32 -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=Hx-languages-length:1162, experiment X-HELO: gproxy2-pub.mail.unifiedlayer.com Received: from gproxy2-pub.mail.unifiedlayer.com (HELO gproxy2-pub.mail.unifiedlayer.com) (69.89.18.3) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Mon, 27 Jun 2016 16:26:21 +0000 Received: (qmail 9493 invoked by uid 0); 27 Jun 2016 16:26:19 -0000 Received: from unknown (HELO cmgw4) (10.0.90.85) by gproxy2.mail.unifiedlayer.com with SMTP; 27 Jun 2016 16:26:19 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw4 with id BsSG1t01F2f2jeq01sSKUQ; Mon, 27 Jun 2016 10:26:19 -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=mRzexv5R2uSsa7-ZVJgA:9 Received: from [75.171.172.174] (port=41828 helo=pokyo) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1bHZMW-0000B5-Ih; Mon, 27 Jun 2016 10:26:16 -0600 From: Tom Tromey To: Tom Tromey Cc: Manish Goregaokar , gdb-patches@sourceware.org Subject: Re: [PATCH] Print void types correctly in Rust References: <8760suk3qg.fsf@tromey.com> Date: Mon, 27 Jun 2016 16:26:00 -0000 In-Reply-To: <8760suk3qg.fsf@tromey.com> (Tom Tromey's message of "Mon, 27 Jun 2016 10:15:19 -0600") Message-ID: <871t3ik38a.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.95 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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: 1bHZMW-0000B5-Ih X-Source-Sender: (pokyo) [75.171.172.174]:41828 X-Source-Auth: tom+tromey.com X-Email-Count: 0 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-SW-Source: 2016-06/txt/msg00450.txt.bz2 Tom> ... I wonder if that is something that changed after 1.8, or if it's the Tom> case that the unit type can be represented in multiple ways. (Or maybe Tom> this only handles the unit type constructed by rust_language_arch_info?) [...] Manish> +// Empty function, should not have "void" Manish> +// or "()" in its return type Manish> +fn empty() { Tom> I'm curious what happens if it does say "-> ()"? I did the experiment myself and I think I see what's going on now. For an explicit "()", like "let y = ()", we'll end up with a zero-sized integer type: <1><98>: Abbrev Number: 7 (DW_TAG_base_type) <99> DW_AT_name : (indirect string, offset: 0x88): () <9d> DW_AT_encoding : 7 (unsigned) <9e> DW_AT_byte_size : 0 However, "fn empty()" (or in my experiment also "fn empty()->()"), the type is left unspecified in the DWARF, which gdb turns into TYPE_CODE_VOID (see dwarf2read.c:read_unspecified_type). I think both have to be handled. However I think it's fine to do some cleanup in a follow-up patch, which I'm happy to do. So your patch is OK with the ChangeLog entry and the indentation fixed. Tom