diff options
author | Tom Tromey <tromey@adacore.com> | 2024-05-08 13:46:53 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2024-09-06 10:22:13 -0600 |
commit | a63b3b2f74e95380a718f9342ee42274dd877a3b (patch) | |
tree | 3a69eb89b4ffb2534e8b40112264cb86a3432363 | |
parent | f83ca9c7cca4ab7a2d7352104a37932474320410 (diff) | |
download | gdb-a63b3b2f74e95380a718f9342ee42274dd877a3b.zip gdb-a63b3b2f74e95380a718f9342ee42274dd877a3b.tar.gz gdb-a63b3b2f74e95380a718f9342ee42274dd877a3b.tar.bz2 |
Introduce and use foreach_gnat_encoding
gnat-llvm does not support the -fgnat-encodings flag. This patch
prepares gdb's Ada tests to handle this situation by introducing a new
foreach_gnat_encoding. A subsequent patch may change this to support
gnat-llvm; meanwhile this is a little cleaner anyway.
37 files changed, 93 insertions, 97 deletions
diff --git a/gdb/testsuite/gdb.ada/O2_float_param.exp b/gdb/testsuite/gdb.ada/O2_float_param.exp index d44f2e5..86b67ff 100644 --- a/gdb/testsuite/gdb.ada/O2_float_param.exp +++ b/gdb/testsuite/gdb.ada/O2_float_param.exp @@ -26,10 +26,8 @@ if {[is_aarch64_target]} { } } -foreach_with_prefix scenario {all minimal} { - set flags [list debug \ - optimize=-O2 \ - additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug optimize=-O2 if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/access_to_unbounded_array.exp b/gdb/testsuite/gdb.ada/access_to_unbounded_array.exp index 7f7bfb3..eeaceb0 100644 --- a/gdb/testsuite/gdb.ada/access_to_unbounded_array.exp +++ b/gdb/testsuite/gdb.ada/access_to_unbounded_array.exp @@ -19,8 +19,8 @@ require allow_ada_tests standard_ada_testfile foo -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap.exp b/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap.exp index 569bb2e..4ecb4f8 100644 --- a/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap.exp +++ b/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap.exp @@ -19,8 +19,8 @@ require allow_ada_tests standard_ada_testfile enum_with_gap_main -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" \ executable $flags] != ""} { diff --git a/gdb/testsuite/gdb.ada/arr_enum_idx_w_gap.exp b/gdb/testsuite/gdb.ada/arr_enum_idx_w_gap.exp index 5a88f5f..491402b 100644 --- a/gdb/testsuite/gdb.ada/arr_enum_idx_w_gap.exp +++ b/gdb/testsuite/gdb.ada/arr_enum_idx_w_gap.exp @@ -19,8 +19,8 @@ require allow_ada_tests standard_ada_testfile foo_q418_043 -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/array_of_symbolic_length.exp b/gdb/testsuite/gdb.ada/array_of_symbolic_length.exp index bcf7369..134b448 100644 --- a/gdb/testsuite/gdb.ada/array_of_symbolic_length.exp +++ b/gdb/testsuite/gdb.ada/array_of_symbolic_length.exp @@ -19,8 +19,8 @@ require allow_ada_tests standard_ada_testfile foo -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/array_of_variable_length.exp b/gdb/testsuite/gdb.ada/array_of_variable_length.exp index 3397760..3c68c80 100644 --- a/gdb/testsuite/gdb.ada/array_of_variable_length.exp +++ b/gdb/testsuite/gdb.ada/array_of_variable_length.exp @@ -19,8 +19,8 @@ require allow_ada_tests standard_ada_testfile foo -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/array_of_variant.exp b/gdb/testsuite/gdb.ada/array_of_variant.exp index 1a155d4..f93260a 100644 --- a/gdb/testsuite/gdb.ada/array_of_variant.exp +++ b/gdb/testsuite/gdb.ada/array_of_variant.exp @@ -40,8 +40,8 @@ proc gdb_test_with_xfail { cmd re re_xfail msg } { } } -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/array_ptr_renaming.exp b/gdb/testsuite/gdb.ada/array_ptr_renaming.exp index b013fc7..eadfcb6 100644 --- a/gdb/testsuite/gdb.ada/array_ptr_renaming.exp +++ b/gdb/testsuite/gdb.ada/array_ptr_renaming.exp @@ -19,8 +19,8 @@ require allow_ada_tests standard_ada_testfile foo -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/arrayparam.exp b/gdb/testsuite/gdb.ada/arrayparam.exp index 2921d64..ef00037 100644 --- a/gdb/testsuite/gdb.ada/arrayparam.exp +++ b/gdb/testsuite/gdb.ada/arrayparam.exp @@ -22,8 +22,8 @@ standard_ada_testfile foo # Note we don't test the "none" (no -fgnat-encodings option) scenario # here, because "all" and "minimal" cover the cases, and this way we # don't have to update the test when gnat changes its default. -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/arrayptr.exp b/gdb/testsuite/gdb.ada/arrayptr.exp index ca48993..335573b 100644 --- a/gdb/testsuite/gdb.ada/arrayptr.exp +++ b/gdb/testsuite/gdb.ada/arrayptr.exp @@ -19,8 +19,8 @@ require allow_ada_tests standard_ada_testfile foo -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/big_packed_array.exp b/gdb/testsuite/gdb.ada/big_packed_array.exp index 1ba2c48..0078c77 100644 --- a/gdb/testsuite/gdb.ada/big_packed_array.exp +++ b/gdb/testsuite/gdb.ada/big_packed_array.exp @@ -21,8 +21,8 @@ standard_ada_testfile foo_ra24_010 set old_gcc [expr [test_compiler_info {gcc-[0-8]-*}]] -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/enum_idx_packed.exp b/gdb/testsuite/gdb.ada/enum_idx_packed.exp index 1976092..d56d73b 100644 --- a/gdb/testsuite/gdb.ada/enum_idx_packed.exp +++ b/gdb/testsuite/gdb.ada/enum_idx_packed.exp @@ -19,8 +19,8 @@ require allow_ada_tests standard_ada_testfile foo -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/fixed_cmp.exp b/gdb/testsuite/gdb.ada/fixed_cmp.exp index de506fd..dcd4745 100644 --- a/gdb/testsuite/gdb.ada/fixed_cmp.exp +++ b/gdb/testsuite/gdb.ada/fixed_cmp.exp @@ -19,8 +19,8 @@ require allow_ada_tests standard_ada_testfile fixed -foreach_with_prefix gnat_encodings {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$gnat_encodings] +foreach_gnat_encoding gnat_encodings flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${gnat_encodings}" executable $flags] != "" } { return -1 diff --git a/gdb/testsuite/gdb.ada/fixed_points.exp b/gdb/testsuite/gdb.ada/fixed_points.exp index 4665595..ceed34a 100644 --- a/gdb/testsuite/gdb.ada/fixed_points.exp +++ b/gdb/testsuite/gdb.ada/fixed_points.exp @@ -19,8 +19,8 @@ require allow_ada_tests standard_ada_testfile fixed_points -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 } diff --git a/gdb/testsuite/gdb.ada/frame_arg_lang.exp b/gdb/testsuite/gdb.ada/frame_arg_lang.exp index 918a922..b629c42 100644 --- a/gdb/testsuite/gdb.ada/frame_arg_lang.exp +++ b/gdb/testsuite/gdb.ada/frame_arg_lang.exp @@ -27,11 +27,10 @@ gdb_compile "${csrcfile}" "${cobject}" object [list debug] # Note we don't test the "none" (no -fgnat-encodings option) scenario # here, because "all" and "minimal" cover the cases, and this way we # don't have to update the test when gnat changes its default. -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-largs \ - additional_flags=${cobject} \ - additional_flags=-margs \ - additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug additional_flags=-largs \ + additional_flags=${cobject} \ + additional_flags=-margs if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/funcall_ref.exp b/gdb/testsuite/gdb.ada/funcall_ref.exp index 518ceb7..1c28392 100644 --- a/gdb/testsuite/gdb.ada/funcall_ref.exp +++ b/gdb/testsuite/gdb.ada/funcall_ref.exp @@ -22,8 +22,8 @@ standard_ada_testfile foo # Note we don't test the "none" (no -fgnat-encodings option) scenario # here, because "all" and "minimal" cover the cases, and this way we # don't have to update the test when gnat changes its default. -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/mi_string_access.exp b/gdb/testsuite/gdb.ada/mi_string_access.exp index 15b8cf1..8fd116b 100644 --- a/gdb/testsuite/gdb.ada/mi_string_access.exp +++ b/gdb/testsuite/gdb.ada/mi_string_access.exp @@ -22,8 +22,8 @@ standard_ada_testfile bar load_lib mi-support.exp set MIFLAGS "-i=mi" -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/mi_var_array.exp b/gdb/testsuite/gdb.ada/mi_var_array.exp index 2b50481..dd770a1 100644 --- a/gdb/testsuite/gdb.ada/mi_var_array.exp +++ b/gdb/testsuite/gdb.ada/mi_var_array.exp @@ -22,11 +22,8 @@ standard_ada_testfile bar load_lib mi-support.exp set MIFLAGS "-i=mi" -foreach_with_prefix scenario {none all minimal} { - set flags {debug} - if {$scenario != "none"} { - lappend flags additional_flags=-fgnat-encodings=$scenario - } +foreach_gnat_encoding scenario flags {none all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != "" } { return -1 diff --git a/gdb/testsuite/gdb.ada/mi_var_union.exp b/gdb/testsuite/gdb.ada/mi_var_union.exp index eb23c0a..64bfe33 100644 --- a/gdb/testsuite/gdb.ada/mi_var_union.exp +++ b/gdb/testsuite/gdb.ada/mi_var_union.exp @@ -24,11 +24,8 @@ set MIFLAGS "-i=mi" set float "\\-?((\[0-9\]+(\\.\[0-9\]+)?(e\[-+\]\[0-9\]+)?)|(nan\\($hex\\)))" -foreach_with_prefix scenario {none all minimal} { - set flags {debug} - if {$scenario != "none"} { - lappend flags additional_flags=-fgnat-encodings=$scenario - } +foreach_gnat_encoding scenario flags {none all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != "" } { return -1 diff --git a/gdb/testsuite/gdb.ada/mi_variant.exp b/gdb/testsuite/gdb.ada/mi_variant.exp index 7f10b3c..f4be5a0 100644 --- a/gdb/testsuite/gdb.ada/mi_variant.exp +++ b/gdb/testsuite/gdb.ada/mi_variant.exp @@ -23,11 +23,8 @@ standard_ada_testfile pkg load_lib mi-support.exp set MIFLAGS "-i=mi" -foreach_with_prefix scenario {none all minimal} { - set flags {debug} - if {$scenario != "none"} { - lappend flags additional_flags=-fgnat-encodings=$scenario - } +foreach_gnat_encoding scenario flags {none all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/mod_from_name.exp b/gdb/testsuite/gdb.ada/mod_from_name.exp index c6acc80..33bd854 100644 --- a/gdb/testsuite/gdb.ada/mod_from_name.exp +++ b/gdb/testsuite/gdb.ada/mod_from_name.exp @@ -19,8 +19,8 @@ require allow_ada_tests standard_ada_testfile foo -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/multiarray.exp b/gdb/testsuite/gdb.ada/multiarray.exp index 9be0aaa..91ba1ec 100644 --- a/gdb/testsuite/gdb.ada/multiarray.exp +++ b/gdb/testsuite/gdb.ada/multiarray.exp @@ -19,8 +19,8 @@ require allow_ada_tests standard_ada_testfile p -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" \ executable $flags] != ""} { diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp index eaa88a3..2adef97 100644 --- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp +++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp @@ -19,10 +19,8 @@ require allow_ada_tests standard_ada_testfile foo_o224_021 -foreach_with_prefix scenario {all minimal} { - set flags [list debug \ - optimize=-O2 \ - additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug optimize=-O2 if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/packed_array.exp b/gdb/testsuite/gdb.ada/packed_array.exp index a3d7136..85bc59d 100644 --- a/gdb/testsuite/gdb.ada/packed_array.exp +++ b/gdb/testsuite/gdb.ada/packed_array.exp @@ -19,8 +19,8 @@ require allow_ada_tests standard_ada_testfile pa -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/packed_record.exp b/gdb/testsuite/gdb.ada/packed_record.exp index fa058f7..bbba9b2 100644 --- a/gdb/testsuite/gdb.ada/packed_record.exp +++ b/gdb/testsuite/gdb.ada/packed_record.exp @@ -19,8 +19,8 @@ require allow_ada_tests standard_ada_testfile pr -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/packed_tagged.exp b/gdb/testsuite/gdb.ada/packed_tagged.exp index faccc14..1c9e5a0 100644 --- a/gdb/testsuite/gdb.ada/packed_tagged.exp +++ b/gdb/testsuite/gdb.ada/packed_tagged.exp @@ -22,11 +22,8 @@ standard_ada_testfile comp_bug # Note we don't test the "none" (no -fgnat-encodings option) scenario # here, because "all" and "minimal" cover the cases, and this way we # don't have to update the test when gnat changes its default. -foreach_with_prefix scenario {all minimal} { - set flags {debug} - if {$scenario != "none"} { - lappend flags additional_flags=-fgnat-encodings=$scenario - } +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/pckd_arr_ren.exp b/gdb/testsuite/gdb.ada/pckd_arr_ren.exp index 083ee13..18bb84f 100644 --- a/gdb/testsuite/gdb.ada/pckd_arr_ren.exp +++ b/gdb/testsuite/gdb.ada/pckd_arr_ren.exp @@ -19,8 +19,8 @@ require allow_ada_tests standard_ada_testfile foo -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/ptype-o.exp b/gdb/testsuite/gdb.ada/ptype-o.exp index f778219..5038ee1 100644 --- a/gdb/testsuite/gdb.ada/ptype-o.exp +++ b/gdb/testsuite/gdb.ada/ptype-o.exp @@ -21,8 +21,8 @@ require allow_ada_tests standard_ada_testfile prog -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/rec_ptype.exp b/gdb/testsuite/gdb.ada/rec_ptype.exp index f75d09b..fc7bb8b 100644 --- a/gdb/testsuite/gdb.ada/rec_ptype.exp +++ b/gdb/testsuite/gdb.ada/rec_ptype.exp @@ -22,8 +22,8 @@ standard_ada_testfile main # Note we don't test the "none" (no -fgnat-encodings option) scenario # here, because "all" and "minimal" cover the cases, and this way we # don't have to update the test when gnat changes its default. -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/same_component_name.exp b/gdb/testsuite/gdb.ada/same_component_name.exp index 7167a41..84a48b4 100644 --- a/gdb/testsuite/gdb.ada/same_component_name.exp +++ b/gdb/testsuite/gdb.ada/same_component_name.exp @@ -19,8 +19,8 @@ require allow_ada_tests standard_ada_testfile foo -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != "" } { return -1 diff --git a/gdb/testsuite/gdb.ada/set_pckd_arr_elt.exp b/gdb/testsuite/gdb.ada/set_pckd_arr_elt.exp index d77f8fe..2979cb9 100644 --- a/gdb/testsuite/gdb.ada/set_pckd_arr_elt.exp +++ b/gdb/testsuite/gdb.ada/set_pckd_arr_elt.exp @@ -19,8 +19,8 @@ require allow_ada_tests standard_ada_testfile foo -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp b/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp index 6b2a6fd..2bcc027 100644 --- a/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp +++ b/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp @@ -19,8 +19,8 @@ require allow_ada_tests standard_ada_testfile foo -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/unchecked_union.exp b/gdb/testsuite/gdb.ada/unchecked_union.exp index bff71bd..5d3256b 100644 --- a/gdb/testsuite/gdb.ada/unchecked_union.exp +++ b/gdb/testsuite/gdb.ada/unchecked_union.exp @@ -51,11 +51,8 @@ set pair_string { case ? is } set pair_full "type = record\n${inner_string}${pair_string}end record" -foreach_with_prefix scenario {none all minimal} { - set flags {debug} - if {$scenario != "none"} { - lappend flags additional_flags=-fgnat-encodings=$scenario - } +foreach_gnat_encoding scenario flags {none all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/var_rec_arr.exp b/gdb/testsuite/gdb.ada/var_rec_arr.exp index a859108..20598ea 100644 --- a/gdb/testsuite/gdb.ada/var_rec_arr.exp +++ b/gdb/testsuite/gdb.ada/var_rec_arr.exp @@ -22,8 +22,8 @@ standard_ada_testfile foo_na09_042 # Note we don't test the "none" (no -fgnat-encodings option) scenario # here, because "all" and "minimal" cover the cases, and this way we # don't have to update the test when gnat changes its default. -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/variant.exp b/gdb/testsuite/gdb.ada/variant.exp index 9fbc449..227331c 100644 --- a/gdb/testsuite/gdb.ada/variant.exp +++ b/gdb/testsuite/gdb.ada/variant.exp @@ -20,11 +20,8 @@ require allow_ada_tests standard_ada_testfile pkg -foreach_with_prefix scenario {none all minimal} { - set flags {debug} - if {$scenario != "none"} { - lappend flags additional_flags=-fgnat-encodings=$scenario - } +foreach_gnat_encoding scenario flags {none all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/gdb.ada/variant_record_packed_array.exp b/gdb/testsuite/gdb.ada/variant_record_packed_array.exp index f6b4e41..8f4192c 100644 --- a/gdb/testsuite/gdb.ada/variant_record_packed_array.exp +++ b/gdb/testsuite/gdb.ada/variant_record_packed_array.exp @@ -19,8 +19,8 @@ require allow_ada_tests standard_ada_testfile foo -foreach_with_prefix scenario {all minimal} { - set flags [list debug additional_flags=-fgnat-encodings=$scenario] +foreach_gnat_encoding scenario flags {all minimal} { + lappend flags debug if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} { return -1 diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp index 1bc0dc1..0544544 100644 --- a/gdb/testsuite/lib/ada.exp +++ b/gdb/testsuite/lib/ada.exp @@ -13,6 +13,25 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +# A wrapper for foreach_with_prefix that applies suitable +# -fgnat-encodings arguments to a command line. SCENARIO_ARG is the +# name of a loop variable that will hold the scenario currently being +# evaluated. FLAGS_ARG will be set to the appropriate compiler flags +# (if any) for this scenario. LIST is the list of desired scenarios +# to run, and BODY is what actually does the work. + +proc foreach_gnat_encoding {scenario_arg flags_arg list body} { + upvar 1 $scenario_arg scenario + upvar 1 $flags_arg flags + foreach_with_prefix scenario $list { + set flags {} + if {$scenario != "none"} { + lappend flags additional_flags=-fgnat-encodings=$scenario + } + uplevel 1 $body + } +} + # Call target_compile with SOURCE DEST TYPE and OPTIONS as argument, # after having temporarily changed the current working directory to # BUILDDIR. |