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 143833858430 for ; Thu, 21 Apr 2022 18:59:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 143833858430 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id D8EEB3DB10D; Thu, 21 Apr 2022 14:59:45 -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 r0X1dtpkAfvT; Thu, 21 Apr 2022 14:59:45 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 3CBEF3DB087; Thu, 21 Apr 2022 14:59:45 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 3CBEF3DB087 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 WALm012jgnxW; Thu, 21 Apr 2022 14:59:45 -0400 (EDT) Received: from [172.16.0.95] (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) by mail.efficios.com (Postfix) with ESMTPSA id F28EF3DAAFB; Thu, 21 Apr 2022 14:59:44 -0400 (EDT) Message-ID: Date: Thu, 21 Apr 2022 14:59:44 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH 10/14] gdb: remove BLOCK_CONTIGUOUS_P macro Content-Language: tl To: Lancelot SIX Cc: gdb-patches@sourceware.org References: <20220421145910.15335-1-simon.marchi@efficios.com> <20220421145910.15335-10-simon.marchi@efficios.com> <20220421181603.kp7pporaupmmbldz@ubuntu.lan> From: Simon Marchi In-Reply-To: <20220421181603.kp7pporaupmmbldz@ubuntu.lan> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3041.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, SPF_HELO_NONE, 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: Thu, 21 Apr 2022 18:59:47 -0000 On 2022-04-21 14:16, Lancelot SIX wrote: > On Thu, Apr 21, 2022 at 10:59:06AM -0400, Simon Marchi via Gdb-patches wrote: >> Replace with an equivalent method. >> >> Change-Id: I60fd3be7b4c2601c2a74328f635fa48ed80eb7f5 >> --- >> gdb/block.h | 14 ++++++++------ >> gdb/blockframe.c | 4 ++-- >> gdb/cli/cli-cmds.c | 2 +- >> 3 files changed, 11 insertions(+), 9 deletions(-) >> >> diff --git a/gdb/block.h b/gdb/block.h >> index b0f1ff04ff74..96ceea23020e 100644 >> --- a/gdb/block.h >> +++ b/gdb/block.h >> @@ -176,6 +176,13 @@ struct block >> m_ranges = ranges; >> } >> >> + /* Are all addresses within a block contiguous? */ >> + >> + bool is_contiguous () const >> + { >> + return this->ranges ().size () == 0 || this->ranges ().size () == 1; > > I guess that since gdb::array_view::size_type is size_t, so unsigned, > this can be simplified into > > return this->ranges ().size () <= 1; I made this change. > > I do not see that changing, but if this is a possibility (why would it > be?), we can add a static assert like > > gdb_static_assert (std::is_unsignedranges ().size ())>::value); I don't think we need to worry about array sizes becoming negative. Simon