gdb/testsuite: remove use of then keyword from library files

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

There should be no changes in what is tested after this commit.
diff --git a/gdb/testsuite/boards/native-extended-gdbserver.exp b/gdb/testsuite/boards/native-extended-gdbserver.exp
index 67acc6f..88857d6 100644
--- a/gdb/testsuite/boards/native-extended-gdbserver.exp
+++ b/gdb/testsuite/boards/native-extended-gdbserver.exp
@@ -113,7 +113,7 @@
 # to a separate non-dbx testcase, we should be able to remove this.
 proc gdb_load { arg } {
     if { $arg != "" } {
-	if [gdb_file_cmd $arg] then { return -1 }
+	if {[gdb_file_cmd $arg]} { return -1 }
     }
 
     return [extended_gdbserver_load_last_file]
@@ -129,7 +129,7 @@
     global mi_gdb_prompt
 
     set res [extended_gdbserver_mi_gdb_load $arg]
-    if { $res } then { return -1 }
+    if {$res} { return -1 }
 
     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 e783177..5926630 100644
--- a/gdb/testsuite/config/sid.exp
+++ b/gdb/testsuite/config/sid.exp
@@ -22,7 +22,7 @@
 	{ *big-endian* *-EB* *-meb* } { set sidendian "-EB" }
 	{ *little-endian* *-EL* *-mel* } { set sidendian "-EL" }
 	default { 
-	    if {[target_info exists sim,defaultendian]} then {
+	    if {[target_info exists sim,defaultendian]} {
 		set sidendian [target_info sim,defaultendian] 
 	    } else { 
                 # rely on endianness settings in sid configuration defaults
@@ -39,12 +39,12 @@
     # test to see whether to use use sid in build or install tree
     set use_build_tree [file exists ../../sid]
 
-    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] == "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 @@
     global retval
 
     if { $arg != "" } {
-	if [gdb_file_cmd $arg] then { return -1 }
+	if {[gdb_file_cmd $arg]} { return -1 }
     }
 
     gdb_target_sid
@@ -181,25 +181,25 @@
     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 8629585..57c5458 100644
--- a/gdb/testsuite/config/sim.exp
+++ b/gdb/testsuite/config/sim.exp
@@ -48,26 +48,26 @@
     global gdb_prompt
 
     if { $arg != "" } {
-	if [gdb_file_cmd $arg] then { return -1 }
+	if {[gdb_file_cmd $arg]} { return -1 }
     }
 
-    if [gdb_target_sim] then { return -1 }
+    if {[gdb_target_sim]} { return -1 }
 
     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 34679a8..d81aaa2 100644
--- a/gdb/testsuite/config/slite.exp
+++ b/gdb/testsuite/config/slite.exp
@@ -83,7 +83,7 @@
 	}
 	 -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 @@
 		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 @@
 	}
     }
 
-    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-support.exp
index 87bbf91..82ad59d 100644
--- a/gdb/testsuite/lib/cp-support.exp
+++ b/gdb/testsuite/lib/cp-support.exp
@@ -251,7 +251,7 @@
 	# The test name defaults to the command, but without the
 	# arguments, for historical reasons.
 
-	if { "$in_testname" == "" } then { set in_testname "ptype $in_exp" }
+	if {"$in_testname" == ""} { set in_testname "ptype $in_exp" }
 
 	set in_command "ptype${in_ptype_arg} $in_exp"
     }
@@ -259,8 +259,8 @@
     # Save class tables in a history array for reuse.
 
     global cp_class_table_history
