diff options
author | Andrew Burgess <aburgess@redhat.com> | 2022-11-14 14:45:05 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2022-11-28 21:04:10 +0000 |
commit | d4c4542312ca16fe83c8dc8d8acce4667aa7992c (patch) | |
tree | eccc8cb7c83345f424089a039f772ca200679442 /gdb/testsuite/lib/cp-support.exp | |
parent | f50c72da4dc7ab67ea244e9c6e97404a04700c2d (diff) | |
download | fsf-binutils-gdb-d4c4542312ca16fe83c8dc8d8acce4667aa7992c.zip fsf-binutils-gdb-d4c4542312ca16fe83c8dc8d8acce4667aa7992c.tar.gz fsf-binutils-gdb-d4c4542312ca16fe83c8dc8d8acce4667aa7992c.tar.bz2 |
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.
Diffstat (limited to 'gdb/testsuite/lib/cp-support.exp')
-rw-r--r-- | gdb/testsuite/lib/cp-support.exp | 64 |
1 files changed, 32 insertions, 32 deletions
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 @@ 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. - 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 @@ 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. 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 @@ proc cp_test_ptype_class { in_exp in_testname in_key in_tag in_class_table # 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 @@ proc cp_test_ptype_class { in_exp in_testname in_key in_tag in_class_table # 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 @@ 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" != "$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 @@ proc cp_test_ptype_class { in_exp in_testname in_key in_tag in_class_table # 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 @@ proc cp_test_ptype_class { in_exp in_testname in_key in_tag in_class_table # 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 @@ proc cp_test_ptype_class { in_exp in_testname in_key in_tag in_class_table # 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 @@ proc cp_test_ptype_class { in_exp in_testname in_key in_tag in_class_table 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 @@ proc cp_test_ptype_class { in_exp in_testname in_key in_tag in_class_table # 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 @@ proc cp_test_ptype_class { in_exp in_testname in_key in_tag in_class_table # 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 @@ 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] - 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 @@ 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 } # 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 # 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 @@ proc cp_test_ptype_class { in_exp in_testname in_key in_tag in_class_table # 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 @@ proc cp_test_ptype_class { in_exp in_testname in_key in_tag in_class_table # 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 |