[PATCH] D56702: [libc++] Use runtime rather then compile-time glibc version check
Petr Hosek via Phabricator
reviews at reviews.llvm.org
Wed Jan 16 19:01:29 PST 2019
phosek updated this revision to Diff 182205.
Repository:
rCXX libc++
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56702/new/
https://reviews.llvm.org/D56702
Files:
libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp
Index: libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp
===================================================================
--- libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp
+++ libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp
@@ -115,19 +115,24 @@
assert(f.curr_symbol() == L" EUR");
}
+#if defined(_CS_GNU_LIBC_VERSION)
+ size_t n = confstr(_CS_GNU_LIBC_VERSION, nullptr, (size_t)0);
+ char *buf = new char[n];
+ confstr(_CS_GNU_LIBC_VERSION, buf, n);
+ bool glibc_2_24_currency_symbol = strverscmp(buf, "glibc 2.24") >= 0;
+ delete[] buf;
+#endif
+
{
Fnf f(LOCALE_ru_RU_UTF_8, 1);
+#if defined(_CS_GNU_LIBC_VERSION)
// GLIBC <= 2.23 uses currency_symbol="<U0440><U0443><U0431>"
// GLIBC >= 2.24 uses currency_symbol="<U20BD>"
// See also: http://www.fileformat.info/info/unicode/char/20bd/index.htm
-#if defined(TEST_GLIBC_PREREQ)
- #if TEST_GLIBC_PREREQ(2, 24)
- #define TEST_GLIBC_2_24_CURRENCY_SYMBOL
- #endif
-#endif
-
-#if defined(TEST_GLIBC_2_24_CURRENCY_SYMBOL)
- assert(f.curr_symbol() == " \u20BD");
+ if (glibc_2_24_currency_symbol)
+ assert(f.curr_symbol() == " \u20BD");
+ else
+ assert(f.curr_symbol() == " \xD1\x80\xD1\x83\xD0\xB1");
#else
assert(f.curr_symbol() == " \xD1\x80\xD1\x83\xD0\xB1");
#endif
@@ -138,8 +143,11 @@
}
{
Fwf f(LOCALE_ru_RU_UTF_8, 1);
-#if defined(TEST_GLIBC_2_24_CURRENCY_SYMBOL)
- assert(f.curr_symbol() == L" \u20BD");
+#if defined(_CS_GNU_LIBC_VERSION)
+ if (glibc_2_24_currency_symbol)
+ assert(f.curr_symbol() == L" \u20BD");
+ else
+ assert(f.curr_symbol() == L" \x440\x443\x431");
#else
assert(f.curr_symbol() == L" \x440\x443\x431");
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56702.182205.patch
Type: text/x-patch
Size: 1983 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190117/c74b1523/attachment.bin>
More information about the libcxx-commits
mailing list