From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 64E1A386F460 for ; Thu, 7 May 2020 14:07:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 64E1A386F460 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [10.0.0.193] (unknown [192.222.164.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 37A021E581; Thu, 7 May 2020 10:07:42 -0400 (EDT) Subject: Re: [PATCH 0/4] Move dyn prop functions to be methods of struct type To: Tom Tromey , Simon Marchi via Gdb-patches Cc: Simon Marchi References: <20200430181753.1093-1-simon.marchi@efficios.com> <877dxnzvzg.fsf@tromey.com> From: Simon Marchi Message-ID: <6bd477ef-bfe4-8570-be9e-deac5a32400c@simark.ca> Date: Thu, 7 May 2020 10:07:41 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <877dxnzvzg.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: tl Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 May 2020 14:07:53 -0000 On 2020-05-07 9:59 a.m., Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi via Gdb-patches writes: > > Simon> I'd like to start cleaning up gdbtypes.h. In particular, move some functions > Simon> and some of the TYPE_* macros to be methods of `struct type`. To test the > Simon> waters, I started with the dynamic property stuff, which is quite isolated. > > Looks good to me. I support this project in general; I don't think > macros of this form really add value. There's been a time or two in the > past where we were able to use the macros to change the representation a > little -- but that's even easier with methods. Yeah, it might have made sense before C++. There is one small thing I would change in this patch series. I have progressed a bit on that front (changed more macros to methods) and realized I probably don't want to use the prefix `get_` in the getters. It makes it long and verbose for nothing. type->get_field (0)->get_type ()->get_name () vs type->field (0)->type ()->name () Plus, existing getters on the objfile struct, for example, don't use get, so it would be more consistent. So before pushing, I would change patch 1 to rename get_dyn_prop to just dyn_prop. Simon