https://gcc.gnu.org/g:39edc2aea24f9ac98c701803c9f2df881c715cc2
commit r16-7593-g39edc2aea24f9ac98c701803c9f2df881c715cc2 Author: Jonathan Wakely <[email protected]> Date: Tue Feb 17 12:48:51 2026 +0000 libstdc++: Use global variables for default/max std in libstdc++.exp This simplifies the v3-minimum-std procedure slightly, but the main advantage is making v3_modules_std depend on v3_max_std so that we don't have to update two separate variables when new effective targets such as c++29 get added. libstdc++-v3/ChangeLog: * testsuite/lib/libstdc++.exp (v3_default_std, v3_max_std): New global variables. (v3-minimum-std): Use globals instead of arguments. (v3_modules_std): Define in terms of $v3_max_std. (v3-dg-runtest): Use globals instead of local variables. Adjust call to v3-min-std. Reviewed-by: Tomasz KamiĆski <[email protected]> Diff: --- libstdc++-v3/testsuite/lib/libstdc++.exp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index 5b50972511f3..d2d61a9bed9c 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -473,9 +473,16 @@ if { [info procs saved-dg-test] == [list] } { } } +# These should be adjusted whenever the compiler's default -std is updated +# or a newer C++ effective target is added. +set v3_default_std 20 +set v3_max_std 26 + # Find the minimum standard required by a test, if higher than the default_std. proc v3-minimum-std { test default_std max_std } { - for {set s $default_std} {$s <= $max_std} {incr s 3} { + global v3_default_std + global v3_max_std + for {set s $default_std} {$s <= $v3_max_std} {incr s 3} { if [search_for $test "\{ dg-do * \{ target c++$s"] { return $s } elseif [search_for $test "\{ dg-require-effective-target c++$s"] { @@ -496,13 +503,15 @@ if [info exists env(GLIBCXX_TESTSUITE_STDS)] { # Allow adjusting which -std we test with -fmodules. if ![info exists v3_modules_std] { - set v3_modules_std "26" + set v3_modules_std "$v3_max_std" } # Modified dg-runtest that runs tests in multiple standard modes, # unless they specifically specify one standard. proc v3-dg-runtest { testcases flags default-extra-flags } { global runtests + global v3_default_std + global v3_max_std global v3_modules_std foreach test $testcases { @@ -529,22 +538,18 @@ proc v3-dg-runtest { testcases flags default-extra-flags } { # If the test requires a newer C++ version than which # is tested by default, use that C++ version for that # single test. - # These should be adjusted whenever the default -std is - # updated or newer C++ effective target is added. - set default_std 20 - set max_std 26 - set min_std [v3-minimum-std $test $default_std $max_std] - if { $min_std > $default_std } { + set min_std [v3-minimum-std $test] + if { $min_std > $v3_default_std } { set std_list $min_std - if { $min_std != $max_std } { + if { $min_std != $v3_max_std } { # Also test the latest version. - lappend std_list "$max_std" + lappend std_list "$v3_max_std" } } else { # Only run each test once with the default -std option. # This avoids increasing the run time for most testers. # Libstdc++ developers can override this with v3_std_list. - set std_list $default_std + set std_list $v3_default_std } } set option_list { }
