standard_ada_testfile p
-set old_gcc [expr [test_compiler_info {gcc-[0-7]-*}]]
+set old_gcc [gnat_version_compare <= 7]
proc gdb_test_with_xfail { cmd re re_xfail msg } {
global scenario old_gcc
return -1
}
-set old_gcc [expr [test_compiler_info {gcc-[0-3]-*}] \
- || [test_compiler_info {gcc-4-[0-6]-*}]]
+set old_gcc [gnat_version_compare <= {4 6}]
clean_restart ${testfile}
# GNAT >= 12.0 has the needed fix here.
set xfail_expected 0
- if {$scenario == "minimal" && ![test_compiler_info {gcc-1[2-9]-*}]} {
+ if {$scenario == "minimal" && [gnat_version_compare < 12]} {
set xfail_expected 1
}
standard_ada_testfile foo_ra24_010
-set old_gcc [expr [test_compiler_info {gcc-[0-8]-*}]]
+set old_gcc [gnat_version_compare < 9]
foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
clean_restart ${testfile}-${scenario}
# GNAT 9 and 10 are known to fail.
- if {$scenario == "minimal" && ([test_compiler_info {gcc-9-*}] \
- || [test_compiler_info {gcc-10-*}])} {
+ if {$scenario == "minimal"
+ && [gnat_version_compare >= 9]
+ && [gnat_version_compare <= 10]} {
set old_compiler 1
} else {
set old_compiler 0
gdb_test "print fp4_var / 1" $fp4
# This only started working in GCC 11.
- if {$scenario == "minimal" && [test_compiler_info {gcc-11-*}]} {
+ if {$scenario == "minimal" && [gnat_version_compare >= 11]} {
gdb_test "print fp5_var" " = 3e-19"
}
# This failed before GCC 10.
- if {$scenario == "all" && [test_compiler_info {gcc-10-*}]} {
+ if {$scenario == "all" && [gnat_version_compare < 10]} {
gdb_test "p Float(Another_Fixed) = Float(Another_Delta * 5)" "true" \
"value of another_fixed"
}
pass $test
}
-wrap -re "No definition of \"fun_rename_test_n\" in current context\\." {
- if {[test_compiler_info {gcc-6*}]} {
+ if {[gnat_version_compare >= 6]} {
fail $test
} else {
xfail $test
pass $test
}
-wrap -re "No definition of \"renamed_fun_rename_test_next\" in current context\\." {
- if {[test_compiler_info {gcc-6*}]} {
+ if {[gnat_version_compare >= 6]} {
fail $test
} else {
xfail $test
pass $test
}
-wrap -re "No definition of \"pack\\.renamed_fun_rename_test_next\" in current context\\." {
- if {[test_compiler_info {gcc-6*}]} {
+ if {[gnat_version_compare >= 6]} {
fail $test
} else {
xfail $test
}
}
-wrap -re "Type <data variable, no debug info> is not a structure or union type\\." {
- if {[test_compiler_info {gcc-6*}]} {
+ if {[gnat_version_compare >= 6]} {
fail $test
} else {
xfail $test
}
# GNAT 9 and 10 are known to fail.
- if {$scenario == "minimal" && ([test_compiler_info {gcc-9-*}] \
- || [test_compiler_info {gcc-10-*}])} {
+ if {$scenario == "minimal"
+ && [gnat_version_compare >= 9]
+ && [gnat_version_compare <= 10]} {
setup_kfail "minimal encodings" *-*-*
}
gdb_test "print xp" \
set bp_location [gdb_get_line_number "START" ${testdir}/foo.adb]
runto "foo.adb:$bp_location"
-if {[test_compiler_info {gcc-[0-3]-*}]
- || [test_compiler_info {gcc-4-[0-4]-*}]} {
+if {[gnat_version_compare <= 4.4]} {
# Ada array bounds are missing in older GCCs.
setup_xfail *-*-*
}
"packed_array_assign_y => 1\\)\\)"]
# GNAT >= 12.0 has the needed fix here.
-set zeros_expected [expr {![test_compiler_info {gcc-1[2-9]-*}]}]
+set zeros_expected [gnat_version_compare >= 12]
set all_zeros \
[string_to_regexp "((packed_array_assign_w => 0, packed_array_assign_x => 0, packed_array_assign_y => 0), (packed_array_assign_w => 0, packed_array_assign_x => 0, packed_array_assign_y => 0), (packed_array_assign_w => 0, packed_array_assign_x => 0, packed_array_assign_y => 0))"]
}
-re " = .*more than max-value-size.*\[\r\n\]+$gdb_prompt $" {
# GNAT >= 12.0 has the needed fix here.
- if {$scenario == "minimal" && ![test_compiler_info {gcc-1[2-9]-*}]} {
+ if {$scenario == "minimal" && [gnat_version_compare >= 12]} {
setup_kfail "minimal encodings" *-*-*
}
fail $test
runto "foo.adb:$bp_location"
# GNAT 9 and 10 are known to fail.
- if {$scenario == "minimal" && ([test_compiler_info {gcc-9-*}] \
- || [test_compiler_info {gcc-10-*}])} {
+ if {$scenario == "minimal"
+ && [gnat_version_compare >= 9]
+ && [gnat_version_compare <= 10]} {
setup_kfail "minimal encodings" *-*-*
}
gdb_test "print A2" \
}
-re " = \\(size => 8, length => 8, buffer => warning: could not find bounds information on packed array.*$gdb_prompt $" {
# GNAT >= 11.0 has the needed fix here.
- if {$scenario == "minimal" && ![test_compiler_info {gcc-1[1-9]-*}]} {
+ if {$scenario == "minimal" && [gnat_version_compare >= 11]} {
setup_kfail "minimal encodings" *-*-*
}
fail $test
}
-re " = \\(size => 8, length => 8, buffer => warning: could not find bounds information on packed array.*$gdb_prompt $" {
# GNAT >= 11.0 has the needed fix here.
- if {$scenario == "minimal" && ![test_compiler_info {gcc-1[1-9]-*}]} {
+ if {$scenario == "minimal" && [gnat_version_compare >= 11]} {
setup_kfail "minimal encodings" *-*-*
}
fail $test
return 1
}
+# Compare the GNAT version against L2 using version_compare. If the
+# compiler does not appear to be GCC, this will always return false.
+
+proc gnat_version_compare {op l2} {
+ set gccvers [gcc_major_version]
+ if {$gccvers == -1} {
+ return 0
+ }
+
+ return [version_compare [split $gccvers .] $op $l2]
+}
+
# Return 1 if the GNAT runtime appears to have debug info.
proc gnat_runtime_has_debug_info_1 { shared } {
}
# Compare the version numbers in L1 to those in L2 using OP, and
-# return 1 if the comparison is true. OP can be "<", "<=", or "==".
-# It is ok if the lengths of the lists differ.
+# return 1 if the comparison is true. OP can be "<", "<=", ">", ">=",
+# or "==". It is ok if the lengths of the lists differ.
proc version_compare { l1 op l2 } {
switch -exact $op {
"==" -
"<=" -
"<" {}
+
+ ">=" {
+ # a >= b => b <= a
+ set x $l2
+ set l2 $l1
+ set l1 $x
+ set op "<="
+ }
+
+ ">" {
+ # a > b => b < a
+ set x $l2
+ set l2 $l1
+ set l1 $x
+ set op "<"
+ }
+
default { error "unsupported op: $op" }
}