mirror of git://gcc.gnu.org/git/gcc.git
c++, libstdc++: add "modules" std to testsuite
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 }.
To run library tests with modules we need to compile them; this patch makes
us build a header unit for bits/stdc++.h and module interface units for std
and std.compat, if v3_std_list includes "modules". So this doesn't happen
by default without a further change.
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 (v3_std_list): Handle "modules" std.
(v3_modules_std): New global.
(v3-build_support): Build gcms for bits/stdc++.h, std, and
std.compat.
gcc/testsuite/ChangeLog:
* lib/g++-dg.exp: Handle "modules" std.
* lib/target-supports.exp (check_effective_target_modules): New.
This commit is contained in:
parent
a9d57db38c
commit
6fb589cd4b
|
|
@ -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 "26 -fmodules -flang-info-include-translate" }
|
||||
lappend option_list "${std_prefix}$x"
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -12348,6 +12348,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 { } {
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
@ -739,6 +746,7 @@ proc v3_target_compile_as_c { source dest type options } {
|
|||
proc v3-build_support { } {
|
||||
global env
|
||||
global srcdir
|
||||
global blddir
|
||||
global v3-wchar_t
|
||||
global v3-threads
|
||||
global v3-symver
|
||||
|
|
@ -748,6 +756,7 @@ proc v3-build_support { } {
|
|||
set v3-wchar_t 0
|
||||
set v3-threads 0
|
||||
set v3-symver 0
|
||||
set v3-modules 0
|
||||
set libtest_objs ""
|
||||
|
||||
set config_src "config.cc"
|
||||
|
|
@ -787,6 +796,37 @@ proc v3-build_support { } {
|
|||
}
|
||||
}
|
||||
|
||||
global v3_std_list
|
||||
global v3_modules_std
|
||||
if { "modules" in $v3_std_list } {
|
||||
verbose -log "modules testing requested"
|
||||
set v3-modules 1
|
||||
}
|
||||
|
||||
# If we're doing modules testing, compile module std, std.compat, and the
|
||||
# bits/stdc++.h header unit.
|
||||
if { ${v3-modules} == 1 } {
|
||||
set std_file "$blddir/include/bits/std.cc"
|
||||
set std_compat_file "$blddir/include/bits/std.compat.cc"
|
||||
|
||||
if { ([v3_target_compile bits/stdc++.h /dev/null object \
|
||||
[list "additional_flags=-std=gnu++$v3_modules_std -fmodules -g -w -fsearch-include-path"]]
|
||||
!= "") } {
|
||||
error "could not compile bits/stdc++.h"
|
||||
}
|
||||
if { ([v3_target_compile $std_file std.o object \
|
||||
[list "additional_flags=-std=gnu++$v3_modules_std -fmodules -g -w"]]
|
||||
!= "") } {
|
||||
error "could not compile std.cc"
|
||||
}
|
||||
if { ([v3_target_compile $std_compat_file std.compat.o object \
|
||||
[list "additional_flags=-std=gnu++$v3_modules_std -fmodules -g -w"]]
|
||||
!= "") } {
|
||||
error "could not compile std.compat.cc"
|
||||
}
|
||||
append libtest_objs "std.o std.compat.o "
|
||||
}
|
||||
|
||||
# Build the support objects.
|
||||
set source_files [list testsuite_abi.cc testsuite_allocator.cc \
|
||||
testsuite_character.cc testsuite_hooks.cc \
|
||||
|
|
|
|||
Loading…
Reference in New Issue