From: Tom de Vries Date: Wed, 17 Sep 2025 04:53:14 +0000 (+0200) Subject: [gdb/testsuite, tclint] Fix gdb.ada X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8d83f149f0baca1aa54f379854b29fefc58c2cf8;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite, tclint] Fix gdb.ada Running tclint on the test-cases in gdb.ada shows a few problems. Fix these. Tested on x86_64-linux. --- diff --git a/gdb/testsuite/gdb.ada/array_bounds.exp b/gdb/testsuite/gdb.ada/array_bounds.exp index 3675c9f8600..ab50da7eadc 100644 --- a/gdb/testsuite/gdb.ada/array_bounds.exp +++ b/gdb/testsuite/gdb.ada/array_bounds.exp @@ -28,7 +28,7 @@ clean_restart ${testfile} set bp_location [gdb_get_line_number "START" ${testdir}/bar.adb] if {![runto "bar.adb:$bp_location"]} { return -} +} gdb_test "print itable'first" \ "= 2" diff --git a/gdb/testsuite/gdb.ada/array_of_variant.exp b/gdb/testsuite/gdb.ada/array_of_variant.exp index 7b35bb01c33..84239a79ce0 100644 --- a/gdb/testsuite/gdb.ada/array_of_variant.exp +++ b/gdb/testsuite/gdb.ada/array_of_variant.exp @@ -24,7 +24,7 @@ set old_gcc [gnat_version_compare < 8] proc gdb_test_with_xfail { cmd re re_xfail msg } { global scenario old_gcc - set have_xfail [expr $old_gcc && [string equal "$scenario" "minimal"]] + set have_xfail [expr {$old_gcc && [string equal "$scenario" "minimal"]}] gdb_test_multiple $cmd $msg { -re -wrap $re { diff --git a/gdb/testsuite/gdb.ada/arrayidx.exp b/gdb/testsuite/gdb.ada/arrayidx.exp index 9481d286792..b29a2a742b1 100644 --- a/gdb/testsuite/gdb.ada/arrayidx.exp +++ b/gdb/testsuite/gdb.ada/arrayidx.exp @@ -34,7 +34,7 @@ runto "p.adb:$bp_location" gdb_test_no_output "set print array-indexes off" -if $old_gcc { +if {$old_gcc} { setup_xfail "*-*-*" } gdb_test "print one_two_three" \ @@ -57,21 +57,21 @@ gdb_test "print p_one_two_three" \ "= \\(false, true, true\\)" \ "print p_one_two_three, indexes off" -if $old_gcc { +if {$old_gcc} { setup_xfail "*-*-*" } gdb_test "print few_reps" \ "= \\(1, 2, 3, 3, 3, 3, 3, 4, 5\\)" \ "print few_reps, indexes off" -if $old_gcc { +if {$old_gcc} { setup_xfail "*-*-*" } gdb_test "print many_reps" \ "= \\(1, 2, 3 , 4, 5\\)" \ "print many_reps, indexes off" -if $old_gcc { +if {$old_gcc} { setup_xfail "*-*-*" } gdb_test "print empty" \ @@ -82,7 +82,7 @@ gdb_test "print empty" \ gdb_test_no_output "set print array-indexes on" -if $old_gcc { +if {$old_gcc} { setup_xfail "*-*-*" } gdb_test "print one_two_three" \ @@ -100,19 +100,19 @@ gdb_test "print u_one_two_three" \ gdb_test "print p_one_two_three" \ "= \\(one => false, two => true, three => true\\)" -if $old_gcc { +if {$old_gcc} { setup_xfail "*-*-*" } gdb_test "print few_reps" \ "= \\(1 => 1, 2 => 2, 3 => 3, 4 => 3, 5 => 3, 6 => 3, 7 => 3, 8 => 4, 9 => 5\\)" -if $old_gcc { +if {$old_gcc} { setup_xfail "*-*-*" } gdb_test "print many_reps" \ "= \\(1 => 1, 2 => 2, 3 => 3 , 15 => 4, 16 => 5\\)" -if $old_gcc { +if {$old_gcc} { setup_xfail "*-*-*" } gdb_test "print empty" \ diff --git a/gdb/testsuite/gdb.ada/call_pn.exp b/gdb/testsuite/gdb.ada/call_pn.exp index 7e015239a63..4d9c26e1f45 100644 --- a/gdb/testsuite/gdb.ada/call_pn.exp +++ b/gdb/testsuite/gdb.ada/call_pn.exp @@ -38,7 +38,7 @@ if {![runto "foo.adb:$bp_location"]} { gdb_test_no_output {maint expand-symtabs "\(pck\|foo\)\.adb"} set gcc_major_version [gcc_major_version] -set have_xfail [expr $gcc_major_version >= 8 && $gcc_major_version <= 9] +set have_xfail [expr {$gcc_major_version >= 8 && $gcc_major_version <= 9}] # The xfail is for PR gcc/94469, which occurs with target board # unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects and gcc-8 and later. diff --git a/gdb/testsuite/gdb.ada/complete.exp b/gdb/testsuite/gdb.ada/complete.exp index c8fcc47050e..18548c7255b 100644 --- a/gdb/testsuite/gdb.ada/complete.exp +++ b/gdb/testsuite/gdb.ada/complete.exp @@ -164,7 +164,7 @@ test_gdb_complete "external_ident" \ [multi_line "p external_identical_one" \ "p external_identical_two" ] -# Complete on the name of package. +# Complete on the name of package. test_gdb_complete "pck" \ [multi_line_with_optional \ "(p pck)?" \ diff --git a/gdb/testsuite/gdb.ada/formatted_ref.exp b/gdb/testsuite/gdb.ada/formatted_ref.exp index c63f847abee..d473554fd62 100644 --- a/gdb/testsuite/gdb.ada/formatted_ref.exp +++ b/gdb/testsuite/gdb.ada/formatted_ref.exp @@ -16,8 +16,8 @@ # Author: P. N. Hilfinger, AdaCore Inc. # Note: This test is essentially a transcription of gdb.cp/formatted-ref.exp, -# and is thus much more wordy than it needs to be. There are fewer -# tests because only a few parameter types in Ada are required to be +# and is thus much more wordy than it needs to be. There are fewer +# tests because only a few parameter types in Ada are required to be # passed by reference, and there is no equivalent of &(&x) for reference # values. # This also tests that some other arithmetic operations on references @@ -54,7 +54,7 @@ proc test_p_x { var val addr } { gdb_test_multiple "$test" $test { -re "\\$\[0-9\]+ = [string_to_regexp $val].*$gdb_prompt $" { pass $test - } + } -re "\\$\[0-9\]+ = $addr.*$gdb_prompt $" { fail "$test (prints just address)" } diff --git a/gdb/testsuite/gdb.ada/frame_args.exp b/gdb/testsuite/gdb.ada/frame_args.exp index 4ffc3d15392..e6cf868774a 100644 --- a/gdb/testsuite/gdb.ada/frame_args.exp +++ b/gdb/testsuite/gdb.ada/frame_args.exp @@ -32,7 +32,7 @@ set sp "\[ \t\]*" if {![runto break_me]} { return -} +} # First, print all the arrays without indexes diff --git a/gdb/testsuite/gdb.ada/fun_in_declare.exp b/gdb/testsuite/gdb.ada/fun_in_declare.exp index 9ababcffdb4..a5f6f63d56e 100644 --- a/gdb/testsuite/gdb.ada/fun_in_declare.exp +++ b/gdb/testsuite/gdb.ada/fun_in_declare.exp @@ -27,7 +27,7 @@ clean_restart ${testfile} if {![runto_main]} { return -} +} # Some variables used to simplify the maintenance of some of # the regular expressions below. diff --git a/gdb/testsuite/gdb.ada/huge.exp b/gdb/testsuite/gdb.ada/huge.exp index 9a86804fe26..fa94fa00d75 100644 --- a/gdb/testsuite/gdb.ada/huge.exp +++ b/gdb/testsuite/gdb.ada/huge.exp @@ -34,7 +34,7 @@ set opts {} lappend opts debug set compilation_succeeded 0 -for { set size $max } { $size >= $min } { set size [expr $size / 2] } { +for { set size $max } { $size >= $min } { set size [expr {$size / 2}] } { set try_opts [concat $opts [list additional_flags=-gnateDCRASHGDB=$size]] # Use gdb_compile_ada_1 to prevent failed compilations from producing a # FAIL. diff --git a/gdb/testsuite/gdb.ada/limited-length.exp b/gdb/testsuite/gdb.ada/limited-length.exp index 7172c373624..a5001fa2949 100644 --- a/gdb/testsuite/gdb.ada/limited-length.exp +++ b/gdb/testsuite/gdb.ada/limited-length.exp @@ -70,7 +70,7 @@ with_test_prefix "with standard max-value size" { # Set the max-value-size so we can only print 33 elements. set elements 33 set elem_size [get_valueof "/d" "(Large_1d_Array(1)'Size + 7) / 8" "*unknown*"] -gdb_test_no_output "set max-value-size [expr $elem_size * $elements]" +gdb_test_no_output "set max-value-size [expr {$elem_size * $elements}]" with_test_prefix "with reduced max-value size" { # GNAT historically named this type, but as the array type is diff --git a/gdb/testsuite/gdb.ada/mod_from_name.exp b/gdb/testsuite/gdb.ada/mod_from_name.exp index 6384f39e939..e97eb5a33fa 100644 --- a/gdb/testsuite/gdb.ada/mod_from_name.exp +++ b/gdb/testsuite/gdb.ada/mod_from_name.exp @@ -31,7 +31,7 @@ foreach_gnat_encoding scenario flags {all minimal} { set bp_location [gdb_get_line_number "START" ${testdir}/foo.adb] if {![runto "foo.adb:$bp_location"]} { return - } + } # GNAT 9 and 10 are known to fail. if {$scenario == "minimal" diff --git a/gdb/testsuite/gdb.ada/null_array.exp b/gdb/testsuite/gdb.ada/null_array.exp index 82c1923483c..851a0a6907f 100644 --- a/gdb/testsuite/gdb.ada/null_array.exp +++ b/gdb/testsuite/gdb.ada/null_array.exp @@ -30,7 +30,7 @@ runto "foo.adb:$bp_location" if {[gnat_version_compare <= {4 4}]} { # Ada array bounds are missing in older GCCs. - setup_xfail *-*-* + setup_xfail *-*-* } gdb_test "print my_table" \ "= \\(\\)" diff --git a/gdb/testsuite/gdb.ada/ref_param.exp b/gdb/testsuite/gdb.ada/ref_param.exp index d1d89601980..1ae1d9701bd 100644 --- a/gdb/testsuite/gdb.ada/ref_param.exp +++ b/gdb/testsuite/gdb.ada/ref_param.exp @@ -27,7 +27,7 @@ clean_restart ${testfile} if {![runto pck.adb:20]} { return -} +} gdb_test_no_output "set print frame-arguments all" diff --git a/gdb/testsuite/gdb.ada/scalar_storage.exp b/gdb/testsuite/gdb.ada/scalar_storage.exp index 52a85cd18b1..a3805410882 100644 --- a/gdb/testsuite/gdb.ada/scalar_storage.exp +++ b/gdb/testsuite/gdb.ada/scalar_storage.exp @@ -48,7 +48,7 @@ if {![runto "storage.adb:$bp_location"]} { set re "value => 126, another_value => 12, color => green" # This requires a compiler fix that is in GCC 14. -set have_xfail [expr ![gnat_version_compare >= 14]] +set have_xfail [expr {![gnat_version_compare >= 14]}] set re_color "(red|green|blue|$decimal)" set re_xfail \ "value => $decimal, another_value => $decimal, color => $re_color" diff --git a/gdb/testsuite/gdb.ada/taft_type.exp b/gdb/testsuite/gdb.ada/taft_type.exp index ac7b258d195..875718fc9de 100644 --- a/gdb/testsuite/gdb.ada/taft_type.exp +++ b/gdb/testsuite/gdb.ada/taft_type.exp @@ -28,7 +28,7 @@ clean_restart ${testfile} set bp_location [gdb_get_line_number "START" ${testdir}/p.adb] if {![runto "p.adb:$bp_location"]} { return -} +} gdb_test "print w.e.all" \ "= \\(month => 8, year => 1974\\)" diff --git a/gdb/testsuite/gdb.ada/verylong.exp b/gdb/testsuite/gdb.ada/verylong.exp index e695ddd9505..de5fd0417a3 100644 --- a/gdb/testsuite/gdb.ada/verylong.exp +++ b/gdb/testsuite/gdb.ada/verylong.exp @@ -44,10 +44,10 @@ gdb_test_multiple "ptype Long_Long_Long_Integer" "" { require {expr $lll_int_size == 8 || $lll_int_size == 16} gdb_test "print x" " = $max" -gdb_test "print x / 2" " = [expr $max / 2]" -gdb_test "print (x / 4) * 2" " = [expr ($max / 4) * 2]" +gdb_test "print x / 2" " = [expr {$max / 2}]" +gdb_test "print (x / 4) * 2" " = [expr {($max / 4) * 2}]" gdb_test "print x - x" " = 0" -gdb_test "print x - 99 + 1" " = [expr $max - 99 + 1]" +gdb_test "print x - 99 + 1" " = [expr {$max - 99 + 1}]" gdb_test "print -x" " = -$max" gdb_test "print +x" " = $max" diff --git a/gdb/testsuite/gdb.ada/whatis_array_val.exp b/gdb/testsuite/gdb.ada/whatis_array_val.exp index 2ccac34b0ee..becc9b87569 100644 --- a/gdb/testsuite/gdb.ada/whatis_array_val.exp +++ b/gdb/testsuite/gdb.ada/whatis_array_val.exp @@ -28,7 +28,7 @@ clean_restart ${testfile} set bp_location [gdb_get_line_number "STOP" ${testdir}/foo.adb] if {![runto "foo.adb:$bp_location"]} { return -} +} # Accept "foo." prefix for older versions of GNAT. gdb_test "whatis full" \