Running tclint on the test-cases in gdb.compile shows a few problems.
While we're at it, likewise in lib/compile-support.exp
Fix these.
Tested on x86_64-linux (Fedora 42).
"gdb/testsuite/gdb.arch",
"gdb/testsuite/gdb.base",
"gdb/testsuite/gdb.btrace",
-"gdb/testsuite/gdb.compile",
"gdb/testsuite/gdb.cp",
"gdb/testsuite/gdb.ctf",
"gdb/testsuite/gdb.dwarf2",
require allow_compile_tests
set options {}
-if [test_compiler_info gcc*] {
+if {[test_compiler_info gcc*]} {
lappend options additional_flags=-g3
lappend options additional_flags=-std=gnu++11
lappend options c++
set srcfilesoptions [list ${srcfile} ${options}]
-if { [eval build_executable_from_specs ${testfile}.exp $testfile {$options} ${srcfilesoptions}] } {
+if { [build_executable_from_specs $testfile.exp $testfile $options \
+ {*}$srcfilesoptions] } {
return -1
}
clean_restart ${testfile}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
}
set srcfile4options "nodebug c++"
lappend srcfilesoptions $srcfile4 $srcfile4options
-if { [eval build_executable_from_specs ${testfile}.exp $testfile {$options} ${srcfilesoptions}] } {
+
+if { [build_executable_from_specs $testfile.exp $testfile $options \
+ {*}$srcfilesoptions] } {
return -1
}
gdb_test_no_output "set language c++" \
"Set language to C++"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
require is_c_compiler_gcc
set flags ""
-if [test_compiler_info gcc*] {
+if {[test_compiler_info gcc*]} {
set flags additional_flags=-Wno-attribute-alias
}
return -1
}
-if ![runto func] {
+if {![runto func]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
lappend srcfilesoptions $srcfile3 ${options}
}
lappend srcfilesoptions $srcfile4 "nodebug"
-if { [eval build_executable_from_specs ${testfile}.exp $testfile {$options} ${srcfilesoptions}] } {
+if { [build_executable_from_specs $testfile.exp $testfile $options \
+ {*}$srcfilesoptions] } {
return -1
}
"The program must be running for the compile command to work.*" \
"test compile file command without running inferior"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
clean_restart $testfile
gdb_load_shlib $libbin
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
if {[string match $cmd "print"]} {
if {!$is_explicit} {
- eval setup_failures_ $fail_print
+ setup_failures_ {*}$fail_print
return [compile_command_ "compile print $exp" $result $tst]
}
} else {
} else {
set command "compile code $varName_ = $exp"
}
- eval setup_failures_ $fail_compile
+ setup_failures_ {*}$fail_compile
if {![compile_command_ $command "" $tst]} {
return 0
}
- eval setup_failures_ $fail_value
+ setup_failures_ {*}$fail_value
gdb_test "p $varName_" "= $result" "result of $tst"
}
return 1
proc setup_failures_ {how args} {
switch -nocase $how {
xfail {
- eval setup_xfail $args
+ setup_xfail {*}$args
}
kfail {
- eval setup_kfail $args
+ setup_kfail {*}$args
}
default {