[cfe-commits] [libcxx] r140734 - in /libcxx/trunk: include/__config include/__locale include/locale src/locale.cpp

Howard Hinnant hhinnant at apple.com
Wed Sep 28 16:39:34 PDT 2011


Author: hhinnant
Date: Wed Sep 28 18:39:33 2011
New Revision: 140734

URL: http://llvm.org/viewvc/llvm-project?rev=140734&view=rev
Log:
Attempted locale refactoring.  _LIBCPP_LOCALE__L_EXTENSIONS now should be defined if one has all of the xxx_l() functions.  I've defined this for apple, freebsd and win32.  _LIBCPP_HAS_DEFAULTRUNELOCALE should be defined if there is a _DefaultRuneLocale.  I've defined this for apple and freebsd.  The block of code we're trying to migrate away from is now under #ifdef __linux__.  I've tested only on OS X.  I hope I haven't broken things too badly elsewhere.  Please let me know.

Modified:
    libcxx/trunk/include/__config
    libcxx/trunk/include/__locale
    libcxx/trunk/include/locale
    libcxx/trunk/src/locale.cpp

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=140734&r1=140733&r2=140734&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Wed Sep 28 18:39:33 2011
@@ -309,8 +309,8 @@
 #define _LIBCPP_LOCALE__L_EXTENSIONS 1
 #endif
 
-#if __APPLE__ || _WIN32
-#define _LIBCPP_STABLE_APPLE_ABI
+#if __APPLE__ || __FreeBSD__
+#define _LIBCPP_HAS_DEFAULTRUNELOCALE
 #endif
 
 #if __APPLE__ || __FreeBSD__

Modified: libcxx/trunk/include/__locale
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__locale?rev=140734&r1=140733&r2=140734&view=diff
==============================================================================
--- libcxx/trunk/include/__locale (original)
+++ libcxx/trunk/include/__locale Wed Sep 28 18:39:33 2011
@@ -557,7 +557,7 @@
 #endif
     _LIBCPP_ALWAYS_INLINE const mask* table() const  _NOEXCEPT {return __tab_;}
     static const mask* classic_table()  _NOEXCEPT;
-#ifndef _LIBCPP_STABLE_APPLE_ABI
+#ifndef _LIBCPP_HAS_DEFAULTRUNELOCALE
     static const int* __classic_upper_table() _NOEXCEPT;
     static const int* __classic_lower_table() _NOEXCEPT;
 #endif

Modified: libcxx/trunk/include/locale
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/locale?rev=140734&r1=140733&r2=140734&view=diff
==============================================================================
--- libcxx/trunk/include/locale (original)
+++ libcxx/trunk/include/locale Wed Sep 28 18:39:33 2011
@@ -197,15 +197,13 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#ifndef _LIBCPP_STABLE_APPLE_ABI
-// Get the C locale object
-locale_t __cloc();
-#endif
-
-#if __APPLE__
+#if __APPLE__ || __FreeBSD__
 #  define _LIBCPP_GET_C_LOCALE 0
 #else
 #  define _LIBCPP_GET_C_LOCALE __cloc()
+   // Get the C locale object
+   locale_t __cloc();
+#define __cloc_defined
 #endif
 
 typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
@@ -215,7 +213,7 @@
 // OSX has nice foo_l() functions that let you turn off use of the global
 // locale.  Linux, not so much.  The following functions avoid the locale when
 // that's possible and otherwise do the wrong thing.  FIXME.
-#ifndef _LIBCPP_STABLE_APPLE_ABI
+#ifdef __linux__
 
 #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
 decltype(MB_CUR_MAX_L(_VSTD::declval<locale_t>()))
@@ -236,7 +234,7 @@
 _LIBCPP_ALWAYS_INLINE inline
 wint_t __btowc_l(int __c, locale_t __l)
 {
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
   return btowc_l(__c, __l);
 #else
   __locale_raii __current(uselocale(__l), uselocale);
@@ -403,7 +401,7 @@
   return __res;
 }
 
-#endif  // _LIBCPP_STABLE_APPLE_ABI
+#endif  // __linux__
 
 // __scan_keyword
 // Scans [__b, __e) until a match is found in the basic_strings range
