Tested x86_64-pc-linux-gnu, OK for trunk?
-- 8< --
Since modules aren't enabled by default at any -std= yet, let's add a
pseudo-std for them, like we already have for -fimplicit-constexpr. And
also add to target-supports so dg lines can check { target modules }.
libstdc++-v3/ChangeLog:
* testsuite/Makefile.am (CLEANFILES): Add gcm.cache.
* testsuite/Makefile.in: Regenerate.
* testsuite/lib/dg-options.exp (add_options_for_no_pch): Also add
-fno-modules.
* testsuite/lib/libstdc++.exp: Handle "modules" std.
gcc/testsuite/ChangeLog:
* lib/g++-dg.exp: Handle "modules" std.
* lib/target-supports.exp (check_effective_target_modules): New.
---
gcc/testsuite/lib/g++-dg.exp | 1 +
gcc/testsuite/lib/target-supports.exp | 4 ++++
libstdc++-v3/testsuite/Makefile.am | 2 +-
libstdc++-v3/testsuite/Makefile.in | 2 +-
libstdc++-v3/testsuite/lib/dg-options.exp | 2 +-
libstdc++-v3/testsuite/lib/libstdc++.exp | 7 +++++++
6 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/gcc/testsuite/lib/g++-dg.exp b/gcc/testsuite/lib/g++-dg.exp
index 042a9171c75..d30e242b465 100644
--- a/gcc/testsuite/lib/g++-dg.exp
+++ b/gcc/testsuite/lib/g++-dg.exp
@@ -92,6 +92,7 @@ proc g++-std-flags { test } {
set option_list { }
foreach x $std_list {
if { $x eq "impcx" } then { set x "26 -fimplicit-constexpr" }
+ if { $x eq "modules" } then { set x "23 -fmodules
-flang-info-include-translate" }
lappend option_list "${std_prefix}$x"
}
} else {
diff --git a/gcc/testsuite/lib/target-supports.exp
b/gcc/testsuite/lib/target-supports.exp
index 67f1a3c8230..a26938a3170 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -12282,6 +12282,10 @@ proc check_effective_target_implicit_constexpr { } {
return [check-flags { "" { } { -fimplicit-constexpr } }]
}
+proc check_effective_target_modules { } {
+ return [check-flags { "" { } { -fmodules } }]
+}
+
# Return 1 if expensive testcases should be run.
proc check_effective_target_run_expensive_tests { } {
diff --git a/libstdc++-v3/testsuite/Makefile.am
b/libstdc++-v3/testsuite/Makefile.am
index bbdb72e9cf5..d7ebbc6f34c 100644
--- a/libstdc++-v3/testsuite/Makefile.am
+++ b/libstdc++-v3/testsuite/Makefile.am
@@ -247,7 +247,7 @@ check-performance-parallel: testsuite_files_performance
${performance_script}
# By adding these files here, automake will remove them for 'make clean'
CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum \
testsuite_* site.exp abi_check baseline_symbols *TEST* *.dat \
- *.ii *.s *.o *.cc *.x *.a *.so *.xml *.raw *.out *.gdb
+ *.ii *.s *.o *.cc *.x *.a *.so *.xml *.raw *.out *.gdb gcm.cache
# To remove directories.
clean-local:
diff --git a/libstdc++-v3/testsuite/Makefile.in
b/libstdc++-v3/testsuite/Makefile.in
index aeb3f716216..90741d435ba 100644
--- a/libstdc++-v3/testsuite/Makefile.in
+++ b/libstdc++-v3/testsuite/Makefile.in
@@ -435,7 +435,7 @@ parallel_flags = "unix/-D_GLIBCXX_PARALLEL/-fopenmp"
# By adding these files here, automake will remove them for 'make clean'
CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum \
testsuite_* site.exp abi_check baseline_symbols *TEST* *.dat \
- *.ii *.s *.o *.cc *.x *.a *.so *.xml *.raw *.out *.gdb
+ *.ii *.s *.o *.cc *.x *.a *.so *.xml *.raw *.out *.gdb gcm.cache
all: all-am
diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp
b/libstdc++-v3/testsuite/lib/dg-options.exp
index 937a8224756..337f3502629 100644
--- a/libstdc++-v3/testsuite/lib/dg-options.exp
+++ b/libstdc++-v3/testsuite/lib/dg-options.exp
@@ -290,7 +290,7 @@ proc add_options_for_no_pch { flags } {
# Remove any inclusion of bits/stdc++.h from the options.
regsub -all -- "-include bits/stdc...h" $flags "" flags
# This forces any generated and possibly included PCH to be invalid.
- return "$flags -D__GLIBCXX__=99999999"
+ return "$flags -fno-modules -D__GLIBCXX__=99999999"
}
# Add to FLAGS all the target-specific flags needed for networking.
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp
b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 9f2dd8a1724..15b052d941b 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -496,10 +496,16 @@ if [info exists env(GLIBCXX_TESTSUITE_STDS)] {
set v3_std_list [split $env(GLIBCXX_TESTSUITE_STDS) ","]
}
+# Allow adjusting which -std we test with -fmodules.
+if ![info exists v3_modules_std] {
+ set v3_modules_std "26"
+}
+
# 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_modules_std
foreach test $testcases {
# If we're only testing specific files and this isn't one of them, skip
it.
@@ -546,6 +552,7 @@ proc v3-dg-runtest { testcases flags default-extra-flags } {
set option_list { }
foreach x $std_list {
if { $x eq "impcx" } then { set x "26 -fimplicit-constexpr" }
+ if { $x eq "modules" } then { set x "$v3_modules_std -fmodules
-flang-info-include-translate" }
lappend option_list "${std_prefix}$x"
}
} else {
base-commit: 52a24bcecd388ab6e7d4e6500809fc761f6e7ca5
--
2.51.0