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.
This commit is contained in:
Andrew Burgess 2022-11-14 14:31:52 +00:00
parent 0216141ac3
commit f50c72da4d
29 changed files with 44 additions and 44 deletions

View file

@ -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
}

View file

@ -21,7 +21,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
}
clean_restart ${binfile}
if ![runto_main] then {
if {![runto_main]} {
return 0
}

View file

@ -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"

View file

@ -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
}

View file

@ -32,7 +32,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
if ![runto_main] then {
if {![runto_main]} {
return -1
}

View file

@ -34,7 +34,7 @@ if {[prepare_for_testing_full "failed to prepare" \
return -1
}
if ![runto_main] then {
if {![runto_main]} {
return -1
}

View file

@ -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
}

View file

@ -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
}

View file

@ -536,7 +536,7 @@ proc_with_prefix test_bkpt_probe {} {
return -1
}
if ![gdb_guile_runto_main] then {
if {![gdb_guile_runto_main]} {
return
}

View file

@ -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
}

View file

@ -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
}

View file

@ -18,7 +18,7 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
if ![isnative] then {
if {![isnative]} {
return
}

View file

@ -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.*" \

View file

@ -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
}

View file

@ -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

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -50,7 +50,7 @@ save_vars { GDBFLAGS } {
}
}
if ![runto_main] then {
if {![runto_main]} {
return 0
}

View file

@ -26,7 +26,7 @@ if {[prepare_for_testing "failed to prepare" $testfile \
return -1
}
if { ![runto start_sequence] } then {
if {![runto start_sequence]} {
return
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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

View file

@ -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"

View file

@ -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"

View file

@ -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
}

View file

@ -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 ."

View file

@ -35,7 +35,7 @@ proc test_layout {layout execution} {
clean_restart $binfile
if {$execution} {
if ![runto_main] then {
if {![runto_main]} {
return 0
}
}

View file

@ -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
}