From: Andrew Burgess Date: Mon, 14 Nov 2022 14:31:52 +0000 (+0000) Subject: gdb/testsuite: remove use of then keyword from gdb.*/*.exp scripts X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f50c72da4dc7ab67ea244e9c6e97404a04700c2d;p=binutils-gdb.git gdb/testsuite: remove use of then keyword from gdb.*/*.exp scripts The canonical form of 'if' in modern TCL is 'if {} {}'. But there's still a bunch of places in the testsuite where we make use of the 'then' keyword, and sometimes these get copies into new tests, which just spreads poor practice. This commit removes all use of the 'then' keyword from the remaining gdb.*/*.exp scripts. Previous commits have done the bulk of this removal, this commit just handles the remaining directories that each contain a low number of instances. There should be no changes in what is tested after this commit. --- diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp index d56a5076b44..45c83305216 100644 --- a/gdb/testsuite/gdb.asm/asm-source.exp +++ b/gdb/testsuite/gdb.asm/asm-source.exp @@ -166,14 +166,14 @@ if { "${asm-arch}" == "" } { } # On NetBSD/ELF we need a special NetBSD-identifying note section. -if { [istarget "*-*-netbsd*"] && ![istarget "*-*-netbsdaout*"] } then { +if {[istarget "*-*-netbsd*"] && ![istarget "*-*-netbsdaout*"]} { set asm-note "netbsd" } # On OpenBSD/ELF we need a similar note section. We make no attempt # of handing a.out here since most OpenBSD/a.out systems use a rather # outdated assembler that doesn't assemble this test's code anyway. -if { [istarget "*-*-openbsd*"] } then { +if {[istarget "*-*-openbsd*"]} { set asm-note "openbsd" } @@ -212,7 +212,7 @@ if { [string equal ${debug-flags} ""] } { } # Allow the target board to override the debug flags. -if { [board_info $dest exists debug_flags] } then { +if {[board_info $dest exists debug_flags]} { set debug-flags "[board_info $dest debug_flags]" } @@ -239,11 +239,11 @@ regsub "--" "-g\[0-9\]" "${debug-flags}" "" debug-flags set asm1obj [standard_output_file asmrc1.o] set asm2obj [standard_output_file asmrc2.o] -if {[target_assemble ${srcdir}/${subdir}/${srcfile} $asm1obj "${asm-flags} ${debug-flags}"] != ""} then { +if {[target_assemble ${srcdir}/${subdir}/${srcfile} $asm1obj "${asm-flags} ${debug-flags}"] != ""} { untested "failed to assemble" return -1 } -if {[target_assemble ${srcdir}/${subdir}/${srcfile2} $asm2obj "${asm-flags} ${debug-flags}"] != ""} then { +if {[target_assemble ${srcdir}/${subdir}/${srcfile2} $asm2obj "${asm-flags} ${debug-flags}"] != ""} { untested "failed to assemble" return -1 } @@ -254,7 +254,7 @@ if {[target_assemble ${srcdir}/${subdir}/${srcfile2} $asm2obj "${asm-flags} ${de # code here that provides its own startup code. Using target_link # also avoids a lot of problems on many systems, most notably on # *-*-*bsd* and *-*-solaris2*. -if {[target_link [list $asm1obj $asm2obj] "${binfile}" ${link-flags}] != "" } then { +if {[target_link [list $asm1obj $asm2obj] "${binfile}" ${link-flags}] != ""} { untested "failed to link" return -1 } @@ -284,7 +284,7 @@ gdb_load ${binfile} # Run to `main' where we begin our tests. # -if ![runto_main] then { +if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.compile/compile-tls.exp b/gdb/testsuite/gdb.compile/compile-tls.exp index bb6a60bd2e9..f9c9ee5e2f7 100644 --- a/gdb/testsuite/gdb.compile/compile-tls.exp +++ b/gdb/testsuite/gdb.compile/compile-tls.exp @@ -21,7 +21,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ } clean_restart ${binfile} -if ![runto_main] then { +if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.ctf/funcreturn.exp b/gdb/testsuite/gdb.ctf/funcreturn.exp index 1267cab2b75..ab4aa21fa32 100644 --- a/gdb/testsuite/gdb.ctf/funcreturn.exp +++ b/gdb/testsuite/gdb.ctf/funcreturn.exp @@ -106,7 +106,7 @@ if ![target_info exists no_long_long] { } # Sun /bin/cc calls this a function returning double. -if {!$gcc_compiled} then {setup_xfail "*-sun-sunos4*"} +if {!$gcc_compiled} {setup_xfail "*-sun-sunos4*"} gdb_test "print v_float_func" \ "$decimal = \{float \\(\\)\} 0x\[0-9a-z\]+.*" \ "print float function" @@ -179,7 +179,7 @@ if ![target_info exists no_long_long] { } # Sun /bin/cc calls this a function returning double. -if {!$gcc_compiled} then {setup_xfail "*-sun-sunos4*"} +if {!$gcc_compiled} {setup_xfail "*-sun-sunos4*"} gdb_test "whatis v_float_func" \ "type = float \\($void\\)" \ "whatis float function" diff --git a/gdb/testsuite/gdb.dwarf2/dw2-common-block.exp b/gdb/testsuite/gdb.dwarf2/dw2-common-block.exp index f7c9e9597a7..12c2f4cce82 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-common-block.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-common-block.exp @@ -37,7 +37,7 @@ if { [prepare_for_testing "failed to prepare" "${testfile}" $srcfile \ return -1 } -if ![runto MAIN__] then { +if {![runto MAIN__]} { perror "couldn't run to breakpoint MAIN__" return } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp index 262f36a7afb..92f0e1350ec 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp @@ -32,7 +32,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] then { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.exp b/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.exp index 99c69f00348..288c5a00176 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.exp @@ -34,7 +34,7 @@ if {[prepare_for_testing_full "failed to prepare" \ return -1 } -if ![runto_main] then { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.exp b/gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.exp index 63fc723956e..5824d8b3426 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.exp @@ -35,7 +35,7 @@ if { [prepare_for_testing "failed to prepare" "${testfile}" $srcfile {nodebug no return -1 } -if ![runto_main] then { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp index bd20272637c..368f63c1a63 100644 --- a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp +++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp @@ -105,7 +105,7 @@ with_test_prefix "first session" { gdb_load_shlib ${lib_so} # Run to foo to make sure foo refers to the function, and not foo@PLT. - if ![runto foo qualified] then { + if {![runto foo qualified]} { return } @@ -334,7 +334,7 @@ with_test_prefix "second session" { # loaded for remote targets. gdb_load_shlib ${lib_so} - if ![runto_main] then { + if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.guile/scm-breakpoint.exp b/gdb/testsuite/gdb.guile/scm-breakpoint.exp index 37607b7f4ff..256416d8e9e 100644 --- a/gdb/testsuite/gdb.guile/scm-breakpoint.exp +++ b/gdb/testsuite/gdb.guile/scm-breakpoint.exp @@ -536,7 +536,7 @@ proc_with_prefix test_bkpt_probe {} { return -1 } - if ![gdb_guile_runto_main] then { + if {![gdb_guile_runto_main]} { return } diff --git a/gdb/testsuite/gdb.mi/list-thread-groups-available.exp b/gdb/testsuite/gdb.mi/list-thread-groups-available.exp index c4cad2075ac..4b3c6d7a18e 100644 --- a/gdb/testsuite/gdb.mi/list-thread-groups-available.exp +++ b/gdb/testsuite/gdb.mi/list-thread-groups-available.exp @@ -21,7 +21,7 @@ set MIFLAGS "-i=mi" standard_testfile # Support for XML is needed to run this test. -if [gdb_skip_xml_test] then { +if {[gdb_skip_xml_test]} { unsupported "list-thread-groups-available.exp" return -1 } diff --git a/gdb/testsuite/gdb.mi/mi-async.exp b/gdb/testsuite/gdb.mi/mi-async.exp index af16b4a243d..756ca112820 100644 --- a/gdb/testsuite/gdb.mi/mi-async.exp +++ b/gdb/testsuite/gdb.mi/mi-async.exp @@ -21,7 +21,7 @@ # mi_run_cmd, it ignores whatever target the rest of GDB testsuite is # using, and always tries to run natively. So, don't do anything unless # we're actually testing native. -if { !([isnative] && [istarget *-linux*]) } then { +if {!([isnative] && [istarget *-linux*])} { return } diff --git a/gdb/testsuite/gdb.mi/mi-corefile.exp b/gdb/testsuite/gdb.mi/mi-corefile.exp index d8ca6b3b34f..61aec326bcb 100644 --- a/gdb/testsuite/gdb.mi/mi-corefile.exp +++ b/gdb/testsuite/gdb.mi/mi-corefile.exp @@ -18,7 +18,7 @@ load_lib mi-support.exp set MIFLAGS "-i=mi" -if ![isnative] then { +if {![isnative]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-frame-regs.exp b/gdb/testsuite/gdb.mi/mi-frame-regs.exp index 94a02dd2c0f..df15c59887c 100644 --- a/gdb/testsuite/gdb.mi/mi-frame-regs.exp +++ b/gdb/testsuite/gdb.mi/mi-frame-regs.exp @@ -98,7 +98,7 @@ proc_with_prefix do_floating_varobj_test {} { # Get the address of the current breakpoint. set bpaddr [breakpoint_address $bpnum] - if {$bpaddr == ""} then { return } + if {$bpaddr == ""} { return } # Check that the addresses are the same. gdb_assert [expr $bpaddr == $pcval] "\$pc equals address of breakpoint in callee$i" @@ -145,7 +145,7 @@ proc_with_prefix do_fixed_varobj_test {} { for {set i 0} {$i < 4} {incr i} { - if { $i == 1 } then { set first_unchanging_varnum $varnum } + if {$i == 1} { set first_unchanging_varnum $varnum } mi_gdb_test "-var-create --thread 1 --frame $i - \* \$pc" \ "\\^done,.*value=\"$hex.*" \ diff --git a/gdb/testsuite/gdb.mi/mi-info-os.exp b/gdb/testsuite/gdb.mi/mi-info-os.exp index ea4acf9e3eb..fde70bb1ea8 100644 --- a/gdb/testsuite/gdb.mi/mi-info-os.exp +++ b/gdb/testsuite/gdb.mi/mi-info-os.exp @@ -17,13 +17,13 @@ load_lib mi-support.exp set MIFLAGS "-i=mi" # This test is Linux-only. -if ![istarget *-*-linux*] then { +if {![istarget *-*-linux*]} { unsupported "mi-info-os.exp" return -1 } # Support for XML-output is needed to run this test. -if [gdb_skip_xml_test] then { +if {[gdb_skip_xml_test]} { unsupported "mi-info-os.exp" return -1 } diff --git a/gdb/testsuite/gdb.mi/mi-regs.exp b/gdb/testsuite/gdb.mi/mi-regs.exp index da253e644ca..983e1079a38 100644 --- a/gdb/testsuite/gdb.mi/mi-regs.exp +++ b/gdb/testsuite/gdb.mi/mi-regs.exp @@ -104,7 +104,7 @@ proc sparc_register_tests { } { "list changed registers" } -if [istarget "sparc-*-*"] then { +if {[istarget "sparc-*-*"]} { mi_clean_restart sparc_register_tests_no_exec mi_clean_restart $binfile diff --git a/gdb/testsuite/gdb.modula2/max-depth.exp b/gdb/testsuite/gdb.modula2/max-depth.exp index 2ffcba4ba93..5f5b19a5a77 100644 --- a/gdb/testsuite/gdb.modula2/max-depth.exp +++ b/gdb/testsuite/gdb.modula2/max-depth.exp @@ -21,7 +21,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug quiet}]} return -1 } -if { ![runto_main] } then { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.modula2/multidim.exp b/gdb/testsuite/gdb.modula2/multidim.exp index 1e4354d8822..06a74d462f5 100644 --- a/gdb/testsuite/gdb.modula2/multidim.exp +++ b/gdb/testsuite/gdb.modula2/multidim.exp @@ -24,7 +24,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile \ return -1 } -if ![runto here] then { +if {![runto here]} { perror "couldn't run to breakpoint 'here'" return } diff --git a/gdb/testsuite/gdb.modula2/unbounded-array.exp b/gdb/testsuite/gdb.modula2/unbounded-array.exp index ae3032d349f..e75f1993787 100644 --- a/gdb/testsuite/gdb.modula2/unbounded-array.exp +++ b/gdb/testsuite/gdb.modula2/unbounded-array.exp @@ -23,7 +23,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug quiet}]} return -1 } -if ![runto foo] then { +if {![runto foo]} { perror "couldn't run to breakpoint foo" return } diff --git a/gdb/testsuite/gdb.opt/break-on-_exit.exp b/gdb/testsuite/gdb.opt/break-on-_exit.exp index d94cc7e48df..7c2fda6af69 100644 --- a/gdb/testsuite/gdb.opt/break-on-_exit.exp +++ b/gdb/testsuite/gdb.opt/break-on-_exit.exp @@ -50,7 +50,7 @@ save_vars { GDBFLAGS } { } } -if ![runto_main] then { +if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.opt/clobbered-registers-O2.exp b/gdb/testsuite/gdb.opt/clobbered-registers-O2.exp index 66ec5c85d21..617ebff7ab4 100644 --- a/gdb/testsuite/gdb.opt/clobbered-registers-O2.exp +++ b/gdb/testsuite/gdb.opt/clobbered-registers-O2.exp @@ -26,7 +26,7 @@ if {[prepare_for_testing "failed to prepare" $testfile \ return -1 } -if { ![runto start_sequence] } then { +if {![runto start_sequence]} { return } diff --git a/gdb/testsuite/gdb.opt/fortran-string.exp b/gdb/testsuite/gdb.opt/fortran-string.exp index 8d4018e9b8b..5798ad0fcb5 100644 --- a/gdb/testsuite/gdb.opt/fortran-string.exp +++ b/gdb/testsuite/gdb.opt/fortran-string.exp @@ -27,7 +27,7 @@ if { [prepare_for_testing "prepare for testing" ${testfile} ${srcfile} \ return -1 } -if ![runto f] then { +if {![runto f]} { perror "couldn't run to f" return } diff --git a/gdb/testsuite/gdb.opt/solib-intra-step.exp b/gdb/testsuite/gdb.opt/solib-intra-step.exp index e803a7db14d..9306ced85c8 100644 --- a/gdb/testsuite/gdb.opt/solib-intra-step.exp +++ b/gdb/testsuite/gdb.opt/solib-intra-step.exp @@ -39,7 +39,7 @@ if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != "" clean_restart ${binfile} gdb_load_shlib $binfile_lib -if ![runto_main] then { +if {![runto_main]} { return 0 } @@ -92,7 +92,7 @@ gdb_test_multiple "step" $test { } } -if ![runto_main] then { +if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.pascal/types.exp b/gdb/testsuite/gdb.pascal/types.exp index a761e25a0f0..a19d65ab17f 100644 --- a/gdb/testsuite/gdb.pascal/types.exp +++ b/gdb/testsuite/gdb.pascal/types.exp @@ -74,7 +74,7 @@ gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir -if [set_lang_pascal] then { +if {[set_lang_pascal]} { test_integer_literal_types_accepted test_logical_literal_types_accepted test_character_literal_types_accepted diff --git a/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp b/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp index 0ada144a803..9b47f21106f 100644 --- a/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp +++ b/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp @@ -63,7 +63,7 @@ proc connect_no_symbol_file { sysroot action } { set gdbserver_gdbport [lindex $res 1] # Perform test actions to the symbol file on the target. - if { $action == "delete" } then { + if {$action == "delete"} { remote_file target delete $target_exec } elseif { $action == "permission" } { remote_exec target "chmod 000 $target_exec" diff --git a/gdb/testsuite/gdb.server/ext-attach.exp b/gdb/testsuite/gdb.server/ext-attach.exp index 7514faf6b3d..a67a536809c 100644 --- a/gdb/testsuite/gdb.server/ext-attach.exp +++ b/gdb/testsuite/gdb.server/ext-attach.exp @@ -56,7 +56,7 @@ proc run_test { target_async target_non_stop to_disable } { # extended-remote board, therefore already connected. gdb_test "disconnect" ".*" - if { [gdb_target_supports_trace] } then { + if {[gdb_target_supports_trace]} { # Test predefined TSVs are uploaded. gdb_test_sequence "info tvariables" "check uploaded tsv" { "\[\r\n\]+Name\[\t \]+Initial\[\t \]+Current" diff --git a/gdb/testsuite/gdb.server/extended-remote-restart.exp b/gdb/testsuite/gdb.server/extended-remote-restart.exp index db25a6ef075..41e55439950 100644 --- a/gdb/testsuite/gdb.server/extended-remote-restart.exp +++ b/gdb/testsuite/gdb.server/extended-remote-restart.exp @@ -35,7 +35,7 @@ if {[target_info gdb_protocol] != "extended-remote"} { # This test also makes use of 'detach-on-fork' which is not supported # on all platforms. -if { ![istarget "*-*-linux*"] && ![istarget "*-*-openbsd*"] } then { +if {![istarget "*-*-linux*"] && ![istarget "*-*-openbsd*"]} { return } @@ -60,7 +60,7 @@ proc test_reload { do_kill_p follow_child_p } { clean_restart ${binfile} - if ![runto_main] then { + if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.stabs/exclfwd.exp b/gdb/testsuite/gdb.stabs/exclfwd.exp index 5337ac8e376..201c13dd59a 100644 --- a/gdb/testsuite/gdb.stabs/exclfwd.exp +++ b/gdb/testsuite/gdb.stabs/exclfwd.exp @@ -27,7 +27,7 @@ if {[prepare_for_testing "failed to prepare" $testfile \ return -1 } -if ![runto_main] then { +if {![runto_main]} { perror "couldn't run to breakpoint" return } @@ -41,14 +41,14 @@ gdb_test "ptype v1" "type = struct a {$eol int y;$eol }$eol" -if { [test_debug_format "stabs"] } then { +if {[test_debug_format "stabs"]} { setup_kfail "gdb/1602" *-*-* } gdb_test "ptype v2" "type = struct a {$eol const char .c;$eol }$eol" -if { [test_debug_format "stabs"] } then { +if {[test_debug_format "stabs"]} { setup_kfail "gdb/1603" *-*-* } gdb_test "ptype v3" "type = const char ." diff --git a/gdb/testsuite/gdb.tui/tui-layout.exp b/gdb/testsuite/gdb.tui/tui-layout.exp index 5e44b9cf38a..26259e337f9 100644 --- a/gdb/testsuite/gdb.tui/tui-layout.exp +++ b/gdb/testsuite/gdb.tui/tui-layout.exp @@ -35,7 +35,7 @@ proc test_layout {layout execution} { clean_restart $binfile if {$execution} { - if ![runto_main] then { + if {![runto_main]} { return 0 } } diff --git a/gdb/testsuite/gdb.xml/tdesc-reload.exp b/gdb/testsuite/gdb.xml/tdesc-reload.exp index 6e3fe2f5304..5c3f702ea18 100644 --- a/gdb/testsuite/gdb.xml/tdesc-reload.exp +++ b/gdb/testsuite/gdb.xml/tdesc-reload.exp @@ -27,7 +27,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { return -1 } -if ![runto_main] then { +if {![runto_main]} { return 0 } @@ -62,7 +62,7 @@ gdb_test_no_output "set tdesc filename $xml_file_1" \ gdb_load ${binfile} # Run to `main' where we begin our tests. -if ![runto_main] then { +if {![runto_main]} { return -1 }