]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite, tclint] Fix gdb.tui
authorTom de Vries <tdevries@suse.de>
Fri, 12 Sep 2025 13:04:50 +0000 (15:04 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 12 Sep 2025 13:04:50 +0000 (15:04 +0200)
Running tclint on the test-cases in gdb.tui shows a few problems:
...
$ ( cd gdb/testsuite/gdb.tui; tclint --ignore line-length *.exp )
compact-source.exp:58:28: expression with substitutions should be enclosed by \
  braces [unbraced-expr]
compact-source.exp:60:27: expression with substitutions should be enclosed by \
  braces [unbraced-expr]
compact-source.exp:68:32: expression with substitutions should be enclosed by \
  braces [unbraced-expr]
empty.exp:68:2: eval received an argument with a substitution, unable to \
  parse its arguments [command-args]
new-layout.exp:84:2: eval received an argument with a substitution, unable \
  to parse its arguments [command-args]
source-search.exp:33:25: expression with substitutions should be enclosed by \
  braces [unbraced-expr]
wrap-line.exp:40:21: expression with substitutions should be enclosed by \
  braces [unbraced-expr]
wrap-line.exp:44:14: expression with substitutions should be enclosed by \
  braces [unbraced-expr]
wrap-line.exp:62:40: expression with substitutions should be enclosed by \
  braces [unbraced-expr]
...

Fix these.

Tested on aarch64-linux.

gdb/testsuite/gdb.tui/compact-source.exp
gdb/testsuite/gdb.tui/empty.exp
gdb/testsuite/gdb.tui/new-layout.exp
gdb/testsuite/gdb.tui/source-search.exp
gdb/testsuite/gdb.tui/wrap-line.exp

index 33d8827164e886d5e4cdb1f5d8cf482097d4f4e7..31bc1dcb5e515a95b44ec03a803ca22663d527f9 100644 (file)
@@ -55,9 +55,9 @@ set re_border "\\|"
 
 set max_line_nr_in_source_file [llength $src_list]
 # Ensure there are more lines in the window than in the source file.
-set src_window_lines [expr $max_line_nr_in_source_file + 2]
+set src_window_lines [expr {$max_line_nr_in_source_file + 2}]
 # Account for border size.
-set src_window_size [expr $src_window_lines + 2]
+set src_window_size [expr {$src_window_lines + 2}]
 Term::command "wh src $src_window_size"
 
 set re_left_margin "___4_"
@@ -65,6 +65,6 @@ set re_left_margin "___4_"
 Term::check_contents "compact source format" \
     "$re_border$re_left_margin$re_line_four *$re_border"
 
-set re_left_margin "___0*[expr $max_line_nr_in_source_file + 1]_"
+set re_left_margin "___0*[expr {$max_line_nr_in_source_file + 1}]_"
 Term::check_contents_not "no surplus line number" \
     "$re_border$re_left_margin *$re_border"
index 33710ff5e8c5199634368f033abf98c2e39ae63f..c6dad300d34e2ddc16b2f172bc6694a4befebddd 100644 (file)
@@ -65,7 +65,7 @@ set layouts {
 proc check_boxes {boxes} {
     set boxno 1
     foreach box $boxes {
-       eval Term::check_box [list "box $boxno"] $box
+       Term::check_box [list "box $boxno"] {*}$box
        incr boxno
     }
 }
index ece164a0ea7db30b846c45d699e4735b3fd418f5..11521b03ca3e00944abbe2f2b11628e7494407ef 100644 (file)
@@ -81,7 +81,7 @@ set layouts \
 proc check_boxes {boxes} {
     set boxno 1
     foreach box $boxes {
-       eval Term::check_box [list "box $boxno"] $box
+       Term::check_box [list "box $boxno"] {*}$box
        incr boxno
     }
 }
index 41bf1214b783d06b5cb83e4e18c2314eca991e1c..4fcdca3d0caabe862b1d6aba6be4023bea60a058 100644 (file)
@@ -30,7 +30,7 @@ if {![Term::enter_tui]} {
 }
 
 proc check_src_window { testname first_line } {
-    set last_line [expr $first_line + 12]
+    set last_line [expr {$first_line + 12}]
     Term::check_box_contents $testname 0 0 80 15 \
        "^\\s+${first_line}\\s+.*\\s+${last_line}\\s+/\\* Line ${last_line}  \\*/\\s+$"
 
index aa2b1c6ea909a0ed33224e217166a7d5310f56ed..a1ba706654a040d3edb95ed84c060656611e6a3d 100644 (file)
@@ -37,11 +37,11 @@ proc fill_line { width } {
 
     # Take into account that the prompt also takes space.
     set prefix [string length "(gdb) "]
-    set start [expr $prefix + 1]
+    set start [expr {$prefix + 1}]
 
     # Print chars.
     for { set i $start } { $i <= $width } { incr i } {
-       set c [expr $i % 10]
+       set c [expr {$i % 10}]
        send_gdb $c
        append res $c
     }
@@ -59,7 +59,7 @@ proc test_wrap { wrap_width tui } {
     set str [fill_line $wrap_width]
 
     # Remaining space on line.
-    set space [string repeat " " [expr $::cols - $wrap_width]]
+    set space [string repeat " " [expr {$::cols - $wrap_width}]]
 
     # Now print the first char we expect to wrap.
     send_gdb "W"