public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-3387] testsuite: Default make check-g++ vs. tests for newest C++ standard
@ 2022-10-19 17:09 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2022-10-19 17:09 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:79d38dd46e6b07e5a90ab25df1438eb0918eb475

commit r13-3387-g79d38dd46e6b07e5a90ab25df1438eb0918eb475
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Oct 19 18:55:46 2022 +0200

    testsuite: Default make check-g++ vs. tests for newest C++ standard
    
    When adding tests for upcoming C++ version, one always has a dilemma
    whether to use explicit // { dg-options "-std=c++2b" }
    or -std=gnu++2b and similar, then the test works in all modes, but it might
    be forgotten later on to be converted into // { dg-do whatever { target c++23 } }
    test so that when 23 is tested by default and say 26 or 29 appears too,
    we test it also in those modes, or just go with
    // { dg-do whatever { target c++23 } }
    which has the disadvantage that it is skipped when testing by default and
    one only tests it if he asks for the newer version.
    
    The following patch changes it, such that it is safe to add
    // { dg-do whatever { target c++23 } }
    style tests and make those tested even in the default testing mode
    (when GXX_TESTSUITE_STDS or check-c++-all etc. aren't used).
    This is by searching for such dg-do lines and if there is an effective
    target newer than the latest by default tested language version, it will
    just use that language version instead of the default list.
    Without this change, the test would be UNSUPPORTED in currently
    all of 98 14 17 20 versions, with the patch it will be tested with a single
    23 version.
    
    2022-10-19  Jakub Jelinek  <jakub@redhat.com>
    
            * lib/g++-dg.exp (g++-dg-runtest): When using defaulted
            std_list, if test has { dg-do * { target c++23 } } directive,
            use { 23 } with which the test will run instead of { 98 14 17 20 }
            which would make it UNSUPPORTED in all cases.

Diff:
---
 gcc/testsuite/lib/g++-dg.exp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/lib/g++-dg.exp b/gcc/testsuite/lib/g++-dg.exp
index 59e8081a29d..9bf63a1392a 100644
--- a/gcc/testsuite/lib/g++-dg.exp
+++ b/gcc/testsuite/lib/g++-dg.exp
@@ -53,7 +53,16 @@ proc g++-dg-runtest { testcases flags default-extra-flags } {
 	    if { [llength $gpp_std_list] > 0 } {
 		set std_list $gpp_std_list
 	    } else {
-		set std_list { 98 14 17 20 }
+		# If the test requires a newer C++ version than which
+		# is tested by default, use that C++ version for that
+		# single test.  This should be updated or commented
+		# out whenever the default std_list is updated or newer
+		# C++ effective target is added.
+		if [search_for $test "{ dg-do * { target c++23 } }"] {
+		    set std_list { 23 }
+		} else {
+		    set std_list { 98 14 17 20 }
+		}
 	    }
 	    set option_list { }
 	    foreach x $std_list {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-19 17:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-19 17:09 [gcc r13-3387] testsuite: Default make check-g++ vs. tests for newest C++ standard Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).