Skip to content

Commit 04a75f5

Browse files
ldionnemordante
andauthored
[libc++] Properly define _LIBCPP_HAS_NO_UNICODE in __config_site (#95138)
Fixes #93638 Co-authored-by: Mark de Wever <koraq@xs4all.nl>
1 parent 7b33c5c commit 04a75f5

File tree

14 files changed

+21
-9
lines changed

14 files changed

+21
-9
lines changed

libcxx/include/__config_site.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#cmakedefine _LIBCPP_HAS_NO_FILESYSTEM
2727
#cmakedefine _LIBCPP_HAS_NO_RANDOM_DEVICE
2828
#cmakedefine _LIBCPP_HAS_NO_LOCALIZATION
29+
#cmakedefine _LIBCPP_HAS_NO_UNICODE
2930
#cmakedefine _LIBCPP_HAS_NO_WIDE_CHARACTERS
3031
#cmakedefine _LIBCPP_HAS_NO_STD_MODULES
3132
#cmakedefine _LIBCPP_HAS_NO_TIME_ZONE_DATABASE

libcxx/include/__format/parser_std_format_spec.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,8 +1155,8 @@ __estimate_column_width(basic_string_view<_CharT> __str, size_t __maximum, __col
11551155
// When Unicode isn't supported assume ASCII and every code unit is one code
11561156
// point. In ASCII the estimated column width is always one. Thus there's no
11571157
// need for rounding.
1158-
size_t __width_ = std::min(__str.size(), __maximum);
1159-
return {__width_, __str.begin() + __width_};
1158+
size_t __width = std::min(__str.size(), __maximum);
1159+
return {__width, __str.begin() + __width};
11601160
}
11611161

11621162
# endif // !defined(_LIBCPP_HAS_NO_UNICODE)

libcxx/test/libcxx/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/vprint_unicode.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
99
// UNSUPPORTED: no-filesystem, no-rtti
10+
// UNSUPPORTED: libcpp-has-no-unicode
1011
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
1112

1213
// XFAIL: availability-fp_to_chars-missing

libcxx/test/libcxx/input.output/iostream.format/print.fun/transcoding.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
99
// UNSUPPORTED: no-filesystem
10+
// UNSUPPORTED: libcpp-has-no-unicode
1011
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
1112
// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=2000000
1213

libcxx/test/libcxx/input.output/iostream.format/print.fun/vprint_unicode_posix.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
99
// UNSUPPORTED: no-filesystem
10+
// UNSUPPORTED: libcpp-has-no-unicode
1011
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
1112

1213
// XFAIL: availability-fp_to_chars-missing

libcxx/test/libcxx/input.output/iostream.format/print.fun/vprint_unicode_windows.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
99
// UNSUPPORTED: no-filesystem
1010
// UNSUPPORTED: no-wide-characters
11+
// UNSUPPORTED: libcpp-has-no-unicode
1112
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
1213

1314
// Clang modules do not work with the definiton of _LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION

libcxx/test/libcxx/utilities/format/format.functions/ascii.pass.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
// UNSUPPORTED: c++03, c++11, c++14, c++17
99
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
1010

11-
// Force unicode to be disabled.
12-
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_HAS_NO_UNICODE
11+
// REQUIRES: libcpp-has-no-unicode
1312

1413
// TODO FMT This test should not require std::to_chars(floating-point)
1514
// XFAIL: availability-fp_to_chars-missing

libcxx/test/libcxx/utilities/format/format.functions/escaped_output.ascii.pass.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
// TODO FMT This test should not require std::to_chars(floating-point)
1212
// XFAIL: availability-fp_to_chars-missing
1313

14-
// Force unicode to be disabled.
15-
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_HAS_NO_UNICODE
14+
// REQUIRES: libcpp-has-no-unicode
1615

1716
// <format>
1817

libcxx/test/libcxx/utilities/format/format.string/format.string.std/extended_grapheme_cluster.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//===----------------------------------------------------------------------===//
77

88
// UNSUPPORTED: c++03, c++11, c++14, c++17
9+
// UNSUPPORTED: libcpp-has-no-unicode
910
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
1011

1112
// <format>

libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/locale-specific_form.pass.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ test(std::stringstream& stream, std::string expected, test_format_string<char, A
6666
"\nFormat string ", fmt.get(), "\nExpected output ", expected, "\nActual output ", out, '\n'));
6767
}
6868
// *** vprint_unicode ***
69+
#ifndef TEST_HAS_NO_UNICODE
6970
{
7071
stream.str("");
7172

@@ -75,6 +76,7 @@ test(std::stringstream& stream, std::string expected, test_format_string<char, A
7576
TEST_WRITE_CONCATENATED(
7677
"\nFormat string ", fmt.get(), "\nExpected output ", expected, "\nActual output ", out, '\n'));
7778
}
79+
#endif // TEST_HAS_NO_UNICODE
7880
// *** vprint_nonunicode ***
7981
{
8082
stream.str("");

libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/vprint_unicode.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//===----------------------------------------------------------------------===//
77

88
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
9+
// UNSUPPORTED: libcpp-has-no-unicode
910
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
1011

1112
// TODO PRINT Investigate see https://reviews.llvm.org/D156585

libcxx/test/std/input.output/iostream.format/print.fun/no_file_description.pass.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ static void test_println_blank_line() {
8080
}
8181

8282
static void test_vprint_unicode() {
83+
#ifdef TEST_HAS_NO_UNICODE
8384
std::array<char, 100> buffer{0};
8485

8586
FILE* file = fmemopen(buffer.data(), buffer.size(), "wb");
@@ -92,6 +93,7 @@ static void test_vprint_unicode() {
9293

9394
assert(pos > 0);
9495
assert(std::string_view(buffer.data(), pos) == "hello world!");
96+
#endif // TEST_HAS_NO_UNICODE
9597
}
9698

9799
static void test_vprint_nonunicode() {

libcxx/test/std/input.output/iostream.format/print.fun/vprint_unicode.sh.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
99
// UNSUPPORTED: no-filesystem
10+
// UNSUPPORTED: libcpp-has-no-unicode
1011
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
1112

1213
// XFAIL: availability-fp_to_chars-missing

libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.fsigned-char.pass.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,19 @@ void test() {
7171
#if TEST_STD_VER > 20
7272
test(STR(R"('\u{0}')"), STR("?}"), '\x00');
7373
test(STR("'a'"), STR("?}"), 'a');
74+
# ifndef TEST_HAS_NO_UNICODE
7475
if constexpr (std::same_as<CharT, char>) {
7576
test(STR(R"('\x{80}')"), STR("?}"), '\x80');
7677
test(STR(R"('\x{ff}')"), STR("?}"), '\xff');
7778
}
78-
# ifndef TEST_HAS_NO_WIDE_CHARACTERS
79+
# ifndef TEST_HAS_NO_WIDE_CHARACTERS
7980
else {
8081
test(STR(R"('\u{80}')"), STR("?}"), '\x80');
8182
test(STR("'\u00ff'"), STR("?}"), '\xff');
8283
}
83-
# endif // TEST_HAS_NO_WIDE_CHARACTERS
84-
#endif // TEST_STD_VER > 20
84+
# endif // TEST_HAS_NO_WIDE_CHARACTERS
85+
# endif // TEST_HAS_NO_UNICODE
86+
#endif // TEST_STD_VER > 20
8587

8688
test(STR("10000000"), STR("b}"), char(-128));
8789
test(STR("11111111"), STR("b}"), char(-1));

0 commit comments

Comments
 (0)