diff --git a/libcxx/test/std/utilities/format/format.functions/format_tests.h b/libcxx/test/std/utilities/format/format.functions/format_tests.h --- 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 @@ 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 @@ 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 --- 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 @@ } } -#ifndef _LIBCPP_HAS_NO_UNICODE +#ifndef TEST_HAS_NO_UNICODE template struct numpunct_unicode; @@ -244,7 +244,7 @@ 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 @@ 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 @@ 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 --- a/libcxx/test/support/msvc_stdlib_force_include.h +++ b/libcxx/test/support/msvc_stdlib_force_include.h @@ -104,8 +104,4 @@ __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 --- a/libcxx/test/support/test_macros.h +++ b/libcxx/test/support/test_macros.h @@ -361,6 +361,12 @@ # 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