@@ -1290,7 +1288,7 @@
             break;
     // Stage 3
     __a[sizeof(__a)-1] = 0;
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     if (sscanf_l(__a, _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1)
 #else
     if (__sscanf_l(__a, __cloc(), "%p", &__v) != 1)
@@ -1603,7 +1601,7 @@
                           + ((numeric_limits<long>::digits % 3) != 0)
                           + 1;
     char __nar[__nbuf];
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v);
 #else
     int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
@@ -1633,7 +1631,7 @@
                           + ((numeric_limits<long long>::digits % 3) != 0)
                           + 1;
     char __nar[__nbuf];
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v);
 #else
     int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
@@ -1663,7 +1661,7 @@
                           + ((numeric_limits<unsigned long>::digits % 3) != 0)
                           + 1;
     char __nar[__nbuf];
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v);
 #else
     int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
@@ -1693,7 +1691,7 @@
                           + ((numeric_limits<unsigned long long>::digits % 3) != 0)
                           + 1;
     char __nar[__nbuf];
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v);
 #else
     int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
@@ -1724,7 +1722,7 @@
     char* __nb = __nar;
     int __nc;
     if (__specify_precision)
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         __nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
                                    (int)__iob.precision(), __v);
 #else
@@ -1732,7 +1730,7 @@
                             (int)__iob.precision(), __v);
 #endif
     else
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         __nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
 #else
         __nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v);
@@ -1741,14 +1739,14 @@
     if (__nc > static_cast<int>(__nbuf-1))
     {
         if (__specify_precision)
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
             __nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
 #else
             __nc = __asprintf_l(&__nb, __cloc(), __fmt,
                               (int)__iob.precision(), __v);
 #endif
         else
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
             __nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
 #else
             __nc = __asprintf_l(&__nb, __cloc(), __fmt, (int)__iob.precision(), __v);
@@ -1793,7 +1791,7 @@
     char* __nb = __nar;
     int __nc;
     if (__specify_precision)
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         __nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
                                    (int)__iob.precision(), __v);
 #else
@@ -1801,7 +1799,7 @@
                             (int)__iob.precision(), __v);
 #endif
     else
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         __nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
 #else
         __nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v);
@@ -1810,14 +1808,14 @@
     if (__nc > static_cast<int>(__nbuf-1))
     {
         if (__specify_precision)
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
             __nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
 #else
             __nc = __asprintf_l(&__nb, __cloc(), __fmt,
                               (int)__iob.precision(), __v);
 #endif
         else
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
             __nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
 #else
             __nc = __asprintf_l(&__nb, __cloc(), __fmt, __v);
@@ -1857,7 +1855,7 @@
     char __fmt[6] = "%p";
     const unsigned __nbuf = 20;
     char __nar[__nbuf];
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v);
 #else
     int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
@@ -3541,7 +3539,7 @@
     // secure memory for digit storage
     if (__n > __bs-1)
     {
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         __n = asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units);
 #else
         __n = __asprintf_l(&__bb, __cloc(), "%.0Lf", __units);

Modified: libcxx/trunk/src/locale.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/locale.cpp?rev=140734&r1=140733&r2=140734&view=diff
==============================================================================
--- libcxx/trunk/src/locale.cpp (original)
+++ libcxx/trunk/src/locale.cpp Wed Sep 28 18:39:33 2011
@@ -26,32 +26,17 @@
 #endif // _!WIN32
 #include <stdlib.h>
 
-#ifdef _LIBCPP_STABLE_APPLE_ABI
-namespace {
-  decltype(MB_CUR_MAX_L(_VSTD::declval<locale_t>()))
-  inline _LIBCPP_INLINE_VISIBILITY
-  mb_cur_max_l(locale_t loc)
-  {
-    return MB_CUR_MAX_L(loc);
-  }
-}
-#endif
-
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#ifndef _LIBCPP_STABLE_APPLE_ABI
+#ifdef __cloc_defined
 locale_t __cloc() {
   // In theory this could create a race condition. In practice
   // the race condition is non-fatal since it will just create
   // a little resource leak. Better approach would be appreciated.
-#ifdef __APPLE__
-  return 0;
-#else
   static locale_t result = newlocale(LC_ALL_MASK, "C", 0);
   return result;
-#endif
 }
