[libcxx-commits] [libcxx] 7c7d59a - [libc++] Use TEST_HAS_NO_UNICODE instead of _LIBCPP_HAS_NO_UNICODE in the test suite

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 11 07:35:07 PST 2022


Author: Louis Dionne
Date: 2022-01-11T10:34:59-05:00
New Revision: 7c7d59a35d65fecc5ed59f86f1c93163d2bd5365

URL: https://github.com/llvm/llvm-project/commit/7c7d59a35d65fecc5ed59f86f1c93163d2bd5365
DIFF: https://github.com/llvm/llvm-project/commit/7c7d59a35d65fecc5ed59f86f1c93163d2bd5365.diff

LOG: [libc++] Use TEST_HAS_NO_UNICODE instead of _LIBCPP_HAS_NO_UNICODE in the test suite

Differential Revision: https://reviews.llvm.org/D116973

Added: 
    

Modified: 
    libcxx/test/std/utilities/format/format.functions/format_tests.h
    libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp
    libcxx/test/support/msvc_stdlib_force_include.h
    libcxx/test/support/test_macros.h

Removed: 
    


################################################################################
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 3de307ba6a44..f5a888eb35bf 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 <format>
 
 #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 <class CharT, class TestFunction>
 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 <class CharT, class TestFunction, class ExceptionTest>

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 ada7f09f0fd3..7fe6907f2f4b 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<CharT> expected, std::locale loc,
   }
 }
 
-#ifndef _LIBCPP_HAS_NO_UNICODE
+#ifndef TEST_HAS_NO_UNICODE
 template <class CharT>
 struct numpunct_unicode;
 
@@ -244,7 +244,7 @@ struct numpunct_unicode<wchar_t> : std::numpunct<wchar_t> {
   string_type do_falsename() const override { return L"ungültig"; }
 };
 #endif
-#endif // _LIBCPP_HAS_NO_UNICODE
+#endif // TEST_HAS_NO_UNICODE
 
 template <class CharT>
 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<CharT>());
 
@@ -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 <class CharT>

diff  --git a/libcxx/test/support/msvc_stdlib_force_include.h b/libcxx/test/support/msvc_stdlib_force_include.h
index b1ce02650a5d..bd83bee22ce7 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 322601609bf5..cde783a41db7 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


        


More information about the libcxx-commits mailing list