From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 041413857B8A for ; Mon, 25 Jul 2022 11:27:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 041413857B8A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from tarox.wildebeest.org (83-87-18-245.cable.dynamic.v4.ziggo.nl [83.87.18.245]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id E0ADF303C3D5; Mon, 25 Jul 2022 13:27:42 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id EA0A6413CBBB; Mon, 25 Jul 2022 13:27:41 +0200 (CEST) Message-ID: <69bba9c7a09fb71b357265a0e3bc1103bb67159c.camel@klomp.org> Subject: Re: [PATCH] Rename gdbarch_tdep template function to gdbarch_tdep_cast for g++ 4.8 From: Mark Wielaard To: Andrew Burgess , gdb-patches@sourceware.org Date: Mon, 25 Jul 2022 13:27:41 +0200 In-Reply-To: <87fsipa18p.fsf@redhat.com> References: <20220723000228.33276-1-mark@klomp.org> <87fsipa18p.fsf@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Evolution 3.28.5 (3.28.5-10.el7) Mime-Version: 1.0 X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, KAM_NUMSUBJECT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Mon, 25 Jul 2022 11:27:45 -0000 Hi Andrew, On Mon, 2022-07-25 at 12:19 +0100, Andrew Burgess wrote: > Mark Wielaard writes: >=20 > > commit 08106042d "gdb: move the type cast into gdbarch_tdep" created > > a template function with the same name as a struct gdbarch_tdep. This > > confused g++ 4.8 believing the struct gdbarch_tdep was an incomplete > > type. Fix this by renaming the template function to gdbarch_tdep_cast. >=20 > Honestly, I'm not a fan of the proposed new name. Using names that end > in _cast should, I think, be reserved for functions that exhibit casting > like behaviour, i.e. take an object, or pointer, and return the same > object, or pointer, converted to some alternative type, which isn't what > we're doing here. >=20 > Instead of renaming the function, I'd like to propose that we rename the > structure instead, so 'struct gdbarch_tdep' to 'struct > gdbarch_tdep_base'. >=20 > Given the structure is only ever used as a base class, I think the new > name is good, and this allows the function name to be left unchanged. >=20 > I tested this on a CentOS VM using g++ 4.8.5, and it seems to build > fine. >=20 > Thoughts? I agree with your reasoning. And now that you mention it I don't know why I did rename the "cast" function instead of the base struct name. I like your patch better. Thanks, Mark