From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lndn.lancelotsix.com (lndn.lancelotsix.com [51.195.220.111]) by sourceware.org (Postfix) with ESMTPS id 457373858020 for ; Wed, 11 Oct 2023 08:49:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 457373858020 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=lancelotsix.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lancelotsix.com Received: from octopus (cust120-dsl54.idnet.net [212.69.54.120]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id 4792A8095C; Wed, 11 Oct 2023 08:49:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lancelotsix.com; s=2021; t=1697014142; bh=2uSrgFkFQWuClXkpg5OoPVpoYIUWYT2w2K0H5ZkWOC4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JZe8T/pX2D7dmX/bfzLkYGxxBCLOqTR7okPea4aC9ybqCv9MkBLYgzwi0BBqAZBQD iq+Jnv/rnReDQRe+xA9Je6+luCuCIMPw14014DZwSnHYq7eo3YsQag/y5aPPzczv+B AsBkOaZZHMWNugCYK9ryFa+L/UYTkC8O2eoOaKC/Ph216CBXF949iMhay1Mw4JVdTw v0UV7PxqQF9mrbPY8a30HEMCopdcffoSCGD+vr0innn9Vd75SD6EC855/8ajh633wf vR9J+Q6/ZQo7lXQsz6KAGdMfWEXNEQRpxWgRxQ3cJowYJbiJitq7hAcy6i9zPCv+am eILMMD3f/Cxrw== Date: Wed, 11 Oct 2023 09:48:53 +0100 From: Lancelot SIX To: Simon Marchi Cc: gdb-patches@sourceware.org, Simon Marchi Subject: Re: [PATCH 03/24] gdb: make interps_notify work with references Message-ID: <20231011084853.uas5bmm7nxnupoyw@octopus> References: <20231010204213.111285-1-simon.marchi@efficios.com> <20231010204213.111285-4-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231010204213.111285-4-simon.marchi@efficios.com> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (lndn.lancelotsix.com [0.0.0.0]); Wed, 11 Oct 2023 08:49:02 +0000 (UTC) X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Simon, Just a nit below. On Tue, Oct 10, 2023 at 04:39:58PM -0400, Simon Marchi wrote: > From: Simon Marchi > > A subsequent patch changes the interp::on_solib_loaded and > interp::on_solib_unloaded methods to take references. This highlighted > that interps_notify did not work with reference parameters. > > Fix that by changing interps_notify's `args` arg to be a universal > reference (&&). Change the type of the method to be auto-deduced as an > additional template parameter, otherwise the signature of the callback > function would never match: > > CXX interps.o > /home/simark/src/binutils-gdb/gdb/interps.c: In function ‘void interps_notify_signal_received(gdb_signal)’: > /home/simark/src/binutils-gdb/gdb/interps.c:378:18: error: no matching function for call to ‘interps_notify(void (interp::*)(gdb_signal), gdb_signal&)’ > 378 | interps_notify (&interp::on_signal_received, sig); > | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > /home/simark/src/binutils-gdb/gdb/interps.c:363:1: note: candidate: ‘template void interps_notify(void (interp::*)(Args ...), Args&& ...)’ > 363 | interps_notify (void (interp::*method) (Args...), Args&&... args) > | ^~~~~~~~~~~~~~ > /home/simark/src/binutils-gdb/gdb/interps.c:363:1: note: template argument deduction/substitution failed: > /home/simark/src/binutils-gdb/gdb/interps.c:378:18: note: inconsistent parameter pack deduction with ‘gdb_signal’ and ‘gdb_signal&’ > 378 | interps_notify (&interp::on_signal_received, sig); > | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Change-Id: I0cd9378e24ef039f30f8e14f054f8d7fb539c838 > --- > gdb/interps.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/gdb/interps.c b/gdb/interps.c > index f91b2b62c1ba..62a30583e8c0 100644 > --- a/gdb/interps.c > +++ b/gdb/interps.c > @@ -358,15 +358,15 @@ current_interpreter (void) > /* Helper interps_notify_* functions. Call METHOD on the top-level interpreter > of all UIs. */ > > -template > +template > void > -interps_notify (void (interp::*method) (Args...), Args... args) > +interps_notify (MethodType method, Args&&... args) > { > SWITCH_THRU_ALL_UIS () > { > interp *tli = top_level_interpreter (); > if (tli != nullptr) > - (tli->*method) (args...); > + (tli->*method) (std::forward(args)...); ^ Space missing before the "(". Best, Lancelot. > } > } > > -- > 2.42.0 >