From: Tom de Vries Date: Thu, 18 Sep 2025 06:18:31 +0000 (+0200) Subject: [gdb/testsuite, tclint] Fix gdb.compile X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c470ecc6741bc39034acec229680945a1d4afe68;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite, tclint] Fix gdb.compile 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). --- diff --git a/gdb/tclint.toml b/gdb/tclint.toml index 1cfb0b2623f..3911017a63f 100644 --- a/gdb/tclint.toml +++ b/gdb/tclint.toml @@ -22,7 +22,6 @@ exclude = [ "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", diff --git a/gdb/testsuite/gdb.compile/compile-cplus-print.exp b/gdb/testsuite/gdb.compile/compile-cplus-print.exp index d89bf61fd3c..e4e278211cd 100644 --- a/gdb/testsuite/gdb.compile/compile-cplus-print.exp +++ b/gdb/testsuite/gdb.compile/compile-cplus-print.exp @@ -22,7 +22,7 @@ require is_c_compiler_gcc 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++ @@ -30,13 +30,14 @@ if [test_compiler_info gcc*] { 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 } diff --git a/gdb/testsuite/gdb.compile/compile-cplus.exp b/gdb/testsuite/gdb.compile/compile-cplus.exp index a0f5cf00d22..66ac76f3513 100644 --- a/gdb/testsuite/gdb.compile/compile-cplus.exp +++ b/gdb/testsuite/gdb.compile/compile-cplus.exp @@ -39,7 +39,9 @@ if { $srcfile3 != "" } { } 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 } @@ -52,7 +54,7 @@ clean_restart ${testfile} gdb_test_no_output "set language c++" \ "Set language to C++" -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.compile/compile-ifunc.exp b/gdb/testsuite/gdb.compile/compile-ifunc.exp index 068dce5c46c..72c1142a40f 100644 --- a/gdb/testsuite/gdb.compile/compile-ifunc.exp +++ b/gdb/testsuite/gdb.compile/compile-ifunc.exp @@ -24,7 +24,7 @@ standard_testfile require is_c_compiler_gcc set flags "" -if [test_compiler_info gcc*] { +if {[test_compiler_info gcc*]} { set flags additional_flags=-Wno-attribute-alias } diff --git a/gdb/testsuite/gdb.compile/compile-ops.exp b/gdb/testsuite/gdb.compile/compile-ops.exp index 9633551e8e0..c41c91e3967 100644 --- a/gdb/testsuite/gdb.compile/compile-ops.exp +++ b/gdb/testsuite/gdb.compile/compile-ops.exp @@ -416,7 +416,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto func] { +if {![runto func]} { return -1 } diff --git a/gdb/testsuite/gdb.compile/compile-print.exp b/gdb/testsuite/gdb.compile/compile-print.exp index 4c90a718608..2d3ad2f074e 100644 --- a/gdb/testsuite/gdb.compile/compile-print.exp +++ b/gdb/testsuite/gdb.compile/compile-print.exp @@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" "$testfile"] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.compile/compile-setjmp.exp b/gdb/testsuite/gdb.compile/compile-setjmp.exp index 73f6b8b13f5..048d0a428d5 100644 --- a/gdb/testsuite/gdb.compile/compile-setjmp.exp +++ b/gdb/testsuite/gdb.compile/compile-setjmp.exp @@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" $testfile] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.compile/compile.exp b/gdb/testsuite/gdb.compile/compile.exp index eb87141824d..66ac182c0c9 100644 --- a/gdb/testsuite/gdb.compile/compile.exp +++ b/gdb/testsuite/gdb.compile/compile.exp @@ -32,7 +32,8 @@ if { $srcfile3 != "" } { 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 } @@ -53,7 +54,7 @@ gdb_test "compile file -r ${srcdir}/${subdir}/${testfile}-mod.c" \ "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 } @@ -391,7 +392,7 @@ if { [gdb_compile_shlib ${srcdir}/${subdir}/${srcfile2} $libbin {debug}] != "" clean_restart $testfile gdb_load_shlib $libbin -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/lib/compile-support.exp b/gdb/testsuite/lib/compile-support.exp index dd0b9a9ed3c..8472d8de3e7 100644 --- a/gdb/testsuite/lib/compile-support.exp +++ b/gdb/testsuite/lib/compile-support.exp @@ -265,7 +265,7 @@ namespace eval ::CompileExpression { 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 { @@ -274,11 +274,11 @@ namespace eval ::CompileExpression { } 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 @@ -292,11 +292,11 @@ namespace eval ::CompileExpression { 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 {