From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.efficios.com (mail.efficios.com [167.114.26.124]) by sourceware.org (Postfix) with ESMTPS id E8839385C426 for ; Sat, 23 May 2020 21:22:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E8839385C426 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 856622B7013; Sat, 23 May 2020 17:22:24 -0400 (EDT) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 0vx4LhpCyod5; Sat, 23 May 2020 17:22:24 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 2384A2B6CCB; Sat, 23 May 2020 17:22:24 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 2384A2B6CCB X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 9z0Pl9Z0v6up; Sat, 23 May 2020 17:22:24 -0400 (EDT) Received: from [10.0.0.11] (173-246-6-90.qc.cable.ebox.net [173.246.6.90]) by mail.efficios.com (Postfix) with ESMTPSA id 12DBF2B6DBC; Sat, 23 May 2020 17:22:24 -0400 (EDT) Subject: Re: [PATCH] gdb: remove TYPE_FIELD macro To: Tom Tromey , Simon Marchi via Gdb-patches References: <20200522212722.5854-1-simon.marchi@efficios.com> <87eeratm07.fsf@tromey.com> From: Simon Marchi Message-ID: Date: Sat, 23 May 2020 17:22:23 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <87eeratm07.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, 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: Sat, 23 May 2020 21:22:26 -0000 On 2020-05-23 4:49 p.m., Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi via Gdb-patches writes: > > Simon> Replace all uses of it by type::field. > > Looks good. Thanks, I'll push the patch then. > Simon> Note that since type::field returns a reference to the field, some spots > Simon> are used to assign the whole field structure. See ctfread.c, function > Simon> attach_fields_to_type, for example. This is the same as was happening > Simon> with the macro, so I don't think it's a problem, but if anybody sees a > Simon> really nicer way to do this, now could be a good time to implement it. > > Ultimately I imagine we'll just want a way to set all the fields at > once, perhaps making a copy of them if needed; and then disallow writing > to a field. > > Tom > Perhaps, I'm not really there yet. I think it will still be useful to set just one field, some languages do that I believe. But it could be using a type::set_field method, this way it's easier to trace / debug. Forcing to set all the fields at once would just force the callers to do more work, without any benefit. If they copy the whole field array, make a modification, then set the whole field array, it's essentially the same as just setting that single field, isn't it? Simon