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 80C0C3858D1E for ; Mon, 30 Jan 2023 15:22:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 80C0C3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [172.16.0.192] (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 CFC2D1E112; Mon, 30 Jan 2023 10:22:12 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1675092133; bh=KhWPzQSk+4hpkADJMeA8YECktgmw723vI0jEC9m+UHc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=WF8cAzMFco6tv11B7uocPlHR57vcICNvroqUwtGAVQPLqPXk2Qi0o7WJGJ0cNbGbZ PBEsh5uAV52byA1Awn5+CjO+z6oQSep9AEKB+8YCYagHdjzhXmmQUkwx7lucxra9gp Fm9r4Fw6lW2jMC3cJgI+at145OYR1A1/Ek9gtUpw= Message-ID: Date: Mon, 30 Jan 2023 10:22:12 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH] Make addrmap const-correct in cooked index Content-Language: fr To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20230127162603.4127820-1-tromey@adacore.com> <8446b53b-bd73-637b-7613-45c896d7240f@simark.ca> <87cz6zptg4.fsf@tromey.com> <5246baed-6ebb-6299-f665-b36f02a5fe1b@simark.ca> <874js8p08f.fsf@tromey.com> From: Simon Marchi In-Reply-To: <874js8p08f.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,SPF_HELO_PASS,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: On 1/30/23 09:26, Tom Tromey via Gdb-patches wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> So, I redesigned my patch to instead provide both const and non-const > Simon> versions of find and foreach. I think it's typical for containers in > Simon> C++ anyway. See v2 below: > > This looks good to me. It addresses my objections. Thanks, will push. > Simon> diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c > Simon> index ced58eab6612..7b1b2d6520cb 100644 > Simon> --- a/gdb/dwarf2/index-write.c > Simon> +++ b/gdb/dwarf2/index-write.c > Simon> @@ -474,7 +474,7 @@ add_address_entry (data_buf &addr_vec, > Simon> int > Simon> addrmap_index_data::operator() (CORE_ADDR start_addr, void *obj) > Simon> { > Simon> - dwarf2_per_cu_data *per_cu = (dwarf2_per_cu_data *) obj; > Simon> + dwarf2_per_cu_data *per_cu = static_cast (obj); > > This area could probably be constified at some point. I think it will be, when applying you patch that constifies cooked_index_vector::get_addrmaps. Simon