On 12/15/21 09:09, Jakub Jelinek wrote:
On Wed, Dec 15, 2021 at 08:58:45AM -0500, Patrick Palka wrote:
Oops, thanks Jakub, I didn't realize we don't run the testsuite with
-std=c++23 yet.

I guess it'd be too expensive to add another std to the testing matrix
at this point, but I wonder if the test harness should at least run the
testcases inside cpp23/ with -std=c++23?  Something like the following
seems to work.

(And since -std=c++11 also isn't part of the default testing matrix
anymore, perhaps we could give the testscases inside cpp0x/ a similar
treatment too?)

I think up to Jason, but I'd say if we do it, we should do it for all those
language version subdirectories and make sure we only add those extra modes
temporarily (for that subdir files only) and only if they aren't already
present in the list we cycle through (to avoid running it e.g. with
-std=c++23 twice).

Sounds good.

Note that there's also the 'check-c++-all' make target to run the full set of standards.

Subject: [PATCH] testsuite: run testcases in g++.dg/cpp23/ with -std=c++23

gcc/testsuite/ChangeLog:

        * lib/g++-dg.exp (g++-dg-runtest): Add -std=c++23 to option_list
        for testcases in cpp23/.
---
  gcc/testsuite/lib/g++-dg.exp | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/lib/g++-dg.exp b/gcc/testsuite/lib/g++-dg.exp
index fd06d278faa..79fe3db014e 100644
--- a/gcc/testsuite/lib/g++-dg.exp
+++ b/gcc/testsuite/lib/g++-dg.exp
@@ -38,6 +38,8 @@ proc g++-dg-runtest { testcases flags default-extra-flags } {
            continue
        }
+ set nshort [file tail [file dirname $test]]/[file tail $test]
+
        # If the testcase specifies a standard, use that one.
        # If not, run it under both standards, allowing GNU extensions
        # if there's a dg-options line.
@@ -61,12 +63,13 @@ proc g++-dg-runtest { testcases flags default-extra-flags } 
{
                } elseif { $x eq "impcx" } then { set x "23 
-fimplicit-constexpr" }
                lappend option_list "${std_prefix}$x"
            }
+           if [string match "cpp23/*" $nshort] {
+               lappend option_list "${std_prefix}23"
+           }
        } else {
            set option_list { "" }
        }
- set nshort [file tail [file dirname $test]]/[file tail $test]
-
        foreach flags_t $option_list {
            verbose "Testing $nshort, $flags $flags_t" 1
            dg-test $test "$flags $flags_t" ${default-extra-flags}

        Jakub


Reply via email to