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>
# 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
continue
}
- eval $test_cmd
+ {*}$test_cmd
}
close $fd
}
continue
}
- eval $test_cmd
+ {*}$test_cmd
}
close $fd
}
# 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"
# 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
}
# (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
}
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
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