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 45F213858D28 for ; Tue, 23 Nov 2021 21:33:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 45F213858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [172.16.0.95] (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id DDEEC1EDF0; Tue, 23 Nov 2021 16:33:31 -0500 (EST) Subject: Re: [PATCH 2/4] gdb/remote: merge ::is_async_p and ::can_async_p methods To: Andrew Burgess , gdb-patches@sourceware.org References: <9c8428eee795182bb60ed37752e48db404ea9307.1637676250.git.aburgess@redhat.com> From: Simon Marchi Message-ID: Date: Tue, 23 Nov 2021 16:33:31 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <9c8428eee795182bb60ed37752e48db404ea9307.1637676250.git.aburgess@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: tl Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Tue, 23 Nov 2021 21:33:33 -0000 On 2021-11-23 9:08 a.m., Andrew Burgess via Gdb-patches wrote: > I spotted in passing that remote_target::is_async_p and > remote_target::can_async_p are identical. This commit just makes > ::is_async_p call ::can_async_p, removing some duplicate code. > > There should be no user visible changes after this commit. > --- > gdb/remote.c | 18 ++++-------------- > 1 file changed, 4 insertions(+), 14 deletions(-) > > diff --git a/gdb/remote.c b/gdb/remote.c > index 61bde5aaa94..0c4cc6bad0b 100644 > --- a/gdb/remote.c > +++ b/gdb/remote.c > @@ -546,7 +546,10 @@ class remote_target : public process_stratum_target > > bool can_async_p () override; > > - bool is_async_p () override; > + bool is_async_p () override > + { > + return can_async_p (); > + } > > void async (int) override; > > @@ -14390,19 +14393,6 @@ remote_target::can_async_p () > return serial_can_async_p (rs->remote_desc); > } > > -bool > -remote_target::is_async_p () > -{ > - struct remote_state *rs = get_remote_state (); > - > - if (!target_async_permitted) > - /* We only enable async when the user specifically asks for it. */ > - return false; > - > - /* We're async whenever the serial device is. */ > - return serial_is_async_p (rs->remote_desc); > -} > - > /* Pass the SERIAL event on and up to the client. One day this code > will be able to delay notifying the client of an event until the > point where an entire packet has been received. */ > -- > 2.25.4 > Hmm, one calls serial_can_async_p and the other calls serial_is_async_p, I would guess that the distinction is important. Simon