diff --git a/libcxx/include/__locale b/libcxx/include/__locale index 99d29c167f29..bb8f8e7bbf5d 100644 --- a/libcxx/include/__locale +++ b/libcxx/include/__locale @@ -334,6 +334,8 @@ public: # endif // defined(__BIONIC__) # elif defined(__GLIBC__) typedef unsigned short mask; + _LIBCPP_DIAGNOSTIC_PUSH + _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmodules-ambiguous-internal-linkage") static const mask space = _ISspace; static const mask print = _ISprint; static const mask cntrl = _IScntrl; @@ -344,6 +346,7 @@ public: static const mask punct = _ISpunct; static const mask xdigit = _ISxdigit; static const mask blank = _ISblank; + _LIBCPP_DIAGNOSTIC_POP # if defined(__mips__) || (BYTE_ORDER == BIG_ENDIAN) static const mask __regex_word = static_cast(_ISbit(15)); # else diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in index b9ddfd5bbf4c..316785ddfe9b 100644 --- a/libcxx/include/module.modulemap.in +++ b/libcxx/include/module.modulemap.in @@ -1,6 +1,6 @@ // This module contains headers related to the configuration of the library. These headers // are free of any dependency on the rest of libc++. -module std_config [system] { +module std_config { @LIBCXX_CONFIG_SITE_MODULE_ENTRY@ // generated via CMake textual header "__config" textual header "__configuration/abi.h" @@ -18,7 +18,7 @@ module std_config [system] { textual header "version" } -module std_core [system] { +module std_core { module cstddef { module byte { header "__cstddef/byte.h" } module max_align_t { @@ -380,7 +380,7 @@ module std_core [system] { } } // module std_core -module std [system] { +module std { module algorithm { module adjacent_find { header "__algorithm/adjacent_find.h" } module all_of { header "__algorithm/all_of.h" } @@ -1625,7 +1625,7 @@ module std [system] { } // TODO: Understand why this needs to live in its own module - module locale_base [system] { + module locale_base { header "__locale" export * } @@ -2451,57 +2451,57 @@ module std [system] { // These modules need to be their own top-level modules because they depend on the system-provided // headers (via include_next), which are then free to include other C headers provided by libc++. // If we group these headers in a single module, we would end up with circular dependencies. -module std_complex_h [system] { +module std_complex_h { header "complex.h" export * } -module std_errno_h [system] { +module std_errno_h { header "errno.h" export * } -module std_math_h [system] { +module std_math_h { header "math.h" export * } -module std_stdatomic_h [system] { +module std_stdatomic_h { header "stdatomic.h" export * } -module std_stddef_h [system] { +module std_stddef_h { // supports being included multiple times with different pre-defined macros textual header "stddef.h" } -module std_stdio_h [system] { +module std_stdio_h { // supports being included multiple times with different pre-defined macros textual header "stdio.h" } -module std_stdlib_h [system] { +module std_stdlib_h { // supports being included multiple times with different pre-defined macros textual header "stdlib.h" } -module std_string_h [system] { +module std_string_h { header "string.h" export * } -module std_tgmath_h [system] { +module std_tgmath_h { header "tgmath.h" export * } -module std_uchar_h [system] { +module std_uchar_h { header "uchar.h" export * } -module std_wchar_h [system] { +module std_wchar_h { // supports being included multiple times with different pre-defined macros textual header "wchar.h" } -module std_wctype_h [system] { +module std_wctype_h { header "wctype.h" export * } // This header is used by other C compatibility headers so it needs to be in its own module. -module std_private_mbstate_t [system] { +module std_private_mbstate_t { header "__mbstate_t.h" export * } diff --git a/libcxx/include/syncstream b/libcxx/include/syncstream index 03e18ddbdfd2..ca1a89e6bfe0 100644 --- a/libcxx/include/syncstream +++ b/libcxx/include/syncstream @@ -196,7 +196,8 @@ public: // calling __inc_reference. // // pre: __ptr is in __lut_ - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI lock_guard __get_lock([[maybe_unused]] void* __ptr) noexcept { + _LIBCPP_NO_THREAD_SAFETY_ANALYSIS [[nodiscard]] _LIBCPP_HIDE_FROM_ABI lock_guard + __get_lock([[maybe_unused]] void* __ptr) noexcept { shared_lock __lock{__mutex_}; return lock_guard{__get_it(__ptr)->second.__mutex}; } diff --git a/libcxx/test/std/depr/depr.cpp.headers/ccomplex.verify.cpp b/libcxx/test/std/depr/depr.cpp.headers/ccomplex.verify.cpp index 900ca0e5e1c5..3be5117503d5 100644 --- a/libcxx/test/std/depr/depr.cpp.headers/ccomplex.verify.cpp +++ b/libcxx/test/std/depr/depr.cpp.headers/ccomplex.verify.cpp @@ -12,7 +12,6 @@ // When built with modules, should be omitted. // UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: clang-modules-build // FIXME: using `#warning` causes diagnostics from system headers which include deprecated headers. This can only be // enabled again once https://github.com/llvm/llvm-project/pull/168041 (or a similar feature) has landed, since that diff --git a/libcxx/test/std/depr/depr.cpp.headers/ciso646.verify.cpp b/libcxx/test/std/depr/depr.cpp.headers/ciso646.verify.cpp index a1ca842bc62a..09ad85bab996 100644 --- a/libcxx/test/std/depr/depr.cpp.headers/ciso646.verify.cpp +++ b/libcxx/test/std/depr/depr.cpp.headers/ciso646.verify.cpp @@ -12,7 +12,6 @@ // When built with modules, should be omitted. // UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: clang-modules-build // FIXME: using `#warning` causes diagnostics from system headers which include deprecated headers. This can only be // enabled again once https://github.com/llvm/llvm-project/pull/168041 (or a similar feature) has landed, since that diff --git a/libcxx/test/std/depr/depr.cpp.headers/cstdalign.verify.cpp b/libcxx/test/std/depr/depr.cpp.headers/cstdalign.verify.cpp index 503a87658ac0..be0074a03709 100644 --- a/libcxx/test/std/depr/depr.cpp.headers/cstdalign.verify.cpp +++ b/libcxx/test/std/depr/depr.cpp.headers/cstdalign.verify.cpp @@ -12,7 +12,6 @@ // When built with modules, should be omitted. // UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: clang-modules-build // FIXME: using `#warning` causes diagnostics from system headers which include deprecated headers. This can only be // enabled again once https://github.com/llvm/llvm-project/pull/168041 (or a similar feature) has landed, since that diff --git a/libcxx/test/std/depr/depr.cpp.headers/cstdbool.verify.cpp b/libcxx/test/std/depr/depr.cpp.headers/cstdbool.verify.cpp index 80025c5ab72d..90fa5c0ac9b3 100644 --- a/libcxx/test/std/depr/depr.cpp.headers/cstdbool.verify.cpp +++ b/libcxx/test/std/depr/depr.cpp.headers/cstdbool.verify.cpp @@ -12,7 +12,6 @@ // When built with modules, should be omitted. // UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: clang-modules-build // FIXME: using `#warning` causes diagnostics from system headers which include deprecated headers. This can only be // enabled again once https://github.com/llvm/llvm-project/pull/168041 (or a similar feature) has landed, since that diff --git a/libcxx/test/std/depr/depr.cpp.headers/ctgmath.verify.cpp b/libcxx/test/std/depr/depr.cpp.headers/ctgmath.verify.cpp index 07bdd29648a6..875a9f9bfb81 100644 --- a/libcxx/test/std/depr/depr.cpp.headers/ctgmath.verify.cpp +++ b/libcxx/test/std/depr/depr.cpp.headers/ctgmath.verify.cpp @@ -12,7 +12,6 @@ // When built with modules, should be omitted. // UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: clang-modules-build // FIXME: using `#warning` causes diagnostics from system headers which include deprecated headers. This can only be // enabled again once https://github.com/llvm/llvm-project/pull/168041 (or a similar feature) has landed, since that diff --git a/libcxx/test/std/library/description/conventions/expos.only.func/synth_three_way.pass.cpp b/libcxx/test/std/library/description/conventions/expos.only.func/synth_three_way.pass.cpp index 158ea46ff2c0..780abf39c577 100644 --- a/libcxx/test/std/library/description/conventions/expos.only.func/synth_three_way.pass.cpp +++ b/libcxx/test/std/library/description/conventions/expos.only.func/synth_three_way.pass.cpp @@ -11,11 +11,8 @@ // constexpr auto synth-three-way = ...; // via std::tuple(t) <=> std::tuple(u), which exposes its behavior most directly -#include "test_macros.h" - -TEST_CLANG_DIAGNOSTIC_IGNORED("-Wsign-compare") -TEST_GCC_DIAGNOSTIC_IGNORED("-Wsign-compare") -TEST_MSVC_DIAGNOSTIC_IGNORED(4242 4244) // Various truncation warnings +// ADDITIONAL_COMPILE_FLAGS(gcc-style-warnings): -Wno-sign-compare +// ADDITIONAL_COMPILE_FLAGS(cl-style-warnings): /wd4242 /wd4244 #include #include @@ -24,6 +21,8 @@ TEST_MSVC_DIAGNOSTIC_IGNORED(4242 4244) // Various truncation warnings #include #include // declval +#include "test_macros.h" + template concept can_synth_three_way = requires(T t, U u) { std::tuple(t) <=> std::tuple(u); }; diff --git a/libcxx/test/std/ranges/range.factories/range.iota.view/ctor.value.bound.pass.cpp b/libcxx/test/std/ranges/range.factories/range.iota.view/ctor.value.bound.pass.cpp index b6f429549864..102b5be55866 100644 --- a/libcxx/test/std/ranges/range.factories/range.iota.view/ctor.value.bound.pass.cpp +++ b/libcxx/test/std/ranges/range.factories/range.iota.view/ctor.value.bound.pass.cpp @@ -8,11 +8,10 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 -#include "test_macros.h" +// ADDITIONAL_COMPILE_FLAGS(gcc-style-warnings): -Wno-sign-compare -TEST_CLANG_DIAGNOSTIC_IGNORED("-Wsign-compare") -TEST_GCC_DIAGNOSTIC_IGNORED("-Wsign-compare") -TEST_MSVC_DIAGNOSTIC_IGNORED(4018 4389) // various "signed/unsigned mismatch" +// various "signed/unsigned mismatch" +// ADDITIONAL_COMPILE_FLAGS(cl-style-warnings): /wd4018 /wd4389 // constexpr explicit iota_view(type_identity_t value, type_identity_t bound); // explicit since C++23 diff --git a/libcxx/test/std/ranges/range.factories/range.iota.view/end.pass.cpp b/libcxx/test/std/ranges/range.factories/range.iota.view/end.pass.cpp index d12079fdb5ee..800af01d775c 100644 --- a/libcxx/test/std/ranges/range.factories/range.iota.view/end.pass.cpp +++ b/libcxx/test/std/ranges/range.factories/range.iota.view/end.pass.cpp @@ -8,11 +8,10 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 -#include "test_macros.h" +// ADDITIONAL_COMPILE_FLAGS(gcc-style-warnings): -Wno-sign-compare -TEST_CLANG_DIAGNOSTIC_IGNORED("-Wsign-compare") -TEST_GCC_DIAGNOSTIC_IGNORED("-Wsign-compare") -TEST_MSVC_DIAGNOSTIC_IGNORED(4018 4389) // various "signed/unsigned mismatch" +// various "signed/unsigned mismatch" +// ADDITIONAL_COMPILE_FLAGS(cl-style-warnings): /wd4018 /wd4389 // constexpr auto end() const; // constexpr iterator end() const requires same_as; @@ -21,6 +20,7 @@ TEST_MSVC_DIAGNOSTIC_IGNORED(4018 4389) // various "signed/unsigned mismatch" #include #include +#include "test_macros.h" #include "types.h" template diff --git a/libcxx/test/std/ranges/range.factories/range.iota.view/iterator/star.pass.cpp b/libcxx/test/std/ranges/range.factories/range.iota.view/iterator/star.pass.cpp index b776d90c5e5e..e6f10a4d69c3 100644 --- a/libcxx/test/std/ranges/range.factories/range.iota.view/iterator/star.pass.cpp +++ b/libcxx/test/std/ranges/range.factories/range.iota.view/iterator/star.pass.cpp @@ -10,16 +10,16 @@ // constexpr W operator*() const noexcept(is_nothrow_copy_constructible_v); -#include "test_macros.h" +// ADDITIONAL_COMPILE_FLAGS(gcc-style-warnings): -Wno-sign-compare -TEST_CLANG_DIAGNOSTIC_IGNORED("-Wsign-compare") -TEST_GCC_DIAGNOSTIC_IGNORED("-Wsign-compare") -TEST_MSVC_DIAGNOSTIC_IGNORED(4018) // various "signed/unsigned mismatch" +// various "signed/unsigned mismatch" +// ADDITIONAL_COMPILE_FLAGS(cl-style-warnings): /wd4018 #include #include #include "../types.h" +#include "test_macros.h" struct NotNoexceptCopy { using difference_type = int; diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/three_way.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/three_way.pass.cpp index 697d0c03eefe..f10b1736f1dc 100644 --- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/three_way.pass.cpp +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/three_way.pass.cpp @@ -18,11 +18,8 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 -#include "test_macros.h" - -TEST_CLANG_DIAGNOSTIC_IGNORED("-Wsign-compare") -TEST_GCC_DIAGNOSTIC_IGNORED("-Wsign-compare") -TEST_MSVC_DIAGNOSTIC_IGNORED(4242 4244) +// ADDITIONAL_COMPILE_FLAGS(gcc-style-warnings): -Wno-sign-compare +// ADDITIONAL_COMPILE_FLAGS(cl-style-warnings): /wd4242 /wd4244 #include #include @@ -34,6 +31,8 @@ TEST_MSVC_DIAGNOSTIC_IGNORED(4242 4244) #include // std::is_constant_evaluated #include +#include "test_macros.h" + // A custom three-way result type struct CustomEquality { friend constexpr bool operator==(const CustomEquality&, int) noexcept { return true; }