From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id CAD0B385843D; Mon, 28 Nov 2022 21:05:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CAD0B385843D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669669540; bh=lSnpj4jz3se22/bsNpHQcM0G4KF+IgGiDvk5mnHwb5g=; h=From:To:Subject:Date:From; b=myPeG/wBkGvhJSU2W/3EMB2ufrz1EwF+9NBUe9zTuIrgpHxfqNuMc7RDxlqre9vX8 6MAq4r/yooSoDK/ZALxEqpe7nm0kJsJNeO5uyJrkoPTjONnGEL328jn6zzacTesH7t QHm3vVIwQr8mtyUW3MKX2ozvjiNkBOBcI3Aaw8YA= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/testsuite: remove use of then keyword from library files X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: f50c72da4dc7ab67ea244e9c6e97404a04700c2d X-Git-Newrev: d4c4542312ca16fe83c8dc8d8acce4667aa7992c Message-Id: <20221128210540.CAD0B385843D@sourceware.org> Date: Mon, 28 Nov 2022 21:05:40 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dd4c4542312ca= 16fe83c8dc8d8acce4667aa7992c commit d4c4542312ca16fe83c8dc8d8acce4667aa7992c Author: Andrew Burgess Date: Mon Nov 14 14:45:05 2022 +0000 gdb/testsuite: remove use of then keyword from library files =20 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. =20 This commit removes all use of the 'then' keyword from the testsuite library files (in boards/, config/, and lib/). Previous commits have removed all uses of the 'then' keyword from the test script files, this commit just cleans up the library files. =20 There should be no changes in what is tested after this commit. Diff: --- gdb/testsuite/boards/native-extended-gdbserver.exp | 4 +- gdb/testsuite/config/sid.exp | 16 +++--- gdb/testsuite/config/sim.exp | 10 ++-- gdb/testsuite/config/slite.exp | 8 +-- gdb/testsuite/lib/cp-support.exp | 64 +++++++++++-------= ---- gdb/testsuite/lib/dwarf.exp | 10 ++-- gdb/testsuite/lib/gdb.exp | 62 ++++++++++--------= --- gdb/testsuite/lib/mi-support.exp | 24 ++++---- gdb/testsuite/lib/prompt.exp | 2 +- gdb/testsuite/lib/selftest-support.exp | 12 ++-- gdb/testsuite/lib/trace-support.exp | 6 +- 11 files changed, 109 insertions(+), 109 deletions(-) diff --git a/gdb/testsuite/boards/native-extended-gdbserver.exp b/gdb/tests= uite/boards/native-extended-gdbserver.exp index 67acc6fea7c..88857d6a905 100644 --- a/gdb/testsuite/boards/native-extended-gdbserver.exp +++ b/gdb/testsuite/boards/native-extended-gdbserver.exp @@ -113,7 +113,7 @@ proc gdb_reload { {inferior_args {}} } { # to a separate non-dbx testcase, we should be able to remove this. proc gdb_load { arg } { if { $arg !=3D "" } { - if [gdb_file_cmd $arg] then { return -1 } + if {[gdb_file_cmd $arg]} { return -1 } } =20 return [extended_gdbserver_load_last_file] @@ -129,7 +129,7 @@ proc mi_gdb_load { arg } { global mi_gdb_prompt =20 set res [extended_gdbserver_mi_gdb_load $arg] - if { $res } then { return -1 } + if {$res} { return -1 } =20 send_gdb "100-gdb-set remote exec-file $arg\n" gdb_expect 10 { diff --git a/gdb/testsuite/config/sid.exp b/gdb/testsuite/config/sid.exp index e78317725a6..592663082c0 100644 --- a/gdb/testsuite/config/sid.exp +++ b/gdb/testsuite/config/sid.exp @@ -22,7 +22,7 @@ proc sid_start {} { { *big-endian* *-EB* *-meb* } { set sidendian "-EB" } { *little-endian* *-EL* *-mel* } { set sidendian "-EL" } default {=20 - if {[target_info exists sim,defaultendian]} then { + if {[target_info exists sim,defaultendian]} { set sidendian [target_info sim,defaultendian]=20 } else {=20 # rely on endianness settings in sid configuration defaults @@ -39,12 +39,12 @@ proc sid_start {} { # test to see whether to use use sid in build or install tree set use_build_tree [file exists ../../sid] =20 - if {$use_build_tree} then { + if {$use_build_tree} { set pre_spawn { global env set env(SID_LIBRARY_PATH) [join [glob "../../sid/component/*"] ":"] set env(SID) "../../sid/main/dynamic/sid" - if {! [file exists $env(SID)]} then { error "Cannot find sid in build= tree" } + if {![file exists $env(SID)]} { error "Cannot find sid in build tree"= } } if { [board_info target sim,protocol] =3D=3D "sid" } { set spawncmd "[target_info sim] [target_info sim,options] $sidendian2= -e \"set cpu-gdb-socket sockaddr-local 0.0.0.0:$port\"" @@ -169,7 +169,7 @@ proc gdb_load { arg } { global retval =20 if { $arg !=3D "" } { - if [gdb_file_cmd $arg] then { return -1 } + if {[gdb_file_cmd $arg]} { return -1 } } =20 gdb_target_sid @@ -181,25 +181,25 @@ proc gdb_load { arg } { verbose "Timeout is now $timeout seconds" 2 gdb_expect { -re ".*\[Ee\]rror.*$gdb_prompt $" { - if $verbose>1 then { + if {$verbose > 1} { perror "Error during download." } set retval -1 } -re ".*$gdb_prompt $" { - if $verbose>1 then { + if {$verbose > 1} { send_user "Loaded $arg into $GDB\n" } set retval 0 } -re "$gdb_prompt $" { - if $verbose>1 then { + if {$verbose > 1} { perror "GDB couldn't load." } set retval -1 } timeout { - if $verbose>1 then { + if {$verbose > 1} { perror "Timed out trying to load $arg." } set retval -1 diff --git a/gdb/testsuite/config/sim.exp b/gdb/testsuite/config/sim.exp index 862958510ea..57c54589e80 100644 --- a/gdb/testsuite/config/sim.exp +++ b/gdb/testsuite/config/sim.exp @@ -48,26 +48,26 @@ proc gdb_load { arg } { global gdb_prompt =20 if { $arg !=3D "" } { - if [gdb_file_cmd $arg] then { return -1 } + if {[gdb_file_cmd $arg]} { return -1 } } =20 - if [gdb_target_sim] then { return -1 } + if {[gdb_target_sim]} { return -1 } =20 send_gdb "load\n" gdb_expect 2400 { -re ".*$gdb_prompt $" { - if $verbose>1 then { + if {$verbose > 1} { send_user "Loaded $arg into $GDB\n" } return 0 } -re "$gdb_prompt $" { - if $verbose>1 then { + if {$verbose > 1} { perror "GDB couldn't load." } } timeout { - if $verbose>1 then { + if {$verbose > 1} { perror "Timed out trying to load $arg." } } diff --git a/gdb/testsuite/config/slite.exp b/gdb/testsuite/config/slite.exp index 34679a82190..d81aaa29f94 100644 --- a/gdb/testsuite/config/slite.exp +++ b/gdb/testsuite/config/slite.exp @@ -83,7 +83,7 @@ proc gdb_load { arg } { } -re "Remote target.*$gdb_prompt $" { } -re ".*SPARClite appears to be alive.*$gdb_prompt $" { - if $verbose>1 then { + if {$verbose > 1} { send_user "Set target to $targetname\n" } } @@ -119,12 +119,12 @@ proc gdb_load { arg } { verbose "Timeout is now $timeout seconds" 2 } -re "$gdb_prompt $" { - if $verbose>1 then { + if {$verbose > 1} { perror "GDB couldn't load." } } timeout { - if $verbose>1 then { + if {$verbose > 1} { perror "Timed out trying to load $arg." } } @@ -172,7 +172,7 @@ proc gdb_load { arg } { } } =20 - if [info exists expect_out(buffer)] then { + if {[info exists expect_out(buffer)]} { send_log $expect_out(buffer) } return 0 diff --git a/gdb/testsuite/lib/cp-support.exp b/gdb/testsuite/lib/cp-suppor= t.exp index 87bbf9104a1..82ad59d9905 100644 --- a/gdb/testsuite/lib/cp-support.exp +++ b/gdb/testsuite/lib/cp-support.exp @@ -251,7 +251,7 @@ proc cp_test_ptype_class { in_exp in_testname in_key in= _tag in_class_table # The test name defaults to the command, but without the # arguments, for historical reasons. =20 - if { "$in_testname" =3D=3D "" } then { set in_testname "ptype $in_exp" } + if {"$in_testname" =3D=3D ""} { set in_testname "ptype $in_exp" } =20 set in_command "ptype${in_ptype_arg} $in_exp" } @@ -259,8 +259,8 @@ proc cp_test_ptype_class { in_exp in_testname in_key in= _tag in_class_table # Save class tables in a history array for reuse. =20 global cp_class_table_history - if { $in_class_table =3D=3D "ibid" } then { - if { ! [info exists cp_class_table_history("$in_key,$in_tag") ] } then { + if {$in_class_table =3D=3D "ibid"} { + if {![info exists cp_class_table_history("$in_key,$in_tag")]} { fail "$in_testname // bad ibid" return false } @@ -385,7 +385,7 @@ proc cp_test_ptype_class { in_exp in_testname in_key in= _tag in_class_table =20 # Check the actual tag. =20 - if { "$actual_tag" !=3D "$in_tag" } then { + if {"$actual_tag" !=3D "$in_tag"} { cp_check_errata "$in_tag" "$actual_tag" $in_errata_table fail "$in_testname // wrong tag: $actual_tag" return false @@ -395,18 +395,18 @@ proc cp_test_ptype_class { in_exp in_testname in_key = in_tag in_class_table # First parse them into a list. =20 set list_actual_bases { } - if { "$actual_base_string" !=3D "" } then { + if {"$actual_base_string" !=3D ""} { regsub "^:${wsopt}" $actual_base_string "" actual_base_string set list_actual_bases [split $actual_base_string ","] } =20 # Check the base count. =20 - if { [llength $list_actual_bases] < [llength $list_bases] } then { + if {[llength $list_actual_bases] < [llength $list_bases]} { fail "$in_testname // too few bases" return false } - if { [llength $list_actual_bases] > [llength $list_bases] } then { + if {[llength $list_actual_bases] > [llength $list_bases]} { fail "$in_testname // too many bases" return false } @@ -416,7 +416,7 @@ proc cp_test_ptype_class { in_exp in_testname in_key in= _tag in_class_table foreach actual_base $list_actual_bases { set actual_base [string trim $actual_base] set base [lindex $list_bases 0] - if { "$actual_base" !=3D "$base" } then { + if {"$actual_base" !=3D "$base"} { cp_check_errata "$base" "$actual_base" $in_errata_table fail "$in_testname // wrong base: $actual_base" return false @@ -449,13 +449,13 @@ proc cp_test_ptype_class { in_exp in_testname in_key = in_tag in_class_table # Get the next line. =20 set actual_line [cp_support_internal::next_line $line_queue] - if { "$actual_line" =3D=3D "" } then { continue } + if {"$actual_line" =3D=3D ""} { continue } =20 # Access specifiers. =20 - if { [regexp "^(public|protected|private)${wsopt}:\$" "$actual_line" s0 s= 1] } then { + if {[regexp "^(public|protected|private)${wsopt}:\$" "$actual_line" s0 s1= ]} { set access "$s1" - if { $last_was_access } then { + if {$last_was_access} { fail "$in_testname // redundant access specifier" queue delete $line_queue return false @@ -468,10 +468,10 @@ proc cp_test_ptype_class { in_exp in_testname in_key = in_tag in_class_table =20 # Optional virtual base pointer. =20 - if { [ llength $list_vbases ] > 0 } then { + if {[llength $list_vbases] > 0} { set vbase [lindex $list_vbases 0] - if { [ regexp "$vbase \\*(_vb.|_vb\\\$|__vb_)\[0-9\]*$vbase;" $actual= _line ] } then { - if { "$access" !=3D "private" } then { + if {[regexp "$vbase \\*(_vb.|_vb\\\$|__vb_)\[0-9\]*$vbase;" $actual_l= ine]} { + if {"$access" !=3D "private"} { cp_check_errata "private" "$access" $in_errata_table fail "$in_testname // wrong access specifier for virtual base: $acce= ss" queue delete $line_queue @@ -485,7 +485,7 @@ proc cp_test_ptype_class { in_exp in_testname in_key in= _tag in_class_table =20 # Data field. =20 - if { [llength $list_fields] > 0 } then { + if {[llength $list_fields] > 0} { set field_access [lindex [lindex $list_fields 0] 0] set field_decl [lindex [lindex $list_fields 0] 1] if {$recursive_qid > 0} { @@ -494,8 +494,8 @@ proc cp_test_ptype_class { in_exp in_testname in_key in= _tag in_class_table cp_ptype_class_verbose "\tfield_decl=3D$field_decl" cp_ptype_class_verbose "\taccess=3D$access" } - if { "$actual_line" =3D=3D "$field_decl" } then { - if { "$access" !=3D "$field_access" } then { + if {"$actual_line" =3D=3D "$field_decl"} { + if {"$access" !=3D "$field_access"} { cp_check_errata "$field_access" "$access" $in_errata_table fail "$in_testname // wrong access specifier for field: $access" queue delete $line_queue @@ -514,11 +514,11 @@ proc cp_test_ptype_class { in_exp in_testname in_key = in_tag in_class_table =20 # Method function. =20 - if { [llength $list_methods] > 0 } then { + if {[llength $list_methods] > 0} { set method_access [lindex [lindex $list_methods 0] 0] set method_decl [lindex [lindex $list_methods 0] 1] - if { "$actual_line" =3D=3D "$method_decl" } then { - if { "$access" !=3D "$method_access" } then { + if {"$actual_line" =3D=3D "$method_decl"} { + if {"$access" !=3D "$method_access"} { cp_check_errata "$method_access" "$access" $in_errata_table fail "$in_testname // wrong access specifier for method: $access" queue delete $line_queue @@ -530,8 +530,8 @@ proc cp_test_ptype_class { in_exp in_testname in_key in= _tag in_class_table =20 # gcc 2.95.3 shows "foo()" as "foo(void)". regsub -all "\\(\\)" $method_decl "(void)" method_decl - if { "$actual_line" =3D=3D "$method_decl" } then { - if { "$access" !=3D "$method_access" } then { + if {"$actual_line" =3D=3D "$method_decl"} { + if {"$access" !=3D "$method_access"} { cp_check_errata "$method_access" "$access" $in_errata_table fail "$in_testname // wrong access specifier for method: $access" queue delete $line_queue @@ -689,16 +689,16 @@ proc cp_test_ptype_class { in_exp in_testname in_key = in_tag in_class_table set synth_access [lindex $synth 1] set synth_re [lindex $synth 2] =20 - if { [ regexp "$synth_re" "$actual_line" ] } then { + if {[regexp "$synth_re" "$actual_line"]} { =20 - if { "$access" !=3D "$synth_access" } then { + if {"$access" !=3D "$synth_access"} { cp_check_errata "$synth_access" "$access" $in_errata_table fail "$in_testname // wrong access specifier for synthetic operator:= $access" queue delete $line_queue return false } =20 - if { $synth_count > 0 } then { + if {$synth_count > 0} { cp_check_errata "$actual_line" "$actual_line" $in_errata_table fail "$in_testname // duplicate synthetic operator: $actual_line" } @@ -715,7 +715,7 @@ proc cp_test_ptype_class { in_exp in_testname in_key in= _tag in_class_table break } } - if { $synth_match } then { continue } + if {$synth_match} { continue } =20 # If checking a nested type/recursively and we see a closing curly # brace, we're done. @@ -725,7 +725,7 @@ proc cp_test_ptype_class { in_exp in_testname in_key in= _tag in_class_table =20 # Unrecognized line. =20 - if { [llength $list_methods] > 0 } then { + if {[llength $list_methods] > 0} { set method_decl [lindex [lindex $list_methods 0] 1] cp_check_errata "$method_decl" "$actual_line" $in_errata_table } @@ -742,19 +742,19 @@ proc cp_test_ptype_class { in_exp in_testname in_key = in_tag in_class_table =20 # Check for missing elements. =20 - if { $vbase_match } then { - if { [llength $list_vbases] > 0 } then { + if {$vbase_match} { + if {[llength $list_vbases] > 0} { fail "$in_testname // missing virtual base pointers" return false } } =20 - if { [llength $list_fields] > 0 } then { + if {[llength $list_fields] > 0} { fail "$in_testname // missing fields" return false } =20 - if { [llength $list_methods] > 0 } then { + if {[llength $list_methods] > 0} { fail "$in_testname // missing methods" return false } @@ -767,7 +767,7 @@ proc cp_test_ptype_class { in_exp in_testname in_key in= _tag in_class_table # Check the tail. =20 set actual_tail [string trim $actual_tail] - if { "$actual_tail" !=3D "$in_tail" } then { + if {"$actual_tail" !=3D "$in_tail"} { cp_check_errata "$in_tail" "$actual_tail" $in_errata_table fail "$in_testname // wrong tail: $actual_tail" return false diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp index 9df8e7f9bdc..35f4e957c58 100644 --- a/gdb/testsuite/lib/dwarf.exp +++ b/gdb/testsuite/lib/dwarf.exp @@ -104,7 +104,7 @@ proc build_executable_and_dwo_files { testname executab= le options args } { global subdir global srcdir =20 - if { ! [regexp "^/" "$executable"] } then { + if {![regexp "^/" "$executable"]} { set binfile [standard_output_file $executable] } else { set binfile $executable @@ -143,7 +143,7 @@ proc build_executable_and_dwo_files { testname executab= le options args } { set s [lindex $spec 0] set local_options [lindex $spec 1] =20 - if { ! [regexp "^/" "$s"] } then { + if {![regexp "^/" "$s"]} { set s "$srcdir/$subdir/$s" } =20 @@ -1685,7 +1685,7 @@ namespace eval Dwarf { proc base { addr } { variable _debug_ranges_64_bit =20 - if { $_debug_ranges_64_bit } then { + if {$_debug_ranges_64_bit} { _op .8byte 0xffffffffffffffff "Base Marker" _op .8byte $addr "Base Address" } else { @@ -1697,7 +1697,7 @@ namespace eval Dwarf { proc range { start end } { variable _debug_ranges_64_bit =20 - if { $_debug_ranges_64_bit } then { + if {$_debug_ranges_64_bit} { _op .8byte $start "Start Address" _op .8byte $end "End Address" } else { @@ -1709,7 +1709,7 @@ namespace eval Dwarf { uplevel $body =20 # End of the sequence. - if { $_debug_ranges_64_bit } then { + if {$_debug_ranges_64_bit} { _op .8byte 0x0 "End of Sequence Marker (Part 1)" _op .8byte 0x0 "End of Sequence Marker (Part 2)" } else { diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index a73437a419f..b4d4e46d492 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -227,7 +227,7 @@ if ![info exists INTERNAL_GDBFLAGS] { # but it's not clear what removing one of them will break. # See with_gdb_prompt for more details on prompt handling. global gdb_prompt -if ![info exists gdb_prompt] then { +if {![info exists gdb_prompt]} { set gdb_prompt "\\(gdb\\)" } =20 @@ -1145,7 +1145,7 @@ proc gdb_test_multiple { command message args } { regsub -all {\r} $patterns {\\r} patterns regsub -all {\n} $patterns {\\n} patterns =20 - if $verbose>2 then { + if {$verbose > 2} { send_user "Sending \"$command\" to gdb\n" send_user "Looking to match \"$patterns\"\n" send_user "Message is \"$message\"\n" @@ -1216,7 +1216,7 @@ proc gdb_test_multiple { command message args } { =20 append code { -re "Ending remote debugging.*$prompt_regexp" { - if ![isnative] then { + if {![isnative]} { warning "Can`t communicate to remote target." } gdb_exit @@ -1234,7 +1234,7 @@ proc gdb_test_multiple { command message args } { set result 1 } -re "$inferior_exited_re with code \[0-9\]+.*$prompt_regexp" { - if ![string match "" $message] then { + if {![string match "" $message]} { set errmsg "$message (the program exited)" } else { set errmsg "$command (the program exited)" @@ -1243,7 +1243,7 @@ proc gdb_test_multiple { command message args } { set result -1 } -re "$inferior_exited_re normally.*$prompt_regexp" { - if ![string match "" $message] then { + if {![string match "" $message]} { set errmsg "$message (the program exited)" } else { set errmsg "$command (the program exited)" @@ -1252,7 +1252,7 @@ proc gdb_test_multiple { command message args } { set result -1 } -re "The program is not being run.*$prompt_regexp" { - if ![string match "" $message] then { + if {![string match "" $message]} { set errmsg "$message (the program is no longer running)" } else { set errmsg "$command (the program is no longer running)" @@ -1261,7 +1261,7 @@ proc gdb_test_multiple { command message args } { set result -1 } -re "\r\n$prompt_regexp" { - if ![string match "" $message] then { + if {![string match "" $message]} { fail "$message" } set result 1 @@ -1321,7 +1321,7 @@ proc gdb_test_multiple { command message args } { set result -1 } timeout { - if ![string match "" $message] then { + if {![string match "" $message]} { fail "$message (timeout)" } set result 1 @@ -1679,13 +1679,13 @@ proc test_print_reject { args } { global gdb_prompt global verbose =20 - if [llength $args]=3D=3D2 then { + if {[llength $args] =3D=3D 2} { set expectthis [lindex $args 1] } else { set expectthis "should never match this bogus string" } set sendthis [lindex $args 0] - if $verbose>2 then { + if {$verbose > 2} { send_user "Sending \"$sendthis\" to gdb\n" send_user "Looking to match \"$expectthis\"\n" } @@ -1772,7 +1772,7 @@ proc gdb_test_exact { args } { # case some users of gdb_test_exact already do the right thing. regsub -all "\r\n" $pattern "\n" pattern regsub -all "\n" $pattern "\r\n" pattern - if [llength $args]=3D=3D3 then { + if {[llength $args] =3D=3D 3} { set message [lindex $args 2] return [gdb_test $command $pattern $message] } @@ -2250,7 +2250,7 @@ proc default_gdb_spawn { } { } =20 if ![is_remote host] { - if { [which $GDB] =3D=3D 0 } then { + if {[which $GDB] =3D=3D 0} { perror "$GDB does not exist." exit 1 } @@ -4597,7 +4597,7 @@ gdb_caching_proc universal_compile_options { # such an option is specified. set opt "additional_flags=3D-fdiagnostics-color=3Dnever" set lines [target_compile $src $obj object [list "quiet" $opt]] - if [string match "" $lines] then { + if {[string match "" $lines]} { # Seems to have worked; use the option. lappend options $opt } @@ -4648,7 +4648,7 @@ proc gdb_simple_compile {name code {type object} {com= pile_flags {}} {object obj} =20 file delete $src =20 - if ![string match "" $lines] then { + if {![string match "" $lines]} { verbose "$name: compilation failed, returning 0" 2 return 0 } @@ -5524,7 +5524,7 @@ proc can_spawn_for_attach { } { # We use exp_pid to get the inferior's pid, assuming that gives # back the pid of the program. On remote boards, that would give # us instead the PID of e.g., the ssh client, etc. - if [is_remote target] then { + if {[is_remote target]} { verbose -log "can't spawn for attach (target is remote)" return 0 } @@ -6593,7 +6593,7 @@ proc test_debug_format {format} { proc setup_xfail_format { format } { set ret [test_debug_format $format] =20 - if {$ret} then { + if {$ret} { setup_xfail "*-*-*" } return $ret @@ -6667,32 +6667,32 @@ proc gdb_get_line_number { text { file "" } } { global subdir global srcfile =20 - if { "$file" =3D=3D "" } then { + if {"$file" =3D=3D ""} { set file "$srcfile" } - if { ! [regexp "^/" "$file"] } then { + if {![regexp "^/" "$file"]} { set file "$srcdir/$subdir/$file" } =20 - if { [ catch { set fd [open "$file"] } message ] } then { + if {[catch { set fd [open "$file"] } message]} { error "$message" } =20 set found -1 for { set line 1 } { 1 } { incr line } { - if { [ catch { set nchar [gets "$fd" body] } message ] } then { + if {[catch { set nchar [gets "$fd" body] } message]} { error "$message" } - if { $nchar < 0 } then { + if {$nchar < 0} { break } - if { [string first "$text" "$body"] >=3D 0 } then { + if {[string first "$text" "$body"] >=3D 0} { set found $line break } } =20 - if { [ catch { close "$fd" } message ] } then { + if {[catch { close "$fd" } message]} { error "$message" } =20 @@ -6904,7 +6904,7 @@ gdb_caching_proc gdb_skip_float_test { set lines [gdb_compile $src $exe executable $compile_flags] file delete $src =20 - if ![string match "" $lines] then { + if {![string match "" $lines]} { verbose "testfile compilation failed, returning 1" 2 return 0 } @@ -7148,7 +7148,7 @@ proc get_build_id { filename } { set data [read $fi] close $fi file delete $tmp - if ![string compare $data ""] then { + if {![string compare $data ""]} { return "" } # Convert it to hex. @@ -7364,7 +7364,7 @@ proc build_executable_from_specs {testname executable= options args} { if [string match gdb_compile_shlib* $func] { set sources_path {} foreach {s local_options} $args { - if { [regexp "^/" "$s"] } then { + if {[regexp "^/" "$s"]} { lappend sources_path "$s" } else { lappend sources_path "$srcdir/$subdir/$s" @@ -7374,7 +7374,7 @@ proc build_executable_from_specs {testname executable= options args} { } elseif {[lsearch -exact $options rust] !=3D -1} { set sources_path {} foreach {s local_options} $args { - if { [regexp "^/" "$s"] } then { + if {[regexp "^/" "$s"]} { lappend sources_path "$s" } else { lappend sources_path "$srcdir/$subdir/$s" @@ -7385,7 +7385,7 @@ proc build_executable_from_specs {testname executable= options args} { set objects {} set i 0 foreach {s local_options} $args { - if { ! [regexp "^/" "$s"] } then { + if {![regexp "^/" "$s"]} { set s "$srcdir/$subdir/$s" } if { [$func "${s}" "${binfile}${i}.o" object $local_options] !=3D ""= } { @@ -8139,7 +8139,7 @@ proc parse_list { level listname argset prefix eval }= { set pattern "$prefix$argument" set result [lsearch -exact $args $pattern] =20 - if {$result !=3D -1} then { + if {$result !=3D -1} { set value 1 set args [lreplace $args $result $result] } else { @@ -8155,7 +8155,7 @@ proc parse_list { level listname argset prefix eval }= { set pattern "$prefix[lindex $arg 0]" set result [lsearch -exact $args $pattern] =20 - if {$result !=3D -1} then { + if {$result !=3D -1} { set value [lindex $args [expr $result+1]] if { $eval } { set value [uplevel [expr $level + 1] [list subst $value]] @@ -8480,7 +8480,7 @@ proc cmp_file_string { file str msg } { set file_contents [read $fp] close $fp } error_message] - if { $caught_error } then { + if {$caught_error} { error "$error_message" fail "$msg" return diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-suppor= t.exp index 14ddf0ad7ff..18a2a04def8 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -22,7 +22,7 @@ load_lib gdb-utils.exp # The variable mi_gdb_prompt is a regexp which matches the gdb mi prompt. # Set it if it is not already set. global mi_gdb_prompt -if ![info exists mi_gdb_prompt] then { +if {![info exists mi_gdb_prompt]} { set mi_gdb_prompt "\[(\]gdb\[)\] \r\n" } =20 @@ -727,19 +727,19 @@ proc mi_gdb_test { args } { global inferior_exited_re async upvar timeout timeout =20 - if { [llength $args] >=3D 1 } then { + if {[llength $args] >=3D 1} { set command [lindex $args 0] } else { error "Not enough arguments in mi_gdb_test" } =20 - if { [llength $args] >=3D 2 } then { + if {[llength $args] >=3D 2} { set pattern [lindex $args 1] } else { set pattern ".*" } =20 - if { [llength $args] >=3D 3 } then { + if {[llength $args] >=3D 3} { set message [lindex $args 2] } else { set message $command @@ -760,7 +760,7 @@ proc mi_gdb_test { args } { error "Too many arguments in mi_gdb_test" } =20 - if $verbose>2 then { + if {$verbose > 2} { send_user "Sending \"$command\" to gdb\n" send_user "Looking to match \"$pattern\"\n" send_user "Message is \"$message\"\n" @@ -819,7 +819,7 @@ proc mi_gdb_test { args } { return -1 } -re "Ending remote debugging.*$mi_gdb_prompt\[ \]*$" { - if ![isnative] then { + if {![isnative]} { warning "Can`t communicate to remote target." } gdb_exit @@ -839,7 +839,7 @@ proc mi_gdb_test { args } { # match a single mi output command. If a second GDB/MI output=20 # response is sent, it will be in the buffer for the next=20 # time mi_gdb_test is called. - if ![string match "" $message] then { + if {![string match "" $message]} { pass "$message" } set result 0 @@ -859,7 +859,7 @@ proc mi_gdb_test { args } { set result 1 } -re "$inferior_exited_re with code \[0-9\]+.*$mi_gdb_prompt\[ \]*$" { - if ![string match "" $message] then { + if {![string match "" $message]} { set errmsg "$message (the program exited)" } else { set errmsg "$command (the program exited)" @@ -868,7 +868,7 @@ proc mi_gdb_test { args } { return -1 } -re "The program is not being run.*$mi_gdb_prompt\[ \]*$" { - if ![string match "" $message] then { + if {![string match "" $message]} { set errmsg "$message (the program is no longer running)" } else { set errmsg "$command (the program is no longer running)" @@ -877,7 +877,7 @@ proc mi_gdb_test { args } { return -1 } -re ".*$mi_gdb_prompt\[ \]*$" { - if ![string match "" $message] then { + if {![string match "" $message]} { fail "$message (unexpected output)" } set result 1 @@ -899,7 +899,7 @@ proc mi_gdb_test { args } { fail "$message" } timeout { - if ![string match "" $message] then { + if {![string match "" $message]} { fail "$message (timeout)" } set result 1 @@ -1752,7 +1752,7 @@ proc mi_prepare_inline_tests { filename } { =20 set mi_autotest_source $filename =20 - if { ! [regexp "^/" "$filename"] } then { + if {![regexp "^/" "$filename"]} { set filename "$srcdir/$subdir/$filename" } =20 diff --git a/gdb/testsuite/lib/prompt.exp b/gdb/testsuite/lib/prompt.exp index d648130b611..1bd34ab72d2 100644 --- a/gdb/testsuite/lib/prompt.exp +++ b/gdb/testsuite/lib/prompt.exp @@ -38,7 +38,7 @@ proc default_prompt_gdb_start { } { } =20 if ![is_remote host] { - if { [which $GDB] =3D=3D 0 } then { + if {[which $GDB] =3D=3D 0} { perror "$GDB does not exist." exit 1 } diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/sel= ftest-support.exp index 2b17c539a96..3c270d88527 100644 --- a/gdb/testsuite/lib/selftest-support.exp +++ b/gdb/testsuite/lib/selftest-support.exp @@ -21,12 +21,12 @@ proc find_gdb { arg } { # If the arg directly specifies an existing executable file, then # simply use it. =20 - if [file executable $arg] then { + if {[file executable $arg]} { return $arg } =20 set result [which $arg] - if [string match "/" [ string range $result 0 0 ]] then { + if {[string match "/" [ string range $result 0 0 ]]} { return $result } =20 @@ -54,11 +54,11 @@ proc selftest_setup { executable function } { =20 set result [gdb_load $executable] =20 - if { $result !=3D 0 } then { + if {$result !=3D 0} { return -1 } =20 - if { $gdb_file_cmd_debug_info !=3D "debug" } then { + if {$gdb_file_cmd_debug_info !=3D "debug"} { untested "no debug information, skipping testcase." return -2 } @@ -139,7 +139,7 @@ proc do_self_tests {function body} { # duration of the test. with_timeout_factor 10 { set result [selftest_setup $file $function] - if {$result =3D=3D 0} then { + if {$result =3D=3D 0} { set result [uplevel $body] } } @@ -147,7 +147,7 @@ proc do_self_tests {function body} { gdb_exit catch "remote_file host delete $file" =20 - if {$result =3D=3D -1} then { + if {$result =3D=3D -1} { warning "Couldn't test self" } } diff --git a/gdb/testsuite/lib/trace-support.exp b/gdb/testsuite/lib/trace-= support.exp index ccad22ecd99..49bf9bd9653 100644 --- a/gdb/testsuite/lib/trace-support.exp +++ b/gdb/testsuite/lib/trace-support.exp @@ -208,7 +208,7 @@ proc gdb_trace_setactions_command { actions_command tes= tname tracepoint args } { if { $testname !=3D "" } { $passfail $testname } - if { $passfail =3D=3D "pass" } then {=20 + if {$passfail =3D=3D "pass"} { return 0 } else { return 1 @@ -265,7 +265,7 @@ proc gdb_tfind_test { testname tfind_arg exp_res args }= { -re "$gdb_prompt $" { } } $passfail "$testname" - if { $passfail =3D=3D "pass" } then {=20 + if {$passfail =3D=3D "pass"} { return 0 } else { return 1 @@ -395,7 +395,7 @@ proc generate_tracefile { binfile } { =20 clean_restart $binfile =20 - if ![runto_main] then { + if {![runto_main]} { return 0 } gdb_continue_to_end "" continue 1