[libcxx-commits] [libcxx] 3465f02 - [libc++][NFC] Add missing conditionals for the existence of wide characters
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 21 15:01:03 PST 2022
Author: Louis Dionne
Date: 2022-11-21T18:00:53-05:00
New Revision: 3465f0225906d42baf0c5e674ad583d0cac32640
URL: https://github.com/llvm/llvm-project/commit/3465f0225906d42baf0c5e674ad583d0cac32640
DIFF: https://github.com/llvm/llvm-project/commit/3465f0225906d42baf0c5e674ad583d0cac32640.diff
LOG: [libc++][NFC] Add missing conditionals for the existence of wide characters
Differential Revision: https://reviews.llvm.org/D138435
Added:
Modified:
libcxx/include/locale
libcxx/include/streambuf
libcxx/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.fail.cpp
libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp
libcxx/test/libcxx/utilities/format/format.string/format.string.std/extended_grapheme_cluster.h
libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/default.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
libcxx/test/std/strings/basic.string/traits_mismatch.verify.cpp
libcxx/test/std/strings/basic.string/types.pass.cpp
libcxx/test/std/strings/string.view/string.view.access/at.pass.cpp
libcxx/test/std/strings/string.view/string.view.access/back.pass.cpp
libcxx/test/std/strings/string.view/string.view.access/data.pass.cpp
libcxx/test/std/strings/string.view/string.view.access/front.pass.cpp
libcxx/test/std/strings/string.view/string.view.access/index.pass.cpp
libcxx/test/std/strings/string.view/string.view.cons/from_literal.pass.cpp
libcxx/test/std/strings/string.view/string.view.cons/from_ptr_len.pass.cpp
libcxx/test/std/strings/string.view/string.view.ops/compare.pointer.pass.cpp
libcxx/test/std/strings/string.view/string.view.ops/compare.pointer_size.pass.cpp
libcxx/test/std/strings/string.view/string.view.ops/compare.size_size_sv.pass.cpp
libcxx/test/std/strings/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp
libcxx/test/std/strings/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp
libcxx/test/std/strings/string.view/string.view.ops/compare.sv.pass.cpp
libcxx/test/std/strings/string.view/string.view.ops/copy.pass.cpp
libcxx/test/std/strings/string.view/string.view.ops/substr.pass.cpp
libcxx/test/std/strings/string.view/types.pass.cpp
libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/advance_to.pass.cpp
libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/begin.pass.cpp
libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/ctor.pass.cpp
libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/end.pass.cpp
libcxx/utils/generate_extended_grapheme_cluster_test.py
Removed:
################################################################################
diff --git a/libcxx/include/locale b/libcxx/include/locale
index 8a330ae374d0f..015efd8b0dc71 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -2385,7 +2385,9 @@ extern template _LIBCPP_FUNC_VIS __time_get_storage<_CharT>::string_type __time_
/**/
_LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(char)
+#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(wchar_t)
+#endif
#undef _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
@@ -2445,8 +2447,10 @@ protected:
~__time_put();
void __do_put(char* __nb, char*& __ne, const tm* __tm,
char __fmt, char __mod) const;
+#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
void __do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm,
char __fmt, char __mod) const;
+#endif
};
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
diff --git a/libcxx/include/streambuf b/libcxx/include/streambuf
index 53a71720f11af..d473df103475c 100644
--- a/libcxx/include/streambuf
+++ b/libcxx/include/streambuf
@@ -489,10 +489,12 @@ basic_streambuf<_CharT, _Traits>::overflow(int_type)
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<char>;
-extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<wchar_t>;
-
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>;
+
+#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<wchar_t>;
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<wchar_t>;
+#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.fail.cpp b/libcxx/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.fail.cpp
index c607c6328d3ea..27871b0c7bea5 100644
--- a/libcxx/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.fail.cpp
+++ b/libcxx/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.fail.cpp
@@ -13,6 +13,8 @@
//
// The char type of the stream and the char_type of the traits have to match
+// UNSUPPORTED: no-wide-characters
+
#include <fstream>
int main(int, char**)
diff --git a/libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp b/libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp
index 545530bef1c68..ce22fee618732 100644
--- a/libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp
+++ b/libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp
@@ -13,6 +13,8 @@
// The char type of the stream and the char_type of the traits have to match
+// UNSUPPORTED: no-wide-characters
+
#include <fstream>
int main(int, char**)
diff --git a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/extended_grapheme_cluster.h b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/extended_grapheme_cluster.h
index e66d4b1551d81..f28122255305a 100644
--- a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/extended_grapheme_cluster.h
+++ b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/extended_grapheme_cluster.h
@@ -65,6 +65,8 @@
#include <string_view>
#include <vector>
+#include "test_macros.h"
+
template <class CharT>
struct data {
/// The input to parse.
@@ -689,6 +691,7 @@ std::array<data<char>, 602> data_utf8 = {{
/// Note that most of the data for the UTF-16 and UTF-32 are identical. However
/// since the size of the code units
diff er the breaks can contain
diff erent
/// values.
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
std::array<data<wchar_t>, 602> data_utf16 = {{
{L"\U00000020\U00000020", {32, 32}, {1, 2}},
{L"\U00000020\U00000308\U00000020", {32, 32}, {2, 3}},
@@ -1901,5 +1904,6 @@ std::array<data<wchar_t>, 602> data_utf32 = {{
{L"\U00000061\U0000200d\U0001f6d1", {97, 128721}, {2, 3}},
{L"\U00002701\U0000200d\U00002701", {9985}, {3}},
{L"\U00000061\U0000200d\U00002701", {97, 9985}, {2, 3}}}};
+#endif // TEST_HAS_NO_WIDE_CHARACTERS
#endif // LIBCXX_TEST_STD_UTILITIES_FORMAT_FORMAT_STRING_FORMAT_STRING_STD_EXTENDED_GRAPHEME_CLUSTER_H
diff --git a/libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/default.pass.cpp b/libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/default.pass.cpp
index bb70095f139f3..4a028fce54b3f 100644
--- a/libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/default.pass.cpp
+++ b/libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/default.pass.cpp
@@ -28,7 +28,9 @@ test()
int main(int, char**)
{
test<char>();
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<wchar_t>();
+#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
index 72604a780b3cf..d6db253ad5af3 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
@@ -44,10 +44,13 @@ struct CanDeduce<Iter, Alloc, decltype((void)
std::basic_string{std::declval<Iter>(), std::declval<Iter>(), std::declval<Alloc>()}
)> : std::true_type { };
-static_assert( CanDeduce<int*, std::allocator<int>>::value);
+static_assert( CanDeduce<char*, std::allocator<char>>::value);
static_assert(!CanDeduce<NotAnIterator, std::allocator<char>>::value);
static_assert(!CanDeduce<NotAnInputIterator, std::allocator<char16_t>>::value);
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+static_assert( CanDeduce<wchar_t*, std::allocator<wchar_t>>::value);
static_assert(!CanDeduce<wchar_t const*, NotAnAllocator<wchar_t>>::value);
+#endif
TEST_CONSTEXPR_CXX20 bool test() {
{
@@ -70,6 +73,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
assert(s1.size() == 10);
assert(s1.compare(0, s1.size(), s, s1.size()) == 0);
}
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
const wchar_t* s = L"12345678901234";
std::basic_string s1{s, s+10, test_allocator<wchar_t>{}};
@@ -80,6 +84,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
assert(s1.size() == 10);
assert(s1.compare(0, s1.size(), s, s1.size()) == 0);
}
+#endif
{
const char16_t* s = u"12345678901234";
std::basic_string s1{s, s+10, min_allocator<char16_t>{}};
diff --git a/libcxx/test/std/strings/basic.string/traits_mismatch.verify.cpp b/libcxx/test/std/strings/basic.string/traits_mismatch.verify.cpp
index 6730e2fb5d902..82c438b0cb033 100644
--- a/libcxx/test/std/strings/basic.string/traits_mismatch.verify.cpp
+++ b/libcxx/test/std/strings/basic.string/traits_mismatch.verify.cpp
@@ -9,6 +9,8 @@
// <string>
// The strings's value type must be the same as the traits's char_type
+// UNSUPPORTED: no-wide-characters
+
#include <string>
std::basic_string<char, std::char_traits<wchar_t> > s; // expected-error@*:* {{traits_type::char_type must be the same type as CharT}}
diff --git a/libcxx/test/std/strings/basic.string/types.pass.cpp b/libcxx/test/std/strings/basic.string/types.pass.cpp
index 910b3364d6b89..542336bdf12bc 100644
--- a/libcxx/test/std/strings/basic.string/types.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/types.pass.cpp
@@ -74,7 +74,9 @@ test()
int main(int, char**)
{
test<test_traits<char>, test_allocator<char> >();
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<std::char_traits<wchar_t>, std::allocator<wchar_t> >();
+#endif
static_assert((std::is_same<std::basic_string<char>::traits_type,
std::char_traits<char> >::value), "");
static_assert((std::is_same<std::basic_string<char>::allocator_type,
diff --git a/libcxx/test/std/strings/string.view/string.view.access/at.pass.cpp b/libcxx/test/std/strings/string.view/string.view.access/at.pass.cpp
index 82da10d125b84..99a81acdf32d3 100644
--- a/libcxx/test/std/strings/string.view/string.view.access/at.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.access/at.pass.cpp
@@ -35,8 +35,10 @@ int main(int, char**) {
test ( "ABCDE", 5 );
test ( "a", 1 );
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test ( L"ABCDE", 5 );
test ( L"a", 1 );
+#endif
#if TEST_STD_VER >= 11
test ( u"ABCDE", 5 );
diff --git a/libcxx/test/std/strings/string.view/string.view.access/back.pass.cpp b/libcxx/test/std/strings/string.view/string.view.access/back.pass.cpp
index d5a21bb394252..49b84ab1a6818 100644
--- a/libcxx/test/std/strings/string.view/string.view.access/back.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.access/back.pass.cpp
@@ -32,8 +32,10 @@ int main(int, char**) {
assert ( test ( "ABCDE", 5 ));
assert ( test ( "a", 1 ));
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
assert ( test ( L"ABCDE", 5 ));
assert ( test ( L"a", 1 ));
+#endif
#if TEST_STD_VER >= 11
assert ( test ( u"ABCDE", 5 ));
diff --git a/libcxx/test/std/strings/string.view/string.view.access/data.pass.cpp b/libcxx/test/std/strings/string.view/string.view.access/data.pass.cpp
index 1c8540ad15fe7..50d2a14348a3e 100644
--- a/libcxx/test/std/strings/string.view/string.view.access/data.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.access/data.pass.cpp
@@ -33,8 +33,10 @@ int main(int, char**) {
test ( "ABCDE", 5 );
test ( "a", 1 );
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test ( L"ABCDE", 5 );
test ( L"a", 1 );
+#endif
#if TEST_STD_VER >= 11
test ( u"ABCDE", 5 );
diff --git a/libcxx/test/std/strings/string.view/string.view.access/front.pass.cpp b/libcxx/test/std/strings/string.view/string.view.access/front.pass.cpp
index 900a69821b57f..d9e1607643bca 100644
--- a/libcxx/test/std/strings/string.view/string.view.access/front.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.access/front.pass.cpp
@@ -32,8 +32,10 @@ int main(int, char**) {
assert ( test ( "ABCDE", 5 ));
assert ( test ( "a", 1 ));
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
assert ( test ( L"ABCDE", 5 ));
assert ( test ( L"a", 1 ));
+#endif
#if TEST_STD_VER >= 11
assert ( test ( u"ABCDE", 5 ));
diff --git a/libcxx/test/std/strings/string.view/string.view.access/index.pass.cpp b/libcxx/test/std/strings/string.view/string.view.access/index.pass.cpp
index 493787aaa84d1..b27bc65251c57 100644
--- a/libcxx/test/std/strings/string.view/string.view.access/index.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.access/index.pass.cpp
@@ -34,8 +34,10 @@ int main(int, char**) {
test ( "ABCDE", 5 );
test ( "a", 1 );
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test ( L"ABCDE", 5 );
test ( L"a", 1 );
+#endif
#if TEST_STD_VER >= 11
test ( u"ABCDE", 5 );
diff --git a/libcxx/test/std/strings/string.view/string.view.cons/from_literal.pass.cpp b/libcxx/test/std/strings/string.view/string.view.cons/from_literal.pass.cpp
index b58a838ce6f01..124aaeaab54a7 100644
--- a/libcxx/test/std/strings/string.view/string.view.cons/from_literal.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.cons/from_literal.pass.cpp
@@ -45,9 +45,11 @@ int main(int, char**) {
test ( "A" );
test ( "" );
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test ( L"QBCDE" );
test ( L"A" );
test ( L"" );
+#endif
#if TEST_STD_VER >= 11
test ( u"QBCDE" );
diff --git a/libcxx/test/std/strings/string.view/string.view.cons/from_ptr_len.pass.cpp b/libcxx/test/std/strings/string.view/string.view.cons/from_ptr_len.pass.cpp
index 540fa74ceca01..8d48f90848119 100644
--- a/libcxx/test/std/strings/string.view/string.view.cons/from_ptr_len.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.cons/from_ptr_len.pass.cpp
@@ -45,6 +45,7 @@ int main(int, char**) {
}
#endif
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test ( L"QBCDE", 5 );
test ( L"QBCDE", 2 );
test ( L"", 0 );
@@ -56,6 +57,7 @@ int main(int, char**) {
static_assert ( sv1.data() == s, "" );
}
#endif
+#endif // TEST_HAS_NO_WIDE_CHARACTERS
#if TEST_STD_VER >= 11
test ( u"QBCDE", 5 );
diff --git a/libcxx/test/std/strings/string.view/string.view.ops/compare.pointer.pass.cpp b/libcxx/test/std/strings/string.view/string.view.ops/compare.pointer.pass.cpp
index 3133939e8c39b..ed06bec7039ec 100644
--- a/libcxx/test/std/strings/string.view/string.view.ops/compare.pointer.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.ops/compare.pointer.pass.cpp
@@ -55,6 +55,7 @@ int main(int, char**)
test("abcdefghijklmnopqrst", "abcdefghijklmnopqrst", 0);
}
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
test(L"", L"", 0);
test(L"", L"abcde", -5);
@@ -73,6 +74,7 @@ int main(int, char**)
test(L"abcdefghijklmnopqrst", L"abcdefghij", 10);
test(L"abcdefghijklmnopqrst", L"abcdefghijklmnopqrst", 0);
}
+#endif
#if TEST_STD_VER >= 11
{
diff --git a/libcxx/test/std/strings/string.view/string.view.ops/compare.pointer_size.pass.cpp b/libcxx/test/std/strings/string.view/string.view.ops/compare.pointer_size.pass.cpp
index d21a0c5a7f8f9..a7a5c30241814 100644
--- a/libcxx/test/std/strings/string.view/string.view.ops/compare.pointer_size.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.ops/compare.pointer_size.pass.cpp
@@ -381,6 +381,7 @@ int main(int, char**)
test("abcdefghijklmnopqrst", 0, static_cast<size_t>(-1), "abcdefghijklmnopqrst", 0);
}
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
test(L"", 0, 0, L"", 0);
test(L"", 0, 0, L"abcde", -5);
@@ -399,6 +400,7 @@ int main(int, char**)
test(L"abcdefghijklmnopqrst", 0, 12, L"abcdefghij", 10);
test(L"abcdefghijklmnopqrst", 0, static_cast<size_t>(-1), L"abcdefghijklmnopqrst", 0);
}
+#endif
#if TEST_STD_VER >= 11
{
diff --git a/libcxx/test/std/strings/string.view/string.view.ops/compare.size_size_sv.pass.cpp b/libcxx/test/std/strings/string.view/string.view.ops/compare.size_size_sv.pass.cpp
index e4dd2c53ec6ea..477bfdde8c790 100644
--- a/libcxx/test/std/strings/string.view/string.view.ops/compare.size_size_sv.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.ops/compare.size_size_sv.pass.cpp
@@ -368,12 +368,14 @@ int main(int, char**) {
test("ABCde", 2, 4, "abcde", -1);
}
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
test(L"abcde", 5, 1, L"", 0);
test(L"abcde", 2, 4, L"", 3);
test(L"abcde", 2, 4, L"abcde", 2);
test(L"ABCde", 2, 4, L"abcde", -1);
}
+#endif
#if TEST_STD_VER >= 11
{
diff --git a/libcxx/test/std/strings/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp b/libcxx/test/std/strings/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp
index 57a0b13c009c7..f0c4a79e60837 100644
--- a/libcxx/test/std/strings/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp
@@ -1315,6 +1315,7 @@ int main(int, char**) {
test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 10, -10);
}
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
test(L"", 0, 0, L"abcde", 0, 0);
test(L"", 0, 0, L"abcde", 1, -1);
@@ -1322,6 +1323,7 @@ int main(int, char**) {
test(L"abcdefghijklmnopqrst", 21, 0, L"abcde", 1, 0);
test(L"abcdefghijklmnopqrst", 10, 0, L"abcdefghij", 10, -10);
}
+#endif
#if TEST_STD_VER >= 11
{
diff --git a/libcxx/test/std/strings/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp b/libcxx/test/std/strings/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp
index 3ea44ae84b43f..a0f661c3520a6 100644
--- a/libcxx/test/std/strings/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp
@@ -5814,12 +5814,14 @@ int main(int, char**) {
test("ABCde", 2, 4, "abcde", 2, 4, -1);
}
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
test(L"abcde", 5, 1, L"", 0, 0, 0);
test(L"abcde", 2, 4, L"", 0, 0, 3);
test(L"abcde", 2, 4, L"abcde", 3, 4, -2);
test(L"ABCde", 2, 4, L"abcde", 2, 4, -1);
}
+#endif
#if TEST_STD_VER >= 11
{
diff --git a/libcxx/test/std/strings/string.view/string.view.ops/compare.sv.pass.cpp b/libcxx/test/std/strings/string.view/string.view.ops/compare.sv.pass.cpp
index ff687064073ba..7db327d9c9ef8 100644
--- a/libcxx/test/std/strings/string.view/string.view.ops/compare.sv.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.ops/compare.sv.pass.cpp
@@ -55,6 +55,7 @@ int main(int, char**) {
test("abcdefghijklmnopqrst", "abcdefghij", 10);
test("abcdefghijklmnopqrst", "abcdefghijklmnopqrst", 0);
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test(L"", L"", 0);
test(L"", L"abcde", -5);
test(L"", L"abcdefghij", -10);
@@ -71,6 +72,7 @@ int main(int, char**) {
test(L"abcdefghijklmnopqrst", L"abcde", 15);
test(L"abcdefghijklmnopqrst", L"abcdefghij", 10);
test(L"abcdefghijklmnopqrst", L"abcdefghijklmnopqrst", 0);
+#endif
#if TEST_STD_VER >= 11
test(u"", u"", 0);
diff --git a/libcxx/test/std/strings/string.view/string.view.ops/copy.pass.cpp b/libcxx/test/std/strings/string.view/string.view.ops/copy.pass.cpp
index 709e26576d3a7..54e185f793c8f 100644
--- a/libcxx/test/std/strings/string.view/string.view.ops/copy.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.ops/copy.pass.cpp
@@ -93,10 +93,12 @@ int main(int, char**) {
test ( "a" );
test ( "" );
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test ( L"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" );
test ( L"ABCDE" );
test ( L"a" );
test ( L"" );
+#endif
#if TEST_STD_VER >= 11
test ( u"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" );
@@ -111,7 +113,9 @@ int main(int, char**) {
#endif
test_constexpr_copy("ABCDE", "GHIJK", "BCDJK");
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test_constexpr_copy(L"ABCDE", L"GHIJK", L"BCDJK");
+#endif
#if TEST_STD_VER >= 11
test_constexpr_copy(u"ABCDE", u"GHIJK", u"BCDJK");
test_constexpr_copy(U"ABCDE", U"GHIJK", U"BCDJK");
@@ -121,7 +125,9 @@ int main(int, char**) {
#endif
#if TEST_STD_VER >= 20
static_assert(test_constexpr_copy("ABCDE", "GHIJK", "BCDJK"));
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
static_assert(test_constexpr_copy(L"ABCDE", L"GHIJK", L"BCDJK"));
+#endif
static_assert(test_constexpr_copy(u"ABCDE", u"GHIJK", u"BCDJK"));
static_assert(test_constexpr_copy(U"ABCDE", U"GHIJK", U"BCDJK"));
static_assert(test_constexpr_copy(u8"ABCDE", u8"GHIJK", u8"BCDJK"));
diff --git a/libcxx/test/std/strings/string.view/string.view.ops/substr.pass.cpp b/libcxx/test/std/strings/string.view/string.view.ops/substr.pass.cpp
index c2b951158dbe1..92f9d8cc8592c 100644
--- a/libcxx/test/std/strings/string.view/string.view.ops/substr.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.ops/substr.pass.cpp
@@ -77,10 +77,12 @@ int main(int, char**) {
test ( "a" );
test ( "" );
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test ( L"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" );
test ( L"ABCDE" );
test ( L"a" );
test ( L"" );
+#endif
#if TEST_STD_VER >= 11
test ( u"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" );
diff --git a/libcxx/test/std/strings/string.view/types.pass.cpp b/libcxx/test/std/strings/string.view/types.pass.cpp
index e9d3d24863bb0..f952f20561230 100644
--- a/libcxx/test/std/strings/string.view/types.pass.cpp
+++ b/libcxx/test/std/strings/string.view/types.pass.cpp
@@ -72,7 +72,9 @@ test()
int main(int, char**)
{
test<std::char_traits<char> >();
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<std::char_traits<wchar_t> >();
+#endif
#ifndef TEST_HAS_NO_CHAR8_T
test<std::char_traits<char8_t> >();
#endif
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/advance_to.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/advance_to.pass.cpp
index 6b4afcb6561de..1a699427f9732 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/advance_to.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/advance_to.pass.cpp
@@ -50,7 +50,9 @@ constexpr void test(const CharT* fmt) {
constexpr bool test() {
test("abc");
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test(L"abc");
+#endif
#ifndef TEST_HAS_NO_CHAR8_T
test(u8"abc");
#endif
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/begin.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/begin.pass.cpp
index 63122dc50b76c..df3563ec4341f 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/begin.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/begin.pass.cpp
@@ -36,7 +36,9 @@ constexpr void test(const CharT* fmt) {
constexpr bool test() {
test("abc");
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test(L"abc");
+#endif
#ifndef TEST_HAS_NO_CHAR8_T
test(u8"abc");
#endif
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/ctor.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/ctor.pass.cpp
index 08cd9d5e4b871..8b1601e00c754 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/ctor.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/ctor.pass.cpp
@@ -57,7 +57,9 @@ constexpr void test(const CharT* fmt) {
constexpr bool test() {
test("abc");
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test(L"abc");
+#endif
#ifndef TEST_HAS_NO_CHAR8_T
test(u8"abc");
#endif
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/end.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/end.pass.cpp
index e135418dc5b85..e1d0f2f354d69 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/end.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/end.pass.cpp
@@ -36,7 +36,9 @@ constexpr void test(const CharT* fmt) {
constexpr bool test() {
test("abc");
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test(L"abc");
+#endif
#ifndef TEST_HAS_NO_CHAR8_T
test(u8"abc");
#endif
diff --git a/libcxx/utils/generate_extended_grapheme_cluster_test.py b/libcxx/utils/generate_extended_grapheme_cluster_test.py
index c263cdd69cd0b..5061c80f8ed4c 100755
--- a/libcxx/utils/generate_extended_grapheme_cluster_test.py
+++ b/libcxx/utils/generate_extended_grapheme_cluster_test.py
@@ -156,6 +156,8 @@ def parseBreakTestLine(input: TextIO) -> Optional[BreakTestItem]:
#include <string_view>
#include <vector>
+#include "test_macros.h"
+
template <class CharT>
struct data {{
/// The input to parse.
@@ -179,6 +181,7 @@ def parseBreakTestLine(input: TextIO) -> Optional[BreakTestItem]:
/// Note that most of the data for the UTF-16 and UTF-32 are identical. However
/// since the size of the code units
diff er the breaks can contain
diff erent
/// values.
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
std::array<data<wchar_t>, {0}> data_utf16 = {{{{
{2}}}}};
@@ -189,6 +192,7 @@ def parseBreakTestLine(input: TextIO) -> Optional[BreakTestItem]:
/// values.
std::array<data<wchar_t>, {0}> data_utf32 = {{{{
{3}}}}};
+#endif // TEST_HAS_NO_WIDE_CHARACTERS
#endif // LIBCXX_TEST_STD_UTILITIES_FORMAT_FORMAT_STRING_FORMAT_STRING_STD_EXTENDED_GRAPHEME_CLUSTER_H"""
More information about the libcxx-commits
mailing list