-    if { $in_class_table == "ibid" } then {
-	if { ! [info exists cp_class_table_history("$in_key,$in_tag") ] } then {
+    if {$in_class_table == "ibid"} {
+	if {![info exists cp_class_table_history("$in_key,$in_tag")]} {
 	    fail "$in_testname // bad ibid"
 	    return false
 	}
@@ -385,7 +385,7 @@
 
     # Check the actual tag.
 
-    if { "$actual_tag" != "$in_tag" } then {
+    if {"$actual_tag" != "$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 @@
     # First parse them into a list.
 
     set list_actual_bases { }
-    if { "$actual_base_string" != "" } then {
+    if {"$actual_base_string" != ""} {
 	regsub "^:${wsopt}" $actual_base_string "" actual_base_string
 	set list_actual_bases [split $actual_base_string ","]
     }
 
     # Check the base count.
 
-    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 @@
     foreach actual_base $list_actual_bases {
 	set actual_base [string trim $actual_base]
 	set base [lindex $list_bases 0]
-	if { "$actual_base" != "$base" } then {
+	if {"$actual_base" != "$base"} {
 	    cp_check_errata "$base" "$actual_base" $in_errata_table
 	    fail "$in_testname // wrong base: $actual_base"
 	    return false
@@ -449,13 +449,13 @@
 	# Get the next line.
 
 	set actual_line [cp_support_internal::next_line $line_queue]
-	if { "$actual_line" == "" } then { continue }
+	if {"$actual_line" == ""} { continue }
 
 	# Access specifiers.
 
-	if { [regexp "^(public|protected|private)${wsopt}:\$" "$actual_line" s0 s1] } 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 @@
 
 	# Optional virtual base pointer.
 
-	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" != "private" } then {
+	    if {[regexp "$vbase \\*(_vb.|_vb\\\$|__vb_)\[0-9\]*$vbase;" $actual_line]} {
+		if {"$access" != "private"} {
 		    cp_check_errata "private" "$access" $in_errata_table
 		    fail "$in_testname // wrong access specifier for virtual base: $access"
 		    queue delete $line_queue
@@ -485,7 +485,7 @@
 
 	# Data field.
 
-	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 @@
 		cp_ptype_class_verbose "\tfield_decl=$field_decl"
 		cp_ptype_class_verbose "\taccess=$access"
 	    }
-	    if { "$actual_line" == "$field_decl" } then {
-		if { "$access" != "$field_access" } then {
+	    if {"$actual_line" == "$field_decl"} {
+		if {"$access" != "$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 @@
 
 	# Method function.
 
-	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" == "$method_decl" } then {
-		if { "$access" != "$method_access" } then {
+	    if {"$actual_line" == "$method_decl"} {
+		if {"$access" != "$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 @@
 
 	    # gcc 2.95.3 shows "foo()" as "foo(void)".
 	    regsub -all "\\(\\)" $method_decl "(void)" method_decl
-	    if { "$actual_line" == "$method_decl" } then {
-		if { "$access" != "$method_access" } then {
+	    if {"$actual_line" == "$method_decl"} {
+		if {"$access" != "$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 @@
 	    set synth_access  [lindex $synth 1]
 	    set synth_re      [lindex $synth 2]
 
-	    if { [ regexp "$synth_re" "$actual_line" ] } then {
+	    if {[regexp "$synth_re" "$actual_line"]} {
 
-		if { "$access" != "$synth_access" } then {
+		if {"$access" != "$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
 		}
 
-		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 @@
 		break
 	    }
 	}
-	if { $synth_match } then { continue }
+	if {$synth_match} { continue }
 
 	# If checking a nested type/recursively and we see a closing curly
 	# brace, we're done.
@@ -725,7 +725,7 @@
 
 	# Unrecognized line.
 
-	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 @@
 
     # Check for missing elements.
 
-    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
 	}
     }
 
-    if { [llength $list_fields] > 0 } then {
+    if {[llength $list_fields] > 0} {
 	fail "$in_testname // missing fields"
 	return false
     }
 
-    if { [llength $list_methods] > 0 } then {
+    if {[llength $list_methods] > 0} {
 	fail "$in_testname // missing methods"
 	return false
     }
@@ -767,7 +767,7 @@
     # Check the tail.
 
     set actual_tail [string trim $actual_tail]
-    if { "$actual_tail" != "$in_tail" } then {
+    if {"$actual_tail" != "$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 9df8e7f..35f4e95 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -104,7 +104,7 @@
     global subdir
     global srcdir
 
-    if { ! [regexp "^/" "$executable"] } then {
+    if {![regexp "^/" "$executable"]} {
 	set binfile [standard_output_file $executable]
     } else {
 	set binfile $executable
@@ -143,7 +143,7 @@
 	set s [lindex $spec 0]
 	set local_options [lindex $spec 1]
 
-	if { ! [regexp "^/" "$s"] } then {
+	if {![regexp "^/" "$s"]} {
 	    set s "$srcdir/$subdir/$s"
 	}
 
@@ -1685,7 +1685,7 @@
 	    proc base { addr } {
 		variable _debug_ranges_64_bit
 
-		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 @@
 	    proc range { start end } {
 		variable _debug_ranges_64_bit
 
-		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 @@
 	    uplevel $body
 
 	    # 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 a73437a..b4d4e46 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -227,7 +227,7 @@
 # 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\\)"
 }
 
@@ -1145,7 +1145,7 @@
     regsub -all {\r} $patterns {\\r} patterns
     regsub -all {\n} $patterns {\\n} patterns
 
-    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 @@
 
     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 @@
 	    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 @@
 	    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 @@
 	    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 @@
 	    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 @@
 	    set result -1
 	}
 	timeout	{
-	    if ![string match "" $message] then {
+	    if {![string match "" $message]} {
 		fail "$message (timeout)"
 	    }
 	    set result 1
@@ -1679,13 +1679,13 @@
     global gdb_prompt
     global verbose
 
-    if [llength $args]==2 then {
+    if {[llength $args] == 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 @@
     # 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]==3 then {
+    if {[llength $args] == 3} {
 	set message [lindex $args 2]
 	return [gdb_test $command $pattern $message]
     }
@@ -2250,7 +2250,7 @@
     }
 
     if ![is_remote host] {
-	if { [which $GDB] == 0 } then {
+	if {[which $GDB] == 0} {
 	    perror "$GDB does not exist."
 	    exit 1
 	}
@@ -4597,7 +4597,7 @@
     # such an option is specified.
     set opt "additional_flags=-fdiagnostics-color=never"
     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 @@
 
     file delete $src
 
-    if ![string match "" $lines] then {
+    if {![string match "" $lines]} {
         verbose "$name:  compilation failed, returning 0" 2
         return 0
     }
@@ -5524,7 +5524,7 @@
     # 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 setup_xfail_format { format } {
     set ret [test_debug_format $format]
 
-    if {$ret} then {
+    if {$ret} {
 	setup_xfail "*-*-*"
     }
     return $ret
@@ -6667,32 +6667,32 @@
     global subdir
     global srcfile
 
-    if { "$file" == "" } then {
+    if {"$file" == ""} {
 	set file "$srcfile"
     }
-    if { ! [regexp "^/" "$file"] } then {
+    if {![regexp "^/" "$file"]} {
 	set file "$srcdir/$subdir/$file"
     }
 
-    if { [ catch { set fd [open "$file"] } message ] } then {
+    if {[catch { set fd [open "$file"] } message]} {
 	error "$message"
     }
 
     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"] >= 0 } then {
+	if {[string first "$text" "$body"] >= 0} {
 	    set found $line
 	    break
 	}
     }
 
-    if { [ catch { close "$fd" } message ] } then {
+    if {[catch { close "$fd" } message]} {
 	error "$message"
     }
 
@@ -6904,7 +6904,7 @@
 	set lines [gdb_compile $src $exe executable $compile_flags]
 	file delete $src
 
-	if ![string match "" $lines] then {
+	if {![string match "" $lines]} {
 	    verbose "testfile compilation failed, returning 1" 2
 	    return 0
 	}
@@ -7148,7 +7148,7 @@
 	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 @@
     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 @@
     } elseif {[lsearch -exact $options rust] != -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 @@
 	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] != "" } {
@@ -8139,7 +8139,7 @@
 	    set pattern "$prefix$argument"
 	    set result [lsearch -exact $args $pattern]
 
-	    if {$result != -1} then {
+	    if {$result != -1} {
 		set value 1
 		set args [lreplace $args $result $result]
 	    } else {
@@ -8155,7 +8155,7 @@
 	    set pattern "$prefix[lindex $arg 0]"
 	    set result [lsearch -exact $args $pattern]
 
-	    if {$result != -1} then {
+	    if {$result != -1} {
 		set value [lindex $args [expr $result+1]]
 		if { $eval } {
 		    set value [uplevel [expr $level + 1] [list subst $value]]
@@ -8480,7 +8480,7 @@
 	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-support.exp
index 14ddf0a..18a2a04 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -22,7 +22,7 @@
 # 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"
 }
 
@@ -727,19 +727,19 @@
     global inferior_exited_re async
     upvar timeout timeout
 
-    if { [llength $args] >= 1 } then {
+    if {[llength $args] >= 1} {
 	set command [lindex $args 0]
     } else {
 	error "Not enough arguments in mi_gdb_test"
     }
 
-    if { [llength $args] >= 2 } then {
+    if {[llength $args] >= 2} {
 	set pattern [lindex $args 1]
     } else {
 	set pattern ".*"
     }
 
-    if { [llength $args] >= 3 } then {
+    if {[llength $args] >= 3} {
 	set message [lindex $args 2]
     } else {
 	set message $command
@@ -760,7 +760,7 @@
 	error "Too many arguments in mi_gdb_test"
     }
 
-    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 @@
 	     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 @@
 	    # match a single mi output command.  If a second GDB/MI output 
 	    # response is sent, it will be in the buffer for the next 
 	    # time mi_gdb_test is called.
-	    if ![string match "" $message] then {
+	    if {![string match "" $message]} {
 		pass "$message"
 	    }
 	    set result 0
@@ -859,7 +859,7 @@
 	    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 @@
 	    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 @@
 	    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 @@
 	     fail "$message"
 	}
 	timeout	{
-	    if ![string match "" $message] then {
+	    if {![string match "" $message]} {
 		fail "$message (timeout)"
 	    }
 	    set result 1
@@ -1752,7 +1752,7 @@
 
     set mi_autotest_source $filename
 
-    if { ! [regexp "^/" "$filename"] } then {
+    if {![regexp "^/" "$filename"]} {
 	set filename "$srcdir/$subdir/$filename"
     }
 
diff --git a/gdb/testsuite/lib/prompt.exp b/gdb/testsuite/lib/prompt.exp
index d648130..1bd34ab 100644
--- a/gdb/testsuite/lib/prompt.exp
+++ b/gdb/testsuite/lib/prompt.exp
@@ -38,7 +38,7 @@
     }
 
     if ![is_remote host] {
-	if { [which $GDB] == 0 } then {
+	if {[which $GDB] == 0} {
 	    perror "$GDB does not exist."
 	    exit 1
 	}
diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp
index 2b17c53..3c270d8 100644
--- a/gdb/testsuite/lib/selftest-support.exp
+++ b/gdb/testsuite/lib/selftest-support.exp
@@ -21,12 +21,12 @@
     # If the arg directly specifies an existing executable file, then
     # simply use it.
 
-    if [file executable $arg] then {
+    if {[file executable $arg]} {
 	return $arg
     }
 
     set result [which $arg]
-    if [string match "/" [ string range $result 0 0 ]] then {
+    if {[string match "/" [ string range $result 0 0 ]]} {
 	return $result
     }
 
@@ -54,11 +54,11 @@
 
     set result [gdb_load $executable]
 
-    if { $result != 0 } then {
+    if {$result != 0} {
 	return -1
     }
 
-    if { $gdb_file_cmd_debug_info != "debug" } then {
+    if {$gdb_file_cmd_debug_info != "debug"} {
 	untested "no debug information, skipping testcase."
 	return -2
     }
@@ -139,7 +139,7 @@
     # duration of the test.
     with_timeout_factor 10 {
 	set result [selftest_setup $file $function]
-	if {$result == 0} then {
+	if {$result == 0} {
 	    set result [uplevel $body]
 	}
     }
@@ -147,7 +147,7 @@
     gdb_exit
     catch "remote_file host delete $file"
 
-    if {$result == -1} then {
+    if {$result == -1} {
 	warning "Couldn't test self"
     }
 }
diff --git a/gdb/testsuite/lib/trace-support.exp b/gdb/testsuite/lib/trace-support.exp
index ccad22e..49bf9bd 100644
--- a/gdb/testsuite/lib/trace-support.exp
+++ b/gdb/testsuite/lib/trace-support.exp
@@ -208,7 +208,7 @@
     if { $testname != "" } {
 	$passfail $testname
     }
-    if { $passfail == "pass" } then { 
+    if {$passfail == "pass"} {
 	return 0
     } else {
 	return 1
@@ -265,7 +265,7 @@
 	-re "$gdb_prompt $" { }
     }
     $passfail "$testname"
-    if { $passfail == "pass" } then { 
+    if {$passfail == "pass"} {
 	return 0
     } else {
 	return 1
@@ -395,7 +395,7 @@
 
 	clean_restart $binfile
 
-	if ![runto_main] then {
+	if {![runto_main]} {
 	    return 0
 	}
 	gdb_continue_to_end "" continue 1