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 980133858D37 for ; Tue, 30 Jun 2020 22:26:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 980133858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [172.16.0.95] (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) (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 A4F331E797; Tue, 30 Jun 2020 18:26:12 -0400 (EDT) Subject: Re: [PATCH 1/3] gdb: remove callback in macro expand functions To: Matt Rice , Tom Tromey Cc: Simon Marchi , Simon Marchi via Gdb-patches References: <20200628165628.96730-1-simon.marchi@polymtl.ca> <20200628165628.96730-2-simon.marchi@polymtl.ca> <87zh8k8emo.fsf@tromey.com> From: Simon Marchi Message-ID: <40adf4ea-fa92-9051-e1a7-626dd8496a03@simark.ca> Date: Tue, 30 Jun 2020 18:26:12 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: tl Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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, 30 Jun 2020 22:26:14 -0000 On 2020-06-30 6:14 p.m., Matt Rice via Gdb-patches wrote: > On Tue, Jun 30, 2020 at 8:47 PM Tom Tromey wrote: >> >>>>>>> "Simon" == Simon Marchi via Gdb-patches writes: >> >> Simon> From: Simon Marchi >> Simon> I started to look into changing the callbacks in macroexp.h to use >> Simon> gdb::function_view. However, I noticed that the passed lookup function >> Simon> was always `standard_macro_lookup`, which looks up a macro in a >> Simon> `macro_scope` object. Since that doesn't look like a very useful >> Simon> abstraction, it would be simpler to just pass the scope around and have >> Simon> the various functions call standard_macro_lookup themselves. This is >> Simon> what this patch does. >> >> This seems fine to me. >> >> I don't remember, but maybe this lookup function used to vary at some >> point in the past. That would explain the abstraction anyway. Or maybe >> it was just planned somehow. > > It looks like it never varied, I think that perhaps varying it could > have been in anticipation of the > macro_expand_once, for storing partial expansion tables in the baton > perhaps, it looks like > all the other unimplemented commands at the time of initial commit > have been implemented without it > (though I didn't do an exhaustive look) anyhow that is just a guess *shrug*. > Ok, thanks for checking. In any case, if this abstraction is ever actually needed, it won't be really hard to add it back. And if not, then we can just enjoy the simpler code. Simon