diff options
| author | Arthur LAURENT <[email protected]> | 2025-09-15 03:49:55 +0200 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2025-09-18 07:07:25 +0200 |
| commit | 438fdf4c5cf90993aca9f7be0280ddf0c298f42a (patch) | |
| tree | 2165550deccae8cabb77a885d308d8562b1aabad /tests/projects/c++/modules | |
| parent | 2ec98bd08913bf172b27f642f3751dd12eb10825 (diff) | |
nfx(C++ modules) improve stdmodule related tests
Diffstat (limited to 'tests/projects/c++/modules')
| -rw-r--r-- | tests/projects/c++/modules/multiple_runtimes/test.lua | 48 | ||||
| -rw-r--r-- | tests/projects/c++/modules/multiple_runtimes/xmake.lua | 14 | ||||
| -rw-r--r-- | tests/projects/c++/modules/test_stdmodules.lua | 1 |
3 files changed, 54 insertions, 9 deletions
diff --git a/tests/projects/c++/modules/multiple_runtimes/test.lua b/tests/projects/c++/modules/multiple_runtimes/test.lua index e77adc4ae..8ae3ae3a7 100644 --- a/tests/projects/c++/modules/multiple_runtimes/test.lua +++ b/tests/projects/c++/modules/multiple_runtimes/test.lua @@ -1 +1,47 @@ -inherit(".test_stdmodules") +inherit(".test_base") + +CLANG_MIN_VER = "19" +GCC_MIN_VER = "15" +MSVC_MIN_VER = "14.35" + +function main(_) + local format_string = "Multiple runtimes don't work" + + local clang_options + if not is_plat("windows") then -- remove when std module is supported for libc++ on windows + local str + if is_plat("windows") then + str = "v1\\std.cppm" + else + str = "v1/std.cppm" + end + clang_options = {stdmodule = true, compiler = "clang", version = CLANG_MIN_VER, {str = str, format_string = format_string}} + end + local gcc_options + if is_plat("mingw") or is_plat("linux") then + gcc_options = {stdmodule = true, compiler = "gcc", version = GCC_MIN_VER, {str = "v1/std.cppm", format_string = format_string}} + end + + -- latest mingw gcc 15.1 is broken + -- error: F:/msys64/mingw64/include/c++/15.1.0/shared_mutex:105:3: error: 'int std::__glibcxx_rwlock_timedrdlock(pthread_rwlock_t*, const timespec*)' exposes TU-local entity 'int pthread_rwlock_timedrdlock(pthread_rwlock_t*, const timespec*)' + -- 105 | __glibcxx_rwlock_timedrdlock (pthread_rwlock_t *__rwlock, + -- | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ + -- In file included from F:/msys64/mingw64/include/c++/15.1.0/x86_64-w64-mingw32/bits/gthr-default.h:35, + -- from F:/msys64/mingw64/include/c++/15.1.0/x86_64-w64-mingw32/bits/gthr.h:157, + -- from F:/msys64/mingw64/include/c++/15.1.0/ext/atomicity.h:37, + -- from F:/msys64/mingw64/include/c++/15.1.0/bits/ios_base.h:41, + -- from F:/msys64/mingw64/include/c++/15.1.0/streambuf:45, + -- from F:/msys64/mingw64/include/c++/15.1.0/bits/streambuf_iterator.h:37, + -- from F:/msys64/mingw64/include/c++/15.1.0/iterator:68, + -- from F:/msys64/mingw64/include/c++/15.1.0/x86_64-w64-mingw32/bits/stdc++.h:56: + -- F:/msys64/mingw64/include/pthread.h:296:28: note: 'int pthread_rwlock_timedrdlock(pthread_rwlock_t*, const timespec*)' declared with internal linkage + -- 296 | WINPTHREAD_RWLOCK_DECL int pthread_rwlock_timedrdlock(pthread_rwlock_t *l, const struct timespec *ts) + -- | ^~~~~~~~~~~~~~~~~~~~~~~~~~ + -- F:/msys64/mingw64/include/c++/15.1.0/shared_mutex:115:3: error: 'int std::__glibcxx_rwlock_timedwrlock(pthread_rwlock_t*, const timespec*)' exposes TU-local entity 'int pthread_rwlock_timedwrlock(pthread_rwlock_t*, const timespec*)' + -- 115 | __glibcxx_rwlock_timedwrlock (pthread_rwlock_t *__rwlock, local gcc_options = {stdmodule = true, compiler = "gcc", version = GCC_MIN_VER} + if is_subhost("msys") then + gcc_options = nil + end + local msvc_options = {stdmodule = true, version = MSVC_MIN_VER, {std = "modules\\std.ixx"}} + run_tests(clang_options, gcc_options, msvc_options) +end diff --git a/tests/projects/c++/modules/multiple_runtimes/xmake.lua b/tests/projects/c++/modules/multiple_runtimes/xmake.lua index 6fc363a95..736079687 100644 --- a/tests/projects/c++/modules/multiple_runtimes/xmake.lua +++ b/tests/projects/c++/modules/multiple_runtimes/xmake.lua @@ -3,14 +3,12 @@ add_files("src/*.cpp") set_languages("c++23") set_encodings("utf-8") -if not is_plat("windows") then -- remove when std module is supported for libc++ on windows - target("llvm") - set_kind("binary") - set_toolchains("clang") - set_runtimes("c++_shared") - set_policy("build.c++.modules", true) - add_files("src/main.cpp") -end +target("llvm") + set_kind("binary") + set_toolchains("clang") + set_runtimes("c++_shared") + set_policy("build.c++.modules", true) + add_files("src/main.cpp") if is_plat("linux") or is_plat("mingw") then target("gnu") diff --git a/tests/projects/c++/modules/test_stdmodules.lua b/tests/projects/c++/modules/test_stdmodules.lua index c9062eb96..291494b38 100644 --- a/tests/projects/c++/modules/test_stdmodules.lua +++ b/tests/projects/c++/modules/test_stdmodules.lua @@ -6,6 +6,7 @@ MSVC_MIN_VER = "14.35" function main(_) local clang_options = {stdmodule = true, compiler = "clang", version = CLANG_MIN_VER} + local gcc_options = {stdmodule = true, compiler = "gcc", version = GCC_MIN_VER} -- latest mingw gcc 15.1 is broken -- error: F:/msys64/mingw64/include/c++/15.1.0/shared_mutex:105:3: error: 'int std::__glibcxx_rwlock_timedrdlock(pthread_rwlock_t*, const timespec*)' exposes TU-local entity 'int pthread_rwlock_timedrdlock(pthread_rwlock_t*, const timespec*)' -- 105 | __glibcxx_rwlock_timedrdlock (pthread_rwlock_t *__rwlock, |
