Skip to content

Commit

Permalink
[libc++][nfc] Add TEST_HAS_NO_UNICODE_CHARS.
Browse files Browse the repository at this point in the history
This avoids using an libc++ internal macro in our tests.

Reviewed By: #libc, philnik, ldionne

Differential Revision: https://reviews.llvm.org/D118832
  • Loading branch information
mordante committed Feb 3, 2022
1 parent 823fa09 commit 9596784
Show file tree
Hide file tree
Showing 92 changed files with 127 additions and 135 deletions.
Expand Up @@ -342,7 +342,7 @@ constexpr bool test() {
#ifndef _LIBCPP_HAS_NO_CHAR8_T
test<char8_t>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif
Expand Down
Expand Up @@ -97,7 +97,7 @@ constexpr bool test() {
#ifndef _LIBCPP_HAS_NO_CHAR8_T
test<char8_t>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif
Expand Down
Expand Up @@ -260,7 +260,7 @@ constexpr bool test() {
#ifndef _LIBCPP_HAS_NO_CHAR8_T
test<char8_t>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif
Expand Down
Expand Up @@ -177,7 +177,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<std::atomic_char8_t, char8_t>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<std::atomic_char16_t, char16_t>();
test<std::atomic_char32_t, char32_t>();
#endif
Expand Down Expand Up @@ -205,7 +205,7 @@ int main(int, char**)
test<volatile std::atomic_ulong, unsigned long>();
test<volatile std::atomic_llong, long long>();
test<volatile std::atomic_ullong, unsigned long long>();
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<volatile std::atomic_char16_t, char16_t>();
test<volatile std::atomic_char32_t, char32_t>();
#endif
Expand Down
Expand Up @@ -60,7 +60,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
static_assert((std::is_same<std::atomic<char8_t>, std::atomic_char8_t>::value), "");
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
static_assert((std::is_same<std::atomic<char16_t>, std::atomic_char16_t>::value), "");
static_assert((std::is_same<std::atomic<char32_t>, std::atomic_char32_t>::value), "");
#endif
Expand Down
Expand Up @@ -30,7 +30,7 @@ static_assert(std::three_way_comparable<wchar_t&>);
#ifndef _LIBCPP_HAS_NO_CHAR8_T
static_assert(std::three_way_comparable<char8_t const&>);
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
static_assert(std::three_way_comparable<char16_t volatile&>);
static_assert(std::three_way_comparable<char32_t const volatile&>);
#endif
Expand Down
Expand Up @@ -49,7 +49,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif
Expand Down
Expand Up @@ -36,7 +36,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>(0);
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>(0);
test<char32_t>(0);
#endif
Expand Down
Expand Up @@ -35,7 +35,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, 8>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, 16>();
test<char32_t, 32>();
#endif
Expand Down
Expand Up @@ -39,7 +39,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, 2>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, 4>();
test<char32_t, 9>();
#endif
Expand Down
Expand Up @@ -36,7 +36,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>(0);
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>(0);
test<char32_t>(0);
#endif
Expand Down
Expand Up @@ -34,7 +34,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, std::denorm_absent>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, std::denorm_absent>();
test<char32_t, std::denorm_absent>();
#endif
Expand Down
Expand Up @@ -34,7 +34,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, false>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
#endif
Expand Down
Expand Up @@ -34,7 +34,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, false>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
#endif
Expand Down
Expand Up @@ -34,7 +34,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, false>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
#endif
Expand Down
Expand Up @@ -34,7 +34,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, false>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
#endif
Expand Down
Expand Up @@ -38,7 +38,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>(0);
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>(0);
test<char32_t>(0);
#endif
Expand Down
Expand Up @@ -34,7 +34,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, true>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, true>();
test<char32_t, true>();
#endif
Expand Down
Expand Up @@ -34,7 +34,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, true>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, true>();
test<char32_t, true>();
#endif
Expand Down
Expand Up @@ -34,7 +34,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, false>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
#endif
Expand Down
Expand Up @@ -34,7 +34,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, true>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, true>();
test<char32_t, true>();
#endif
Expand Down
Expand Up @@ -34,7 +34,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, true>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, true>();
test<char32_t, true>();
#endif
Expand Down
Expand Up @@ -34,7 +34,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, false>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
#endif
Expand Down
Expand Up @@ -47,7 +47,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>(0);
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>(0);
test<char32_t>(0);
#endif
Expand Down
Expand Up @@ -47,7 +47,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>(UCHAR_MAX); // ??
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>(USHRT_MAX);
test<char32_t>(UINT_MAX);
#endif
Expand Down
Expand Up @@ -35,7 +35,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, 0>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, 0>();
test<char32_t, 0>();
#endif
Expand Down
Expand Up @@ -35,7 +35,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, 0>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, 0>();
test<char32_t, 0>();
#endif
Expand Down
Expand Up @@ -35,7 +35,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, 0>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, 0>();
test<char32_t, 0>();
#endif
Expand Down
Expand Up @@ -47,7 +47,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>(0);
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>(0);
test<char32_t>(0);
#endif
Expand Down
Expand Up @@ -35,7 +35,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, 0>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, 0>();
test<char32_t, 0>();
#endif
Expand Down
Expand Up @@ -35,7 +35,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, 0>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, 0>();
test<char32_t, 0>();
#endif
Expand Down
Expand Up @@ -55,7 +55,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif
Expand Down
Expand Up @@ -35,7 +35,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, 2>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, 2>();
test<char32_t, 2>();
#endif
Expand Down
Expand Up @@ -36,7 +36,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>(0);
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>(0);
test<char32_t>(0);
#endif
Expand Down
Expand Up @@ -34,7 +34,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, std::round_toward_zero>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, std::round_toward_zero>();
test<char32_t, std::round_toward_zero>();
#endif
Expand Down
Expand Up @@ -55,10 +55,10 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
#endif // TEST_HAS_NO_UNICODE_CHARS
test<short>();
test<unsigned short>();
test<int>();
Expand Down
Expand Up @@ -34,7 +34,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, false>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
#endif
Expand Down
Expand Up @@ -41,7 +41,7 @@ int main(int, char**)
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, integral_types_trap>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, integral_types_trap>();
test<char32_t, integral_types_trap>();
#endif
Expand Down
Expand Up @@ -20,8 +20,6 @@

#include "test_macros.h"

//#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS

typedef std::codecvt<char16_t, char, std::mbstate_t> F;

class my_facet
Expand All @@ -38,11 +36,8 @@ class my_facet

int my_facet::count = 0;

//#endif

int main(int, char**)
{
//#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
{
std::locale l(std::locale::classic(), new my_facet);
assert(my_facet::count == 1);
Expand All @@ -58,7 +53,6 @@ int main(int, char**)
assert(my_facet::count == 1);
}
assert(my_facet::count == 0);
//#endif

return 0;
}

0 comments on commit 9596784

Please sign in to comment.