From 7c7d59a35d65fecc5ed59f86f1c93163d2bd5365 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Mon, 10 Jan 2022 17:14:01 -0500 Subject: [PATCH] [libc++] Use TEST_HAS_NO_UNICODE instead of _LIBCPP_HAS_NO_UNICODE in the test suite Differential Revision: https://reviews.llvm.org/D116973 --- libcxx/test/std/utilities/format/format.functions/format_tests.h | 8 ++++---- .../format/format.functions/locale-specific_form.pass.cpp | 8 ++++---- libcxx/test/support/msvc_stdlib_force_include.h | 4 ---- libcxx/test/support/test_macros.h | 6 ++++++ 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/libcxx/test/std/utilities/format/format.functions/format_tests.h b/libcxx/test/std/utilities/format/format.functions/format_tests.h index 3de307b..f5a888e 100644 --- a/libcxx/test/std/utilities/format/format.functions/format_tests.h +++ b/libcxx/test/std/utilities/format/format.functions/format_tests.h @@ -11,6 +11,7 @@ #include #include "make_string.h" +#include "test_macros.h" // In this file the following template types are used: // TestFunction must be callable as check(expected-result, string-to-format, args-to-format...) @@ -227,7 +228,8 @@ void format_test_string(T world, T universe, TestFunction check, template void format_test_string_unicode(TestFunction check) { -#ifndef _LIBCPP_HAS_NO_UNICODE + (void)check; +#ifndef TEST_HAS_NO_UNICODE // ß requires one column check(STR("aßc"), STR("{}"), STR("aßc")); @@ -259,9 +261,7 @@ void format_test_string_unicode(TestFunction check) { check(STR("a\u1110c---"), STR("{:-<7}"), STR("a\u1110c")); check(STR("-a\u1110c--"), STR("{:-^7}"), STR("a\u1110c")); check(STR("---a\u1110c"), STR("{:->7}"), STR("a\u1110c")); -#else - (void)check; -#endif +#endif // TEST_HAS_NO_UNICODE } template diff --git a/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp b/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp index ada7f09..7fe6907 100644 --- a/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp @@ -227,7 +227,7 @@ void test(std::basic_string expected, std::locale loc, } } -#ifndef _LIBCPP_HAS_NO_UNICODE +#ifndef TEST_HAS_NO_UNICODE template struct numpunct_unicode; @@ -244,7 +244,7 @@ struct numpunct_unicode : std::numpunct { string_type do_falsename() const override { return L"ungültig"; } }; #endif -#endif // _LIBCPP_HAS_NO_UNICODE +#endif // TEST_HAS_NO_UNICODE template void test_bool() { @@ -265,7 +265,7 @@ void test_bool() { test(STR("true"), std::locale(LOCALE_en_US_UTF_8), STR("{:L}"), true); test(STR("false"), std::locale(LOCALE_en_US_UTF_8), STR("{:L}"), false); -#ifndef _LIBCPP_HAS_NO_UNICODE +#ifndef TEST_HAS_NO_UNICODE std::locale loc_unicode = std::locale(std::locale(), new numpunct_unicode()); @@ -276,7 +276,7 @@ void test_bool() { test(STR("gültig!!!"), loc_unicode, STR("{:!<9L}"), true); test(STR("_gültig__"), loc_unicode, STR("{:_^9L}"), true); test(STR(" gültig"), loc_unicode, STR("{:>9L}"), true); -#endif +#endif // TEST_HAS_NO_UNICODE } template diff --git a/libcxx/test/support/msvc_stdlib_force_include.h b/libcxx/test/support/msvc_stdlib_force_include.h index b1ce026..bd83bee 100644 --- a/libcxx/test/support/msvc_stdlib_force_include.h +++ b/libcxx/test/support/msvc_stdlib_force_include.h @@ -104,8 +104,4 @@ const AssertionDialogAvoider assertion_dialog_avoider{}; __pragma(warning(pop)) #endif // __clang__ -#if defined(_MSVC_EXECUTION_CHARACTER_SET) && _MSVC_EXECUTION_CHARACTER_SET != 65001 -#define _LIBCPP_HAS_NO_UNICODE 1 -#endif - #endif // SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_H diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h index 3226016..cde783a 100644 --- a/libcxx/test/support/test_macros.h +++ b/libcxx/test/support/test_macros.h @@ -361,6 +361,12 @@ inline void DoNotOptimize(Tp const& value) { # define TEST_HAS_NO_WIDE_CHARACTERS #endif +#if defined(_LIBCPP_HAS_NO_UNICODE) +# define TEST_HAS_NO_UNICODE +#elif defined(_MSVC_EXECUTION_CHARACTER_SET) && _MSVC_EXECUTION_CHARACTER_SET != 65001 +# define TEST_HAS_NO_UNICODE +#endif + #if defined(__GNUC__) #pragma GCC diagnostic pop #endif -- 2.7.4