-#endif // _LIBCPP_STABLE_APPLE_ABI
+#endif // __cloc_defined
 
 namespace {
 
@@ -737,7 +722,7 @@
 wchar_t
 ctype<wchar_t>::do_toupper(char_type c) const
 {
-#if !(defined(_LIBCPP_STABLE_APPLE_ABI) || defined(__FreeBSD__))
+#ifndef _LIBCPP_HAS_DEFAULTRUNELOCALE
     return isascii(c) ? ctype<char>::__classic_upper_table()[c] : c;
 #else
     return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
@@ -748,7 +733,7 @@
 ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const
 {
     for (; low != high; ++low)
-#if !(defined(_LIBCPP_STABLE_APPLE_ABI) || defined(__FreeBSD__))
+#ifndef _LIBCPP_HAS_DEFAULTRUNELOCALE
         *low = isascii(*low) ? ctype<char>::__classic_upper_table()[*low]
                              : *low;
 #else
@@ -760,7 +745,7 @@
 wchar_t
 ctype<wchar_t>::do_tolower(char_type c) const
 {
-#ifndef _LIBCPP_STABLE_APPLE_ABI
+#ifndef _LIBCPP_HAS_DEFAULTRUNELOCALE
     return isascii(c) ? ctype<char>::__classic_lower_table()[c] : c;
 #else
     return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
@@ -771,7 +756,7 @@
 ctype<wchar_t>::do_tolower(char_type* low, const char_type* high) const
 {
     for (; low != high; ++low)
-#ifndef _LIBCPP_STABLE_APPLE_ABI
+#ifndef _LIBCPP_HAS_DEFAULTRUNELOCALE
         *low = isascii(*low) ? ctype<char>::__classic_lower_table()[*low]
                              : *low;
 #else
@@ -835,7 +820,7 @@
 char
 ctype<char>::do_toupper(char_type c) const
 {
-#ifndef _LIBCPP_STABLE_APPLE_ABI
+#ifndef _LIBCPP_HAS_DEFAULTRUNELOCALE
     return isascii(c) ? __classic_upper_table()[c] : c;
 #else
     return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
@@ -846,7 +831,7 @@
 ctype<char>::do_toupper(char_type* low, const char_type* high) const
 {
     for (; low != high; ++low)
-#ifndef _LIBCPP_STABLE_APPLE_ABI
+#ifndef _LIBCPP_HAS_DEFAULTRUNELOCALE
         *low = isascii(*low) ? __classic_upper_table()[*low] : *low;
 #else
         *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
@@ -857,7 +842,7 @@
 char
 ctype<char>::do_tolower(char_type c) const
 {
-#ifndef _LIBCPP_STABLE_APPLE_ABI
+#ifndef _LIBCPP_HAS_DEFAULTRUNELOCALE
     return isascii(c) ? __classic_lower_table()[c] : c;
 #else
     return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
@@ -868,7 +853,7 @@
 ctype<char>::do_tolower(char_type* low, const char_type* high) const
 {
     for (; low != high; ++low)
-#ifndef _LIBCPP_STABLE_APPLE_ABI
+#ifndef _LIBCPP_HAS_DEFAULTRUNELOCALE
         *low = isascii(*low) ? __classic_lower_table()[*low] : *low;
 #else
         *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
@@ -923,7 +908,7 @@
 #endif
 }
 
-#ifndef _LIBCPP_STABLE_APPLE_ABI
+#ifndef _LIBCPP_HAS_DEFAULTRUNELOCALE
 const int*
 ctype<char>::__classic_lower_table() _NOEXCEPT
 {
@@ -947,7 +932,7 @@
     return NULL;
 #endif
 }
-#endif // _LIBCPP_STABLE_APPLE_ABI
+#endif // _LIBCPP_HAS_DEFAULTRUNELOCALE
 
 // template <> class ctype_byname<char>
 
@@ -1170,7 +1155,7 @@
 wchar_t
 ctype_byname<wchar_t>::do_widen(char c) const
 {
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     return btowc_l(c, __l);
 #else
     return __btowc_l(c, __l);
@@ -1181,7 +1166,7 @@
 ctype_byname<wchar_t>::do_widen(const char* low, const char* high, char_type* dest) const
 {
     for (; low != high; ++low, ++dest)
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         *dest = btowc_l(*low, __l);
 #else
         *dest = __btowc_l(*low, __l);
@@ -1192,7 +1177,7 @@
 char
 ctype_byname<wchar_t>::do_narrow(char_type c, char dfault) const
 {
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     int r = wctob_l(c, __l);
 #else
     int r = __wctob_l(c, __l);
@@ -1205,7 +1190,7 @@
 {
     for (; low != high; ++low, ++dest)
     {
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         int r = wctob_l(*low, __l);
 #else
         int r = __wctob_l(*low, __l);
@@ -1319,7 +1304,7 @@
     {
         // save state in case needed to reover to_nxt on error
         mbstate_t save_state = st;
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         size_t n = wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
 #else
         size_t n = __wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
@@ -1329,7 +1314,7 @@
             // need to recover to_nxt
             for (to_nxt = to; frm != frm_nxt; ++frm)
             {
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
                 n = wcrtomb_l(to_nxt, *frm, &save_state, __l);
 #else
                 n = __wcrtomb_l(to_nxt, *frm, &save_state, __l);
@@ -1350,7 +1335,7 @@
         {
             // Try to write the terminating null
             extern_type tmp[MB_LEN_MAX];
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
             n = wcrtomb_l(tmp, intern_type(), &st, __l);
 #else
             n = __wcrtomb_l(tmp, intern_type(), &st, __l);
@@ -1387,7 +1372,7 @@
     {
         // save state in case needed to reover to_nxt on error
         mbstate_t save_state = st;
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         size_t n = mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
 #else
         size_t n = __mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
@@ -1397,7 +1382,7 @@
             // need to recover to_nxt
             for (to_nxt = to; frm != frm_nxt; ++to_nxt)
             {
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
                 n = mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l);
 #else
                 n = __mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l);
@@ -1429,7 +1414,7 @@
         if (fend != frm_end)  // set up next null terminated sequence
         {
             // Try to write the terminating null
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
             n = mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l);
 #else
             n = __mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l);
@@ -1453,7 +1438,7 @@
 {
     to_nxt = to;
     extern_type tmp[MB_LEN_MAX];
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     size_t n = wcrtomb_l(tmp, intern_type(), &st, __l);
 #else
     size_t n = __wcrtomb_l(tmp, intern_type(), &st, __l);
@@ -1471,14 +1456,14 @@
 int
 codecvt<wchar_t, char, mbstate_t>::do_encoding() const  _NOEXCEPT
 {
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     if (mbtowc_l((wchar_t*) 0, (const char*) 0, MB_LEN_MAX, __l) == 0)
 #else
     if (__mbtowc_l((wchar_t*) 0, (const char*) 0, MB_LEN_MAX, __l) == 0)
 #endif
     {
         // stateless encoding
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         if (__l == 0 || MB_CUR_MAX_L(__l) == 1)  // there are no known constant length encodings
 #else
         if (__l == 0 || __mb_cur_max_l(__l) == 1)  // there are no known constant length encodings
@@ -1502,7 +1487,7 @@
     int nbytes = 0;
     for (size_t nwchar_t = 0; nwchar_t < mx && frm != frm_end; ++nwchar_t)
     {
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         size_t n = mbrlen_l(frm, frm_end-frm, &st, __l);
 #else
         size_t n = __mbrlen_l(frm, frm_end-frm, &st, __l);
@@ -1528,7 +1513,7 @@
 int
 codecvt<wchar_t, char, mbstate_t>::do_max_length() const  _NOEXCEPT
 {
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     return __l == 0 ? 1 : MB_CUR_MAX_L(__l);
 #else
     return __l == 0 ? 1 : __mb_cur_max_l(__l);
@@ -4081,7 +4066,7 @@
             throw runtime_error("numpunct_byname<char>::numpunct_byname"
                                 " failed to construct for " + string(nm));
 #endif  // _LIBCPP_NO_EXCEPTIONS
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         lconv* lc = localeconv_l(loc.get());
 #else
         lconv* lc = __localeconv_l(loc.get());
@@ -4124,7 +4109,7 @@
             throw runtime_error("numpunct_byname<char>::numpunct_byname"
                                 " failed to construct for " + string(nm));
 #endif  // _LIBCPP_NO_EXCEPTIONS
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         lconv* lc = localeconv_l(loc.get());
 #else
         lconv* lc = __localeconv_l(loc.get());
@@ -4719,7 +4704,7 @@
     wchar_t* wbb = wbuf;
     mbstate_t mb = {0};
     const char* bb = buf;
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     size_t i = mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
 #else
     size_t i = __mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
@@ -4904,7 +4889,7 @@
         be = strftime_l(buf, 100, "%A", &t, __loc_);
         mb = mbstate_t();
         const char* bb = buf;
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
 #else
         size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
@@ -4916,7 +4901,7 @@
         be = strftime_l(buf, 100, "%a", &t, __loc_);
         mb = mbstate_t();
         bb = buf;
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
 #else
         j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
@@ -4933,7 +4918,7 @@
         be = strftime_l(buf, 100, "%B", &t, __loc_);
         mb = mbstate_t();
         const char* bb = buf;
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
 #else
         size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
@@ -4945,7 +4930,7 @@
         be = strftime_l(buf, 100, "%b", &t, __loc_);
         mb = mbstate_t();
         bb = buf;
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
 #else
         j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
@@ -4960,7 +4945,7 @@
     be = strftime_l(buf, 100, "%p", &t, __loc_);
     mb = mbstate_t();
     const char* bb = buf;
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
 #else
     size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
@@ -4973,7 +4958,7 @@
     be = strftime_l(buf, 100, "%p", &t, __loc_);
     mb = mbstate_t();
     bb = buf;
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
 #else
     j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
@@ -5252,7 +5237,7 @@
     __do_put(__nar, __ne, __tm, __fmt, __mod);
     mbstate_t mb = {0};
     const char* __nb = __nar;
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     size_t j = mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_);
 #else
     size_t j = __mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_);
@@ -5511,7 +5496,7 @@
         throw runtime_error("moneypunct_byname"
                             " failed to construct for " + string(nm));
 #endif  // _LIBCPP_NO_EXCEPTIONS
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     lconv* lc = localeconv_l(loc.get());
 #else
     lconv* lc = __localeconv_l(loc.get());
@@ -5553,7 +5538,7 @@
         throw runtime_error("moneypunct_byname"
                             " failed to construct for " + string(nm));
 #endif  // _LIBCPP_NO_EXCEPTIONS
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     lconv* lc = localeconv_l(loc.get());
 #else
     lconv* lc = __localeconv_l(loc.get());
@@ -5608,7 +5593,7 @@
         throw runtime_error("moneypunct_byname"
                             " failed to construct for " + string(nm));
 #endif  // _LIBCPP_NO_EXCEPTIONS
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     lconv* lc = localeconv_l(loc.get());
 #else
     lconv* lc = __localeconv_l(loc.get());
@@ -5625,7 +5610,7 @@
     wchar_t wbuf[100];
     mbstate_t mb = {0};
     const char* bb = lc->currency_symbol;
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
 #else
     size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
@@ -5644,7 +5629,7 @@
     {
         mb = mbstate_t();
         bb = lc->positive_sign;
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
 #else
         j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
@@ -5660,7 +5645,7 @@
     {
         mb = mbstate_t();
         bb = lc->negative_sign;
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
 #else
         j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
@@ -5685,7 +5670,7 @@
         throw runtime_error("moneypunct_byname"
                             " failed to construct for " + string(nm));
 #endif  // _LIBCPP_NO_EXCEPTIONS
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     lconv* lc = localeconv_l(loc.get());
 #else
     lconv* lc = __localeconv_l(loc.get());
@@ -5702,7 +5687,7 @@
     wchar_t wbuf[100];
     mbstate_t mb = {0};
     const char* bb = lc->int_curr_symbol;
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
 #else
     size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
@@ -5725,7 +5710,7 @@
     {
         mb = mbstate_t();
         bb = lc->positive_sign;
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
 #else
         j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
@@ -5745,7 +5730,7 @@
     {
         mb = mbstate_t();
         bb = lc->negative_sign;
-#ifdef _LIBCPP_STABLE_APPLE_ABI
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
         j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
 #else
         j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());





More information about the cfe-commits mailing list