diff options
author | Tom de Vries <tdevries@suse.de> | 2025-09-16 22:03:43 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2025-09-16 22:03:43 +0200 |
commit | 27fa4f023851dd36c0d1dd03705eec42c483caef (patch) | |
tree | 4cf6ef7cdf802868bb6d243154d6c3961286e64e | |
parent | 75e10462f6776dfde22b800415eef5928cb9caf3 (diff) | |
download | binutils-master.zip binutils-master.tar.gz binutils-master.tar.bz2 |
Remove some more uses of the Tcl "eval" proc.
In most cases the {*} "splat" expansion is used instead.
The exceptions are:
- gdb.base/inferior-args.exp where we rewrite:
set cmd [format "lappend item \{ '%c' '\\%c' \}" 34 34]
eval $cmd
into:
lappend item [format { '%c' '\%c' } 34 34]
- reset_vars in lib/check-test-names.exp where we simply drop an unnecessary
eval
Tested on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
-rw-r--r-- | gdb/testsuite/gdb.base/inferior-args.exp | 3 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/clztest.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/typeddwarf.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/lib/check-test-names.exp | 6 | ||||
-rw-r--r-- | gdb/testsuite/lib/debuginfod-support.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 6 |
6 files changed, 10 insertions, 11 deletions
diff --git a/gdb/testsuite/gdb.base/inferior-args.exp b/gdb/testsuite/gdb.base/inferior-args.exp index b2916701..6b92c08 100644 --- a/gdb/testsuite/gdb.base/inferior-args.exp +++ b/gdb/testsuite/gdb.base/inferior-args.exp @@ -170,8 +170,7 @@ lappend test_desc_list [list "test one" \ # the rest of this mess in order to avoid TCL escaping the quote for # me. It's super important that what we send to GDB is '"' not '\"'. set item [list "test two" false] -set cmd [format "lappend item \{ '%c' '\\%c' \}" 34 34] -eval $cmd +lappend item [format { '%c' '\%c' } 34 34] set bs "\\\\" lappend item [list "$hex \"$bs\"\"" "$hex \"$bs$bs$bs\"\""] lappend test_desc_list $item diff --git a/gdb/testsuite/gdb.dwarf2/clztest.exp b/gdb/testsuite/gdb.dwarf2/clztest.exp index 7a74e02..93c2ced 100644 --- a/gdb/testsuite/gdb.dwarf2/clztest.exp +++ b/gdb/testsuite/gdb.dwarf2/clztest.exp @@ -61,7 +61,7 @@ proc scan_gdb_tests {} { continue } - eval $test_cmd + {*}$test_cmd } close $fd } diff --git a/gdb/testsuite/gdb.dwarf2/typeddwarf.exp b/gdb/testsuite/gdb.dwarf2/typeddwarf.exp index 1135709..b80ce97 100644 --- a/gdb/testsuite/gdb.dwarf2/typeddwarf.exp +++ b/gdb/testsuite/gdb.dwarf2/typeddwarf.exp @@ -78,7 +78,7 @@ proc scan_gdb_tests {} { continue } - eval $test_cmd + {*}$test_cmd } close $fd } diff --git a/gdb/testsuite/lib/check-test-names.exp b/gdb/testsuite/lib/check-test-names.exp index 049addd..d099ffc 100644 --- a/gdb/testsuite/lib/check-test-names.exp +++ b/gdb/testsuite/lib/check-test-names.exp @@ -146,7 +146,7 @@ namespace eval ::CheckTestNames { # If ARGS is the empty list then we don't want to pass a single # empty string as a parameter here. - eval "CheckTestNames::log_summary $args" + CheckTestNames::log_summary {*}$args if { [llength $args] == 0 } { set which "count" @@ -184,10 +184,10 @@ foreach nm {pass fail xfail kfail xpass kpass unresolved untested \ # Create new global log_summary to replace Dejagnu's. proc log_summary { args } { - eval "CheckTestNames::do_log_summary $args" + CheckTestNames::do_log_summary {*}$args } # Create new global reset_vars to replace Dejagnu's. proc reset_vars {} { - eval "CheckTestNames::do_reset_vars" + CheckTestNames::do_reset_vars } diff --git a/gdb/testsuite/lib/debuginfod-support.exp b/gdb/testsuite/lib/debuginfod-support.exp index 674888a..7a8baf4 100644 --- a/gdb/testsuite/lib/debuginfod-support.exp +++ b/gdb/testsuite/lib/debuginfod-support.exp @@ -37,7 +37,7 @@ proc allow_debuginfod_tests {} { # (installed by ASan) exist on startup. That makes TCL's exec throw an # error. This is dealt with by the --quiet in INTERNAL_GDBFLAGS. if { [string first "with-debuginfod" \ - [eval exec $::GDB $::INTERNAL_GDBFLAGS \ + [exec $::GDB {*}$::INTERNAL_GDBFLAGS \ --configuration]] == -1 } { return false } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 1780e37..36bd3b4 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -5749,7 +5749,7 @@ gdb_caching_proc get_compiler_info_1 {language} { set ifile $tofile set cppout [ gdb_compile "${ifile}" "" preprocess [list "$language" quiet getting_compiler_info] ] } - eval log_file $saved_log + log_file {*}$saved_log # Eval the output. set unknown 0 @@ -7986,12 +7986,12 @@ proc default_gdb_init { test_file_name } { proc make_gdb_parallel_path { args } { global GDB_PARALLEL objdir - set joiner [list "file" "join" $objdir] + set joiner [list $objdir] if { [info exists GDB_PARALLEL] && $GDB_PARALLEL != "yes" } { lappend joiner $GDB_PARALLEL } set joiner [concat $joiner $args] - return [eval $joiner] + return [file join {*}$joiner] } # Turn BASENAME into a full file name in the standard output |