diff options
author | Petteri Räty <betelgeuse@gentoo.org> | 2012-06-11 00:16:33 +0300 |
---|---|---|
committer | Petteri Räty <betelgeuse@gentoo.org> | 2012-06-11 00:16:33 +0300 |
commit | 4fb751c62962d4dc82d026c2bfb2fc668c10b62b (patch) | |
tree | 3f0cfe0baa16b8bb25f4e61d1c64832c470393fa | |
parent | Remove old libvirt ebuild (diff) | |
download | betelgeuse-4fb751c62962d4dc82d026c2bfb2fc668c10b62b.tar.gz betelgeuse-4fb751c62962d4dc82d026c2bfb2fc668c10b62b.tar.bz2 betelgeuse-4fb751c62962d4dc82d026c2bfb2fc668c10b62b.zip |
My local patch for libc++
Used to build this before it was applied to trunk.
-rw-r--r-- | sys-libs/libcxx/Manifest | 2 | ||||
-rw-r--r-- | sys-libs/libcxx/files/buildit.patch | 29 | ||||
-rw-r--r-- | sys-libs/libcxx/files/locale-linux-2.patch | 659 |
3 files changed, 660 insertions, 30 deletions
diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest index 0aa3bf0..6586496 100644 --- a/sys-libs/libcxx/Manifest +++ b/sys-libs/libcxx/Manifest @@ -1,2 +1,2 @@ -AUX buildit.patch 748 RMD160 ce8f22f66d56c6d7543f9c7751c4a91641b6aa90 SHA1 7e9f622b89cb5555c60204f51d38cd11a0da6fc7 SHA256 6288025791ece70898e55a3bbbe868b90ffbeafd2f60ca63447c88b077b78bde +AUX locale-linux-2.patch 23988 RMD160 40fe8c40152d3150471608d60ee3ba74834b2a25 SHA1 d95860b74ec4c92c9e83800c2cad827269586429 SHA256 618e9454910677a1ef3ab03f1657a4bb28355e98bd476599187a1a6d35596b93 EBUILD libcxx-9999.ebuild 846 RMD160 bb9e55907e66b25f0abeb55b271a6da3cd7b9517 SHA1 cdda602409e5069f0fd01eddeedc289617b2167f SHA256 4f1ff6d164b2ed0f8a7f21f46d7adc2f439772f25ac3e45c4592b75197736143 diff --git a/sys-libs/libcxx/files/buildit.patch b/sys-libs/libcxx/files/buildit.patch deleted file mode 100644 index 0d94cbb..0000000 --- a/sys-libs/libcxx/files/buildit.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff -ur libcxx-9999.old//lib/buildit libcxx-9999/lib/buildit ---- libcxx-9999.old//lib/buildit 2011-05-29 15:29:51.179000188 +0300 -+++ libcxx-9999/lib/buildit 2011-05-29 15:30:45.546000188 +0300 -@@ -35,6 +35,8 @@ - RC_ProjectSourceVersion=1 - fi - -+EXTRA_FLAGS="-std=c++0x " -+ - case $TRIPLE in - *-apple-*) - if [ -z $RC_XBS ] -@@ -53,7 +55,6 @@ - -Wl,-unexported_symbols_list,libc++unexp.exp \ - /usr/lib/libSystem.B.dylib" - else -- EXTRA_FLAGS="-std=c++0x " - RE_EXPORT_FILE="libc++abi.exp" - if [ -n "$SDKROOT" ] - then -@@ -81,7 +82,7 @@ - SOEXT=so - LDSHARED_FLAGS="-o libc++.so.1.0 \ - -shared -nodefaultlibs -Wl,-soname,libc++.so.1 \ -- -lpthread -lrt -lc" -+ -lpthread -lrt -lc -lstdc++" - ;; - esac - diff --git a/sys-libs/libcxx/files/locale-linux-2.patch b/sys-libs/libcxx/files/locale-linux-2.patch new file mode 100644 index 0000000..5a1bd63 --- /dev/null +++ b/sys-libs/libcxx/files/locale-linux-2.patch @@ -0,0 +1,659 @@ +commit f41e6b7f2a1c2f016e29ea440f781a7d90680b4f +Author: Petteri Räty <petsku@petteriraty.eu> +Date: Mon May 30 23:33:08 2011 +0300 + + locale.cpp improved linux support + + Use type_traits to get the type of locale_t underlying struct and use + posix versions of functions. What is left to compile fully on Linux is + figuring out how to support _DefaultRuneLocale. + +diff --git a/src/locale.cpp b/src/locale.cpp +index f32ce96..138dbc2 100644 +--- a/src/locale.cpp ++++ b/src/locale.cpp +@@ -14,6 +14,7 @@ + #include "algorithm" + #include "algorithm" + #include "typeinfo" ++#include "type_traits" + #include "clocale" + #include "cstring" + #include "cwctype" +@@ -21,6 +22,97 @@ + #include <langinfo.h> + #include <stdlib.h> + ++namespace { ++ typedef std::remove_pointer<locale_t>::type locale_struct; ++ typedef std::unique_ptr<locale_struct, decltype(&freelocale)> locale_unique_ptr; ++ typedef std::unique_ptr<locale_struct, decltype(&uselocale)> locale_raii; ++} ++ ++namespace with_locale { namespace { ++#ifdef __APPLE__ ++ using ::btowc_l; ++ using ::wctob_l; ++ using ::wcsnrtombs_l; ++ using ::wcrtomb_l; ++ using ::mbsnrtowcs_l; ++ using ::mbrtowc_l; ++ using ::mbtowc_l; ++ using ::mbrlen_l; ++ using ::localeconv_l; ++ using ::mbsrtowcs_l; ++ ++ decltype(MB_CUR_MAX_L) ++ mb_cur_max_l(locale_t loc) ++ { ++ return MB_CUR_MAX_L(loc); ++ } ++#else ++ template ++ <typename Function, typename ...Args> ++ auto using_locale(Function f, locale_t loc, Args&&... params) -> decltype(f(std::forward<Args>(params)...)) ++ { ++ locale_raii current(uselocale(loc), uselocale); ++ return f(std::forward<Args>(params)...); ++ } ++ ++ decltype(MB_CUR_MAX) ++ mb_cur_max_l(locale_t loc) ++ { ++ locale_raii current(uselocale(loc), uselocale); ++ return MB_CUR_MAX; ++ } ++ ++ wint_t btowc_l(int c, locale_t l) { return using_locale(&btowc, l, c); } ++ int wctob_l(wint_t c, locale_t l) { return using_locale(&wctob, l, c); } ++ size_t wcsnrtombs_l(char * dest, ++ const wchar_t * * src, ++ size_t nwc, ++ size_t len, ++ mbstate_t * ps, ++ locale_t l) ++ { ++ return using_locale(&wcsnrtombs, l, dest, src, nwc, len, ps); ++ } ++ size_t wcrtomb_l(char *s, wchar_t wc, mbstate_t *ps, locale_t l) ++ { ++ return using_locale(&wcrtomb, l, s, wc, ps); ++ } ++ size_t mbsnrtowcs_l(wchar_t * dest, ++ const char * * src, ++ size_t nms, ++ size_t len, ++ mbstate_t * ps, ++ locale_t l) ++ { ++ return using_locale(&mbsnrtowcs, l, dest, src, nms, len, ps); ++ } ++ size_t mbrtowc_l(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps, locale_t l) ++ { ++ return using_locale(&mbrtowc, l, pwc, s, n, ps); ++ } ++ int mbtowc_l(wchar_t * pwc, const char * pmb, size_t max, locale_t l) ++ { ++ return using_locale(&mbtowc, l, pwc, pmb, max); ++ } ++ size_t mbrlen_l(const char *s, size_t n, mbstate_t *ps, locale_t l) ++ { ++ return using_locale(&mbrlen, l, s, n, ps); ++ } ++ struct lconv *localeconv_l(locale_t l) ++ { ++ return using_locale(&localeconv, l); ++ } ++ size_t mbsrtowcs_l(wchar_t * dest, ++ const char * * src, ++ size_t len, ++ mbstate_t * ps, ++ locale_t l) ++ { ++ return using_locale(&mbsrtowcs, l, dest, src, len, ps); ++ } ++#endif ++} } ++ + _LIBCPP_BEGIN_NAMESPACE_STD + + namespace { +@@ -1082,49 +1174,33 @@ ctype_byname<wchar_t>::do_tolower(char_type* low, const char_type* high) const + wchar_t + ctype_byname<wchar_t>::do_widen(char c) const + { +-#ifdef __APPLE__ +- return btowc_l(c, __l); +-#else +- return 0; +-#endif ++ return with_locale::btowc_l(c, __l); + } + + const char* + ctype_byname<wchar_t>::do_widen(const char* low, const char* high, char_type* dest) const + { +-#ifdef __APPLE__ + for (; low != high; ++low, ++dest) +- *dest = btowc_l(*low, __l); ++ *dest = with_locale::btowc_l(*low, __l); + return low; +-#else +- return NULL; +-#endif + } + + char + ctype_byname<wchar_t>::do_narrow(char_type c, char dfault) const + { +-#ifdef __APPLE__ +- int r = wctob_l(c, __l); ++ int r = with_locale::wctob_l(c, __l); + return r != WEOF ? static_cast<char>(r) : dfault; +-#else +- return 0; +-#endif + } + + const wchar_t* + ctype_byname<wchar_t>::do_narrow(const char_type* low, const char_type* high, char dfault, char* dest) const + { +-#ifdef __APPLE__ + for (; low != high; ++low, ++dest) + { +- int r = wctob_l(*low, __l); ++ int r = with_locale::wctob_l(*low, __l); + *dest = r != WEOF ? static_cast<char>(r) : dfault; + } + return low; +-#else +- return NULL; +-#endif + } + + // template <> class codecvt<char, char, mbstate_t> +@@ -1220,7 +1296,6 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st, + const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt, + extern_type* to, extern_type* to_end, extern_type*& to_nxt) const + { +-#ifdef __APPLE__ + // look for first internal null in frm + const intern_type* fend = frm; + for (; fend != frm_end; ++fend) +@@ -1232,13 +1307,13 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st, + { + // save state in case needed to reover to_nxt on error + mbstate_t save_state = st; +- size_t n = wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l); ++ size_t n = with_locale::wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l); + if (n == size_t(-1)) + { + // need to recover to_nxt + for (to_nxt = to; frm != frm_nxt; ++frm) + { +- n = wcrtomb_l(to_nxt, *frm, &save_state, __l); ++ n = with_locale::wcrtomb_l(to_nxt, *frm, &save_state, __l); + if (n == size_t(-1)) + break; + to_nxt += n; +@@ -1255,7 +1330,7 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st, + { + // Try to write the terminating null + extern_type tmp[MB_LEN_MAX]; +- n = wcrtomb_l(tmp, intern_type(), &st, __l); ++ n = with_locale::wcrtomb_l(tmp, intern_type(), &st, __l); + if (n == size_t(-1)) // on error + return error; + if (n > to_end-to_nxt) // is there room? +@@ -1270,9 +1345,6 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st, + } + } + return frm_nxt == frm_end ? ok : partial; +-#else +- return error; +-#endif + } + + codecvt<wchar_t, char, mbstate_t>::result +@@ -1280,7 +1352,6 @@ codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st, + const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt, + intern_type* to, intern_type* to_end, intern_type*& to_nxt) const + { +-#ifdef __APPLE__ + // look for first internal null in frm + const extern_type* fend = frm; + for (; fend != frm_end; ++fend) +@@ -1292,13 +1363,13 @@ codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st, + { + // save state in case needed to reover to_nxt on error + mbstate_t save_state = st; +- size_t n = mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l); ++ size_t n = with_locale::mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l); + if (n == size_t(-1)) + { + // need to recover to_nxt + for (to_nxt = to; frm != frm_nxt; ++to_nxt) + { +- n = mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l); ++ n = with_locale::mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l); + switch (n) + { + case 0: +@@ -1326,7 +1397,7 @@ codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st, + if (fend != frm_end) // set up next null terminated sequence + { + // Try to write the terminating null +- n = mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l); ++ n = with_locale::mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l); + if (n != 0) // on error + return error; + ++to_nxt; +@@ -1338,19 +1409,15 @@ codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st, + } + } + return frm_nxt == frm_end ? ok : partial; +-#else +- return error; +-#endif + } + + codecvt<wchar_t, char, mbstate_t>::result + codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st, + extern_type* to, extern_type* to_end, extern_type*& to_nxt) const + { +-#ifdef __APPLE__ + to_nxt = to; + extern_type tmp[MB_LEN_MAX]; +- size_t n = wcrtomb_l(tmp, intern_type(), &st, __l); ++ size_t n = with_locale::wcrtomb_l(tmp, intern_type(), &st, __l); + if (n == size_t(-1) || n == 0) // on error + return error; + --n; +@@ -1359,26 +1426,19 @@ codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st, + for (extern_type* p = tmp; n; --n) // write it + *to_nxt++ = *p++; + return ok; +-#else +- return error; +-#endif + } + + int + codecvt<wchar_t, char, mbstate_t>::do_encoding() const _NOEXCEPT + { +-#ifdef __APPLE__ +- if (mbtowc_l(0, 0, MB_LEN_MAX, __l) == 0) ++ if (with_locale::mbtowc_l((wchar_t*) 0, (const char*) 0, MB_LEN_MAX, __l) == 0) + { + // stateless encoding +- if (__l == 0 || MB_CUR_MAX_L(__l) == 1) // there are no known constant length encodings ++ if (__l == 0 || with_locale::mb_cur_max_l(__l) == 1) // there are no known constant length encodings + return 1; // which take more than 1 char to form a wchar_t + return 0; + } + return -1; +-#else +- return 0; +-#endif + } + + bool +@@ -1391,11 +1451,10 @@ int + codecvt<wchar_t, char, mbstate_t>::do_length(state_type& st, + const extern_type* frm, const extern_type* frm_end, size_t mx) const + { +-#ifdef __APPLE__ + int nbytes = 0; + for (size_t nwchar_t = 0; nwchar_t < mx && frm != frm_end; ++nwchar_t) + { +- size_t n = mbrlen_l(frm, frm_end-frm, &st, __l); ++ size_t n = with_locale::mbrlen_l(frm, frm_end-frm, &st, __l); + switch (n) + { + case 0: +@@ -1412,19 +1471,12 @@ codecvt<wchar_t, char, mbstate_t>::do_length(state_type& st, + } + } + return nbytes; +-#else +- return 0; +-#endif + } + + int + codecvt<wchar_t, char, mbstate_t>::do_max_length() const _NOEXCEPT + { +-#ifdef __APPLE__ +- return __l == 0 ? 1 : MB_CUR_MAX_L(__l); +-#else +- return 0; +-#endif ++ return __l == 0 ? 1 : with_locale::mb_cur_max_l(__l); + } + + // Valid UTF ranges +@@ -3965,16 +4017,15 @@ numpunct_byname<char>::~numpunct_byname() + void + numpunct_byname<char>::__init(const char* nm) + { +-#ifdef __APPLE__ + if (strcmp(nm, "C") != 0) + { +- unique_ptr<_xlocale, int(*)(locale_t)> loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); ++ locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); + #ifndef _LIBCPP_NO_EXCEPTIONS + if (loc == 0) + throw runtime_error("numpunct_byname<char>::numpunct_byname" + " failed to construct for " + string(nm)); + #endif // _LIBCPP_NO_EXCEPTIONS +- lconv* lc = localeconv_l(loc.get()); ++ lconv* lc = with_locale::localeconv_l(loc.get()); + if (*lc->decimal_point) + __decimal_point_ = *lc->decimal_point; + if (*lc->thousands_sep) +@@ -3982,7 +4033,6 @@ numpunct_byname<char>::__init(const char* nm) + __grouping_ = lc->grouping; + // locallization for truename and falsename is not available + } +-#endif + } + + // numpunct_byname<wchar_t> +@@ -4006,16 +4056,15 @@ numpunct_byname<wchar_t>::~numpunct_byname() + void + numpunct_byname<wchar_t>::__init(const char* nm) + { +-#ifdef __APPLE__ + if (strcmp(nm, "C") != 0) + { +- unique_ptr<_xlocale, int(*)(locale_t)> loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); ++ locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); + #ifndef _LIBCPP_NO_EXCEPTIONS + if (loc == 0) + throw runtime_error("numpunct_byname<char>::numpunct_byname" + " failed to construct for " + string(nm)); + #endif // _LIBCPP_NO_EXCEPTIONS +- lconv* lc = localeconv_l(loc.get()); ++ lconv* lc = with_locale::localeconv_l(loc.get()); + if (*lc->decimal_point) + __decimal_point_ = *lc->decimal_point; + if (*lc->thousands_sep) +@@ -4023,7 +4072,6 @@ numpunct_byname<wchar_t>::__init(const char* nm) + __grouping_ = lc->grouping; + // locallization for truename and falsename is not available + } +-#endif + } + + // num_get helpers +@@ -4588,7 +4636,6 @@ template <> + wstring + __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct) + { +-#ifdef __APPLE__ + tm t; + t.tm_sec = 59; + t.tm_min = 55; +@@ -4608,7 +4655,7 @@ __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct) + wchar_t* wbb = wbuf; + mbstate_t mb = {0}; + const char* bb = buf; +- size_t i = mbsrtowcs_l(wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); ++ size_t i = with_locale::mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); + if (i == -1) + __throw_runtime_error("locale not supported"); + wchar_t* wbe = wbb + i; +@@ -4733,9 +4780,6 @@ __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct) + ++wbb; + } + return result; +-#else +- return wstring(); +-#endif + } + + template <> +@@ -4779,7 +4823,6 @@ template <> + void + __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) + { +-#ifdef __APPLE__ + tm t = {0}; + char buf[100]; + size_t be; +@@ -4793,7 +4836,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) + be = strftime_l(buf, 100, "%A", &t, __loc_); + mb = mbstate_t(); + const char* bb = buf; +- size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); ++ size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); + if (j == -1) + __throw_runtime_error("locale not supported"); + wbe = wbuf + j; +@@ -4801,7 +4844,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) + be = strftime_l(buf, 100, "%a", &t, __loc_); + mb = mbstate_t(); + bb = buf; +- j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); ++ j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); + if (j == -1) + __throw_runtime_error("locale not supported"); + wbe = wbuf + j; +@@ -4814,7 +4857,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) + be = strftime_l(buf, 100, "%B", &t, __loc_); + mb = mbstate_t(); + const char* bb = buf; +- size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); ++ size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); + if (j == -1) + __throw_runtime_error("locale not supported"); + wbe = wbuf + j; +@@ -4822,7 +4865,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) + be = strftime_l(buf, 100, "%b", &t, __loc_); + mb = mbstate_t(); + bb = buf; +- j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); ++ j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); + if (j == -1) + __throw_runtime_error("locale not supported"); + wbe = wbuf + j; +@@ -4833,7 +4876,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) + be = strftime_l(buf, 100, "%p", &t, __loc_); + mb = mbstate_t(); + const char* bb = buf; +- size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); ++ size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); + if (j == -1) + __throw_runtime_error("locale not supported"); + wbe = wbuf + j; +@@ -4842,7 +4885,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) + be = strftime_l(buf, 100, "%p", &t, __loc_); + mb = mbstate_t(); + bb = buf; +- j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); ++ j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); + if (j == -1) + __throw_runtime_error("locale not supported"); + wbe = wbuf + j; +@@ -4851,7 +4894,6 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) + __r_ = __analyze('r', ct); + __x_ = __analyze('x', ct); + __X_ = __analyze('X', ct); +-#endif + } + + template <class CharT> +@@ -5113,17 +5155,15 @@ void + __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, + char __fmt, char __mod) const + { +-#ifdef __APPLE__ + char __nar[100]; + char* __ne = __nar + 100; + __do_put(__nar, __ne, __tm, __fmt, __mod); + mbstate_t mb = {0}; + const char* __nb = __nar; +- size_t j = mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_); ++ size_t j = with_locale::mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_); + if (j == -1) + __throw_runtime_error("locale not supported"); + __we = __wb + j; +-#endif + } + + // moneypunct_byname +@@ -5368,15 +5408,14 @@ template<> + void + moneypunct_byname<char, false>::init(const char* nm) + { +-#ifdef __APPLE__ + typedef moneypunct<char, false> base; +- unique_ptr<_xlocale, int(*)(locale_t)> loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); ++ locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); + #ifndef _LIBCPP_NO_EXCEPTIONS + if (loc == 0) + throw runtime_error("moneypunct_byname" + " failed to construct for " + string(nm)); + #endif // _LIBCPP_NO_EXCEPTIONS +- lconv* lc = localeconv_l(loc.get()); ++ lconv* lc = with_locale::localeconv_l(loc.get()); + if (*lc->mon_decimal_point) + __decimal_point_ = *lc->mon_decimal_point; + else +@@ -5401,22 +5440,20 @@ moneypunct_byname<char, false>::init(const char* nm) + __negative_sign_ = lc->negative_sign; + __init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn); + __init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn); +-#endif + } + + template<> + void + moneypunct_byname<char, true>::init(const char* nm) + { +-#ifdef __APPLE__ + typedef moneypunct<char, true> base; +- unique_ptr<_xlocale, int(*)(locale_t)> loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); ++ locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); + #ifndef _LIBCPP_NO_EXCEPTIONS + if (loc == 0) + throw runtime_error("moneypunct_byname" + " failed to construct for " + string(nm)); + #endif // _LIBCPP_NO_EXCEPTIONS +- lconv* lc = localeconv_l(loc.get()); ++ lconv* lc = with_locale::localeconv_l(loc.get()); + if (*lc->mon_decimal_point) + __decimal_point_ = *lc->mon_decimal_point; + else +@@ -5441,22 +5478,20 @@ moneypunct_byname<char, true>::init(const char* nm) + __negative_sign_ = lc->negative_sign; + __init_pat(__pos_format_, lc->int_p_cs_precedes, lc->int_p_sep_by_space, lc->int_p_sign_posn); + __init_pat(__neg_format_, lc->int_n_cs_precedes, lc->int_n_sep_by_space, lc->int_n_sign_posn); +-#endif + } + + template<> + void + moneypunct_byname<wchar_t, false>::init(const char* nm) + { +-#ifdef __APPLE__ + typedef moneypunct<wchar_t, false> base; +- unique_ptr<_xlocale, int(*)(locale_t)> loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); ++ locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); + #ifndef _LIBCPP_NO_EXCEPTIONS + if (loc == 0) + throw runtime_error("moneypunct_byname" + " failed to construct for " + string(nm)); + #endif // _LIBCPP_NO_EXCEPTIONS +- lconv* lc = localeconv_l(loc.get()); ++ lconv* lc = with_locale::localeconv_l(loc.get()); + if (*lc->mon_decimal_point) + __decimal_point_ = static_cast<wchar_t>(*lc->mon_decimal_point); + else +@@ -5469,7 +5504,7 @@ moneypunct_byname<wchar_t, false>::init(const char* nm) + wchar_t wbuf[100]; + mbstate_t mb = {0}; + const char* bb = lc->currency_symbol; +- size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); ++ size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); + if (j == -1) + __throw_runtime_error("locale not supported"); + wchar_t* wbe = wbuf + j; +@@ -5484,7 +5519,7 @@ moneypunct_byname<wchar_t, false>::init(const char* nm) + { + mb = mbstate_t(); + bb = lc->positive_sign; +- j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); ++ j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); + if (j == -1) + __throw_runtime_error("locale not supported"); + wbe = wbuf + j; +@@ -5496,7 +5531,7 @@ moneypunct_byname<wchar_t, false>::init(const char* nm) + { + mb = mbstate_t(); + bb = lc->negative_sign; +- j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); ++ j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); + if (j == -1) + __throw_runtime_error("locale not supported"); + wbe = wbuf + j; +@@ -5504,22 +5539,20 @@ moneypunct_byname<wchar_t, false>::init(const char* nm) + } + __init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn); + __init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn); +-#endif + } + + template<> + void + moneypunct_byname<wchar_t, true>::init(const char* nm) + { +-#ifdef __APPLE__ + typedef moneypunct<wchar_t, true> base; +- unique_ptr<_xlocale, int(*)(locale_t)> loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); ++ locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); + #ifndef _LIBCPP_NO_EXCEPTIONS + if (loc == 0) + throw runtime_error("moneypunct_byname" + " failed to construct for " + string(nm)); + #endif // _LIBCPP_NO_EXCEPTIONS +- lconv* lc = localeconv_l(loc.get()); ++ lconv* lc = with_locale::localeconv_l(loc.get()); + if (*lc->mon_decimal_point) + __decimal_point_ = static_cast<wchar_t>(*lc->mon_decimal_point); + else +@@ -5532,7 +5565,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm) + wchar_t wbuf[100]; + mbstate_t mb = {0}; + const char* bb = lc->int_curr_symbol; +- size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); ++ size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); + if (j == -1) + __throw_runtime_error("locale not supported"); + wchar_t* wbe = wbuf + j; +@@ -5547,7 +5580,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm) + { + mb = mbstate_t(); + bb = lc->positive_sign; +- j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); ++ j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); + if (j == -1) + __throw_runtime_error("locale not supported"); + wbe = wbuf + j; +@@ -5559,7 +5592,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm) + { + mb = mbstate_t(); + bb = lc->negative_sign; +- j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); ++ j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); + if (j == -1) + __throw_runtime_error("locale not supported"); + wbe = wbuf + j; +@@ -5567,7 +5600,6 @@ moneypunct_byname<wchar_t, true>::init(const char* nm) + } + __init_pat(__pos_format_, lc->int_p_cs_precedes, lc->int_p_sep_by_space, lc->int_p_sign_posn); + __init_pat(__neg_format_, lc->int_n_cs_precedes, lc->int_n_sep_by_space, lc->int_n_sign_posn); +-#endif + } + + void __do_nothing(void*) {} |