From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 6332C3858C2C for ; Fri, 1 Oct 2021 02:27:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6332C3858C2C 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 1912RenE021072 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 30 Sep 2021 22:27:45 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 1912RenE021072 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (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 D518B1E4A3 for ; Thu, 30 Sep 2021 22:27:40 -0400 (EDT) Message-ID: <111b8bd0-6577-e0da-d3e9-832f62e8b974@polymtl.ca> Date: Thu, 30 Sep 2021 22:27:39 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.1 Subject: Re: [PATCH 1/2] gdb/testsuite/dwarf: don't define nested procs for rnglists/loclists Content-Language: en-US To: gdb-patches@sourceware.org References: <20210830152059.1426626-1-simon.marchi@polymtl.ca> From: Simon Marchi In-Reply-To: <20210830152059.1426626-1-simon.marchi@polymtl.ca> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 1 Oct 2021 02:27:40 +0000 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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: Fri, 01 Oct 2021 02:27:47 -0000 On 2021-08-30 11:20, Simon Marchi wrote: > When I wrote support for rnglists and loclists in the testsuite's DWARF > assembler, I made it with nested procs, for example proc "table" inside > proc "rnglists". The intention was that this proc "table" could only be > used by the user while inside proc "rnglists"'s body. I had chosen very > simple names, thinking there was no chance of name clashes. I recently > learned that this is not how TCL works. This ends up defining a proc > "table" in the current namespace ("Dwarf" in this case). > > Things still work if you generate rnglists and loclists in the same > file, as each redefines its own procedures when executing. But if a > user of the assembler happened to define a convenience "table" or > "start_end" procedure, for example, it would get overriden. > > I'd like to change how this works to reduce the chances of a name clash. > > - Move the procs out of each other, so they are not defined in a nested > fashion. > - Prefix them with "_rnglists_" or "_loclists_". > - While calling $body in the various procs, temporarily make the procs > available under their "short" name. For example, while in rngllists' > body, make _rnglists_table available as just "table". This allows > existing code to keep working and keeps it not too verbose. > - Modify with_override to allow the overriden proc to not exist. In > that case, the temporary proc is deleted on exit. > > Note the non-conforming indentation when calling with_override in > _loclists_list. This is on purpose: as we implement more loclists (and > rnglists) entry types, the indentation would otherwise get larger and > larger without much value for readability. So I think it's reasonable > here to put them on the same level. > > Change-Id: I7bb48d26fcb0dba1ae4dada05c0c837212424328 I pushed these two patches. Simon