Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: Re: [PATCH] Remove uses of "eval" from gdb testsuite
Date: Mon, 15 Sep 2025 11:15:18 -0700	[thread overview]
Message-ID: <20250915111518.0cefd70b@f41-zbm-amd> (raw)
In-Reply-To: <20250913194016.930447-1-tom@tromey.com>

On Sat, 13 Sep 2025 13:40:15 -0600
Tom Tromey <tom@tromey.com> wrote:

> This patch removes a lot of uses of the Tcl "eval" proc from the gdb
> test suite.  In most cases the {*} "splat" expansion is used instead.
> 
> A few uses of eval remain, primarily ones that were more complicated
> to untangle.
> 
> In a couple of tests I also replaced some ad hoc code with
> string_to_regexp.

I've looked it over. LGTM, though I do have one question...

> diff --git a/gdb/testsuite/lib/dap-support.exp
> b/gdb/testsuite/lib/dap-support.exp index d61b1c47f3c..3f0f75ab0ba 100644
> --- a/gdb/testsuite/lib/dap-support.exp
> +++ b/gdb/testsuite/lib/dap-support.exp
> @@ -443,7 +443,7 @@ proc dap_search_output {name rx events} {
>  # key/value pairs given in ARGS.  NAME is used as the test name.
>  proc dap_match_values {name d args} {
>      foreach {key value} $args {
> -	if {[eval dict get [list $d] $key] != $value} {
> +	if {[dict get $d {*}$key] != $value} {

Is the {*} expansion needed here?  I've looked at the callers of
dap_match_values and the key is always a plain string, so the splatted
version is equivalent to 'dict get $d $key'.  The splat would only
matter if 'key' could be a list for a nested dictionary lookup.

Kevin


  parent reply	other threads:[~2025-09-15 18:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-13 19:40 Tom Tromey
2025-09-14 15:28 ` Tom de Vries
2025-09-15 18:15 ` Kevin Buettner [this message]
2025-09-15 18:39   ` Tom Tromey
2025-09-15 18:44     ` Kevin Buettner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250915111518.0cefd70b@f41-zbm-amd \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox