From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 8aCNKzgAqmj2rAoAWB0awg (envelope-from ) for ; Sat, 23 Aug 2025 13:54:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1755971640; bh=o3lYqWOjC5qc+r4Idzo2j0oDB7CNT2JAlt2t8rlVj4A=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=AYXT5zVo9NbgZOHe8bawN/QKM9aF5MvowfB0Kwe9wJNfeMS3zU/6P7in1QyC6fa33 izcSJxwxDbHTkbGUOUq7CIzHMfCmnM6PqU+OSpdtiaSQaWWa9Da0un90WEZW1PIxly YZgkiMa/Y5pYmO+bmiL0AUUq+SCGEzZPhVOp9Wlg= Received: by simark.ca (Postfix, from userid 112) id A1EC01E023; Sat, 23 Aug 2025 13:54:00 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=no autolearn_force=no version=4.0.1 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=VPXGIRAM; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 0DD951E023 for ; Sat, 23 Aug 2025 13:54:00 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A3E18385842B for ; Sat, 23 Aug 2025 17:53:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A3E18385842B Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=VPXGIRAM Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 968103858D29 for ; Sat, 23 Aug 2025 17:53:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 968103858D29 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 968103858D29 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1755971611; cv=none; b=LwzvAp5RrueHmWuv5bhgsUGmYLLfLbCqocg7zEuKjEnK//qOKVtQ++mkc5hVxfVqRwJmMk2/L691SNSHLLKIz55I/25/eznyJXdF6hRJbO9jXqNplXiCJ6ucsckwJGTmFqzM/j0XkD3NhwtRMrYhGhofX/wL/6HcQv0M6lWJuoc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1755971611; c=relaxed/simple; bh=o3lYqWOjC5qc+r4Idzo2j0oDB7CNT2JAlt2t8rlVj4A=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=YI05tNMiY2XrsHxjPeX2iAnF0xS5Zvq9/zNj2Y5wcL1jOgwM45zxaO63jHnWZ1GURyJtZ6G8799DK3kB3W7r4xFd//M1iob/rr4uCUY5df58p9xXfOxI6TM7xnJ4CnmwILGfHaSFtV5yrKHWIPkhuu9qr24MsZtMsoRrpCRnYL0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 968103858D29 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1755971611; bh=o3lYqWOjC5qc+r4Idzo2j0oDB7CNT2JAlt2t8rlVj4A=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=VPXGIRAM0Vow2oGyKpaPg3XkKixj8bx5ttlnW6ufjqW7ICFXW2lGxVx5N9Zt8kfyz L++Ni5v0Qob2Vr0ml4VN2fvtkUisCaWLHAgnrv/uQTN9NIhdB6IAbhgiOSaW8TGGn0 37N/NRygkrF468W+fLy9gDOiWrRzidtOc8rTKMa4= Received: by simark.ca (Postfix) id 060921E023; Sat, 23 Aug 2025 13:53:30 -0400 (EDT) Message-ID: Date: Sat, 23 Aug 2025 13:53:30 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/5] [gdb] Make addrmap_mutable::insert_empty return bool To: Tom de Vries , Tom Tromey Cc: gdb-patches@sourceware.org References: <20250821133114.24091-1-tdevries@suse.de> <20250821133114.24091-3-tdevries@suse.de> <87a53rkx5v.fsf@tromey.com> Content-Language: en-US From: Simon Marchi In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 2025-08-23 00:20, Tom de Vries wrote: > On 8/22/25 20:51, Tom Tromey wrote: >>>>>>> "Tom" == Tom de Vries writes: >> >> Tom> @@ -234,8 +235,14 @@ addrmap_mutable::set_empty (CORE_ADDR start, CORE_ADDR end_inclusive, >> Tom> n && addrmap_node_key (n) <= end_inclusive; >> Tom> n = splay_tree_successor (addrmap_node_key (n))) >> Tom> { >> Tom> - if (! addrmap_node_value (n)) >> Tom> - addrmap_node_set_value (n, obj); >> Tom> + if (addrmap_node_value (n)) >> Tom> + { >> Tom> + /* Already mapped. */ >> Tom> + full_range = false; >> Tom> + continue; >> Tom> + } >> Tom> + >> Tom> + addrmap_node_set_value (n, obj); >> >> I think using 'else' here would be better than 'continue', since loop >> short-circuits are harder to understand. > > Hi Tom, > > thanks for the review. > > I've pushed this using an if/else. > > FWIW, I still think that they way I wrote is is much better. My opinion is based on this coding standard rule ( https://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code ). I also like early returns and early continue in loops. It tells me: you don't need to think about that case for the rest of the function loop. Simon