[gdb/testsuite] Rewrite strings in gdb.ada/unchecked_union.exp
In test-case gdb.ada/unchecked_union.exp, git --check reports some whitespace
issues:
...
$ git diff-tree --check $(git hash-object -t tree /dev/null) HEAD \
-- gdb/testsuite/gdb.ada/unchecked_union.exp \
| grep -c "indent with spaces"
12
...
The problem is that this style of string is used containing space-indented
text:
...
set inner_string { case ? is
when 0 =>
small: range 0 .. 255;
second: range 0 .. 255;
when ? =>
bval: range 0 .. 255;
when others =>
large: range 255 .. 510;
more: range 255 .. 510;
end case;
}
...
Fix this by changing the string into a list of strings:
...
set inner_string \
[list \
" case ? is" \
" when 0 =>" \
" small: range 0 .. 255;" \
" second: range 0 .. 255;" \
" when ? =>" \
" bval: range 0 .. 255;" \
" when others =>" \
" large: range 255 .. 510;" \
" more: range 255 .. 510;" \
" end case;"]
...
which also fixes the odd position of the first line in the original version.
Tested on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
PR build/33616
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33616
diff --git a/gdb/testsuite/gdb.ada/unchecked_union.exp b/gdb/testsuite/gdb.ada/unchecked_union.exp
index d6dd0f5..52162e7 100644
--- a/gdb/testsuite/gdb.ada/unchecked_union.exp
+++ b/gdb/testsuite/gdb.ada/unchecked_union.exp
@@ -23,33 +23,48 @@
proc multi_line_string {str} {
set result {}
- foreach line [split $str \n] {
+ foreach line $str {
lappend result [string_to_regexp $line]
}
- return [multi_line {*}$result]
+ set res [multi_line {*}$result]
+ verbose -log "RES: '$res'"
+ return $res
}
-set inner_string { case ? is
- when 0 =>
- small: range 0 .. 255;
- second: range 0 .. 255;
- when ? =>
- bval: range 0 .. 255;
- when others =>
- large: range 255 .. 510;
- more: range 255 .. 510;
- end case;
-}
-set inner_full "type = record (?) is\n${inner_string}end record"
+set inner_string \
+ [list \
+ " case ? is" \
+ " when 0 =>" \
+ " small: range 0 .. 255;" \
+ " second: range 0 .. 255;" \
+ " when ? =>" \
+ " bval: range 0 .. 255;" \
+ " when others =>" \
+ " large: range 255 .. 510;" \
+ " more: range 255 .. 510;" \
+ " end case;"]
-set pair_string { case ? is
- when ? =>
- field_one: range 0 .. 255;
- when ? =>
- field_two: range 255 .. 510;
- end case;
-}
-set pair_full "type = record\n${inner_string}${pair_string}end record"
+set inner_full \
+ [concat \
+ [list "type = record (?) is"] \
+ $inner_string \
+ [list "end record"]]
+
+set pair_string \
+ [list \
+ " case ? is" \
+ " when ? =>" \
+ " field_one: range 0 .. 255;" \
+ " when ? =>" \
+ " field_two: range 255 .. 510;" \
+ " end case;"]
+
+set pair_full \
+ [concat \
+ [list "type = record"] \
+ $inner_string \
+ $pair_string \
+ [list "end record"]]
foreach_gnat_encoding scenario flags {none all minimal} {
lappend flags debug