]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite, tclint] Fix gdb.ada
authorTom de Vries <tdevries@suse.de>
Wed, 17 Sep 2025 04:53:14 +0000 (06:53 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 17 Sep 2025 04:53:14 +0000 (06:53 +0200)
Running tclint on the test-cases in gdb.ada shows a few problems.

Fix these.

Tested on x86_64-linux.

17 files changed:
gdb/testsuite/gdb.ada/array_bounds.exp
gdb/testsuite/gdb.ada/array_of_variant.exp
gdb/testsuite/gdb.ada/arrayidx.exp
gdb/testsuite/gdb.ada/call_pn.exp
gdb/testsuite/gdb.ada/complete.exp
gdb/testsuite/gdb.ada/formatted_ref.exp
gdb/testsuite/gdb.ada/frame_args.exp
gdb/testsuite/gdb.ada/fun_in_declare.exp
gdb/testsuite/gdb.ada/huge.exp
gdb/testsuite/gdb.ada/limited-length.exp
gdb/testsuite/gdb.ada/mod_from_name.exp
gdb/testsuite/gdb.ada/null_array.exp
gdb/testsuite/gdb.ada/ref_param.exp
gdb/testsuite/gdb.ada/scalar_storage.exp
gdb/testsuite/gdb.ada/taft_type.exp
gdb/testsuite/gdb.ada/verylong.exp
gdb/testsuite/gdb.ada/whatis_array_val.exp

index 3675c9f8600eea88f4c60ad9e6d57bb0ba60b4f2..ab50da7eadc0c3b41e33d0a70ea5a3e9b5d013b5 100644 (file)
@@ -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"
index 7b35bb01c3329842dc60ef45977485d6490279c4..84239a79ce0a2213d87062903a557bc9e5036730 100644 (file)
@@ -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  {
index 9481d286792560506cec19d7b9760a7b0f574c91..b29a2a742b1f59da9e264fee689532096d75fe81 100644 (file)
@@ -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 <repeats 12 times>, 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 <repeats 12 times>, 15 => 4, 16 => 5\\)"
 
-if $old_gcc {
+if {$old_gcc} {
     setup_xfail "*-*-*"
 }
 gdb_test "print empty" \
index 7e015239a636f134402545f9a3e03cdeb982bd86..4d9c26e1f45feb961dda024c2b3f7aba2a531af8 100644 (file)
@@ -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.
index c8fcc47050ee0031283b7a5a85036926364e1286..18548c7255b710b3eb5d766fb34bb63bdbd41b68 100644 (file)
@@ -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)?" \
index c63f847abee63d7dd7a4ff8ac33a235d080c38fa..d473554fd627753f21054b4a05d5af34327b7340 100644 (file)
@@ -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)"
         }
index 4ffc3d153921a0f12631e475a84ddda47d099d4c..e6cf868774a1d063534f082d0cabd300303cdbd0 100644 (file)
@@ -32,7 +32,7 @@ set sp "\[ \t\]*"
 
 if {![runto break_me]} {
   return
-} 
+}
 
 # First, print all the arrays without indexes
 
index 9ababcffdb47771cacaa05800a1e88af9d5d64f4..a5f6f63d56e99ff37316912902761a7fdf7afa58 100644 (file)
@@ -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.
index 9a86804fe261f8ec9df2a95794e91db9945497a6..fa94fa00d75ac9eb778a64cd19c84e9fe9b217f7 100644 (file)
@@ -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.
index 7172c3736246ac5408385d35c8869a52f3a6a630..a5001fa29493e97c6671ab4cf99bd125b8573909 100644 (file)
@@ -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
index 6384f39e939dc76d69c051d758b7019dfe1ce050..e97eb5a33fa419b57777613f221bae6ad3d78bf7 100644 (file)
@@ -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"
index 82c1923483cae3f7fd362a59b889f3ae05cc7245..851a0a6907f0f299f23df63fc8d83e8a2ea3335f 100644 (file)
@@ -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" \
          "= \\(\\)"
index d1d89601980e943ae2df00e2cd6339a0679e6a93..1ae1d9701bddfdffa3ef184c4a5bf015911d6768 100644 (file)
@@ -27,7 +27,7 @@ clean_restart ${testfile}
 
 if {![runto pck.adb:20]} {
   return
-} 
+}
 
 gdb_test_no_output "set print frame-arguments all"
 
index 52a85cd18b126ed8a572d407e42da6cb7d66f2c6..a3805410882e4e9c0edf8704855a38dc1ac2285c 100644 (file)
@@ -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"
index ac7b258d195d296cbff94345a654ef219307b21e..875718fc9de710e1b4128772593be8b42aeba4ad 100644 (file)
@@ -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\\)"
index e695ddd950510417d92925c054e27c76d5e3c255..de5fd0417a350c8261e2753c769efcfc0c16c544 100644 (file)
@@ -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"
 
index 2ccac34b0ee7155f0e5aba3c914f25ab5b0cd5a2..becc9b8756942b0a26e8b586553c373bc2de3d71 100644 (file)
@@ -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" \