diff options
Diffstat (limited to 'tests/cc/modules')
-rw-r--r-- | tests/cc/modules/common.testscript | 23 | ||||
-rw-r--r-- | tests/cc/modules/headers.testscript | 8 | ||||
-rw-r--r-- | tests/cc/modules/modules.testscript | 26 |
3 files changed, 40 insertions, 17 deletions
diff --git a/tests/cc/modules/common.testscript b/tests/cc/modules/common.testscript index 6f09c62..9883e42 100644 --- a/tests/cc/modules/common.testscript +++ b/tests/cc/modules/common.testscript @@ -2,7 +2,7 @@ # license : MIT; see accompanying LICENSE file crosstest = false -test.arguments = config.cxx=$quote($recall($cxx.path) $cxx.config.mode, true) +test.arguments = config.cxx=$quote($recall($cxx.path) $cxx.config.mode) .include ../../common.testscript @@ -21,7 +21,15 @@ cxx.std = experimental cxx.features.symexport = true # @@ TMP revise -if ($cxx.id == 'gcc') +# +# Note: there are some issues with enabling modules in Apple Clang 15 so +# for now we only test vanilla Clang. +# +if (($cxx.id == 'gcc' && $cxx.version.major >= 11) || \ + ($cxx.id == 'clang' && $cxx.version.major >= 16) || \ + ($cxx.id == 'msvc' && ($cxx.version.major > 19 || \ + ($cxx.version.major == 19 && \ + $cxx.version.minor >= 36)))) cxx.features.modules = true using cxx @@ -38,7 +46,7 @@ if ($cxx.target.class == 'windows') exe{*}: test = true EOI -# Determine if we have modules and header units support. +# Determine if we have named modules and header units support. # +$* noop <<EOI | set modules print $cxx.features.modules @@ -47,3 +55,12 @@ EOI +$* noop <<EOI | set headers print ($cxx.features.modules && $cxx.id == 'gcc') EOI + +# @@ TMP: modules support is broken in MinGW GCC (not just symexport). +# @@ TMP: try modules with Clang on Windows (symexport seems to work). +# +if ($cxx.target.class == 'windows' && \ + ($cxx.id == 'gcc' || $cxx.id.type == 'clang')) + modules = false + headers = false +end diff --git a/tests/cc/modules/headers.testscript b/tests/cc/modules/headers.testscript index 6fc2ba7..20f2a5f 100644 --- a/tests/cc/modules/headers.testscript +++ b/tests/cc/modules/headers.testscript @@ -69,7 +69,7 @@ cat <<EOI >=driver-inc.cxx; #endif int main () {return f () - CORE_OUT;} EOI -$* test clean config.cxx.translatable_headers="$~/core.hxx" <<EOI +$* test clean config.cxx.translate_include="$~/core.hxx" <<EOI ./: exe{test-imp}: cxx{driver-imp} hxx{core} ./: exe{test-inc}: cxx{driver-inc} hxx{core} EOI @@ -104,7 +104,7 @@ $* test clean config.cxx.translatable_headers="$~/core.hxx" <<EOI int main () {return g ();} EOI $* test clean config.cxx.poptions=-DBASE_INCLUDE \ - config.cxx.translatable_headers="$~/core.hxx" <<EOI + config.cxx.translate_include="$~/core.hxx" <<EOI exe{test}: cxx{driver} hxx{core} mxx{base} EOI #\ @@ -135,7 +135,7 @@ cat <<EOI >=driver-inc.cxx; #include <generated/core.hxx> int main () {return f ();} EOI -$* test clean config.cxx.translatable_headers="$~/core.hxx" <<EOI +$* test clean config.cxx.translate_include="$~/core.hxx" <<EOI ./: exe{test-imp}: cxx{driver-imp} hxx{core} ./: exe{test-inc}: cxx{driver-inc} hxx{core} hxx{core}: in{core} @@ -161,7 +161,7 @@ cat <<EOI >=driver-inc.cxx; # out = ../../headers-remapped-out; $* 'test:' ./@$out/remapped/ \ - config.cxx.translatable_headers=$out/remapped/core.hxx <<EOI; + config.cxx.translate_include=$out/remapped/core.hxx <<EOI; ./: exe{test-imp}: cxx{driver-imp} hxx{core} ./: exe{test-inc}: cxx{driver-inc} hxx{core} hxx{core}: in{core} diff --git a/tests/cc/modules/modules.testscript b/tests/cc/modules/modules.testscript index a43cc57..c286c1f 100644 --- a/tests/cc/modules/modules.testscript +++ b/tests/cc/modules/modules.testscript @@ -173,13 +173,16 @@ $* test clean <<EOI ln -s ../driver.cxx ./; $* test &*.d <'exe{test}: cxx{driver}' 2>>EOE != 0 driver.cxx: error: unable to resolve module foo.core + info: verify module interface is listed as a prerequisite, otherwise + info: consider adjusting module interface file names or + info: consider specifying module name with cxx.module_name EOE : misguessed : ln -s ../core.mxx ./; cat <'import bar.core;' >=driver.cxx; -$* test &*.d &?*.ii <'exe{test}: cxx{driver} mxx{core}' 2>>EOE != 0 +$* test &*.d &?*.ii* <'exe{test}: cxx{driver} mxx{core}' 2>>EOE != 0 driver.cxx: error: failed to correctly guess module name from mxx{core} info: guessed: bar.core info: actual: foo.core @@ -202,15 +205,11 @@ $* test clean <<EOI : : Test global module fragment/leading module marker (module;). : -if ($cxx.id != 'msvc') # Disabled for MSVC due to issue 845845. -{ cat <<EOI >=g.hxx; void g (); EOI cat <<EOI >=core.mxx; -#if __cpp_modules >= 201810 module; -#endif #include "g.hxx" EOI @@ -219,7 +218,6 @@ ln -s ../core.cxx ../driver.cxx ./; $* test clean <<EOI exe{test}: cxx{driver} {mxx cxx}{core} EOI -} : re-export : @@ -351,7 +349,7 @@ $* test --verbose 1 <<EOI 2>>EOE; exe{test}: cxx{driver} {mxx}{foo-core} exe{test}: test.arguments = two EOI - c++ cxx{driver} + c++ cxx{driver} -> obje{driver} ld exe{test} test exe{test} EOE @@ -370,20 +368,28 @@ cat <<EOI >=core.mxx; export __symexport int f (int); - __symexport int g_impl (int i) {return i - 1;} + __symexport int g_impl (int i); export __symexport inline int g (int i) {return g_impl (i);} + + export __symexport int v1 = 1; + export __symexport extern int v2; EOI ln -s ../core.cxx core-f.cxx; cat <<EOI >=core-g.cxx; module foo.core; int g_impl (int i) {return i - 1;} + int v = 1; + EOI +cat <<EOI >=core-v.cxx; + module foo.core; + int v2 = -1; EOI cat <<EOI >=driver.cxx; import foo.core; - int main (int argc, char*[]) {return f (argc) + g (argc);} + int main (int argc, char*[]) {return f (argc) + g (argc) + v1 + v2;} EOI $* test clean <<EOI ./: lib{foo} exe{test} # Full build. exe{test}: cxx{driver} lib{foo} - lib{foo}: mxx{core} cxx{core-f} # @@ VC: core-g + lib{foo}: mxx{core} cxx{core-g core-f core-v} EOI |