From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31865 invoked by alias); 5 Aug 2019 02:39:28 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 31856 invoked by uid 89); 5 Aug 2019 02:39:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Spam-Relays-External:Sendmail, H*RU:Sendmail, Marchi, marchi X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 05 Aug 2019 02:39:26 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id x752dHCx023281 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 4 Aug 2019 22:39:23 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca x752dHCx023281 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1564972764; bh=9PM0EEVWg5964fHJTK/svO1rEq+j2W7bRCeKGH8vYOw=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=L38tfC1uJfaio/oKlzozFp5y11ETsb1qicUXvpuCj3T56P6AevdUoH0njb2iFekjq +VQaMhToj+TIuiBEJIhht71Z//52QSkFsTTdf+PNTF72AJUNJ6OYDPxLEkBIOkwsjx 6XqKxZwjXrbTDMeWe7FpAOjo8lqIp9wGievIKl4s= Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id DA29A1E05C; Sun, 4 Aug 2019 22:39:16 -0400 (EDT) Subject: Re: [PATCH] Remove some variables in favor of using gdb::optional To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20190804201023.25628-1-simon.marchi@polymtl.ca> <874l2wiq3t.fsf@tromey.com> From: Simon Marchi Message-ID: Date: Mon, 05 Aug 2019 02:39:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <874l2wiq3t.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-08/txt/msg00100.txt.bz2 On 2019-08-04 5:21 p.m., Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> While reading that code, I noticed that some variables essentially meant > Simon> whether to consider some other variable or not. I think using > Simon> gdb::optional (which was not available when this code was written) is > Simon> clearer, as it embeds the used/not used predicate directly in the type > Simon> of the variable, making it harder to miss. > > Thanks, this looks reasonable to me. Thanks, I'll push it momentarily. > Simon> + /* If set, only look for symbols that match that block. Valid values are > Simon> + GLOBAL_BLOCK and STATIC_BLOCK. */ > Simon> + gdb::optional block_index; > > I guess optional would be even better here. Yeah, I started doing this, but then thought I would do it as a separate patch, changing the quick_symbol_functions::lookup_symbol interface, and all it impacts. Simon