summaryrefslogtreecommitdiffstats
path: root/contrib/libc++/include/locale
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2016-12-26 20:36:37 +0000
committerdim <dim@FreeBSD.org>2016-12-26 20:36:37 +0000
commit06210ae42d418d50d8d9365d5c9419308ae9e7ee (patch)
treeab60b4cdd6e430dda1f292a46a77ddb744723f31 /contrib/libc++/include/locale
parent2dd166267f53df1c3748b4325d294b9b839de74b (diff)
downloadFreeBSD-src-06210ae42d418d50d8d9365d5c9419308ae9e7ee.zip
FreeBSD-src-06210ae42d418d50d8d9365d5c9419308ae9e7ee.tar.gz
MFC r309124:
Upgrade our copies of clang, llvm, lldb, compiler-rt and libc++ to 3.9.0 release, and add lld 3.9.0. Also completely revamp the build system for clang, llvm, lldb and their related tools. Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11 support to build; see UPDATING for more information. Release notes for llvm, clang and lld are available here: <http://llvm.org/releases/3.9.0/docs/ReleaseNotes.html> <http://llvm.org/releases/3.9.0/tools/clang/docs/ReleaseNotes.html> <http://llvm.org/releases/3.9.0/tools/lld/docs/ReleaseNotes.html> Thanks to Ed Maste, Bryan Drewery, Andrew Turner, Antoine Brodin and Jan Beich for their help. Relnotes: yes MFC r309147: Pull in r282174 from upstream llvm trunk (by Krzysztof Parzyszek): [PPC] Set SP after loading data from stack frame, if no red zone is present Follow-up to r280705: Make sure that the SP is only restored after all data is loaded from the stack frame, if there is no red zone. This completes the fix for https://llvm.org/bugs/show_bug.cgi?id=26519. Differential Revision: https://reviews.llvm.org/D24466 Reported by: Mark Millard PR: 214433 MFC r309149: Pull in r283060 from upstream llvm trunk (by Hal Finkel): [PowerPC] Refactor soft-float support, and enable PPC64 soft float This change enables soft-float for PowerPC64, and also makes soft-float disable all vector instruction sets for both 32-bit and 64-bit modes. This latter part is necessary because the PPC backend canonicalizes many Altivec vector types to floating-point types, and so soft-float breaks scalarization support for many operations. Both for embedded targets and for operating-system kernels desiring soft-float support, it seems reasonable that disabling hardware floating-point also disables vector instructions (embedded targets without hardware floating point support are unlikely to have Altivec, etc. and operating system kernels desiring not to use floating-point registers to lower syscall cost are unlikely to want to use vector registers either). If someone needs this to work, we'll need to change the fact that we promote many Altivec operations to act on v4f32. To make it possible to disable Altivec when soft-float is enabled, hardware floating-point support needs to be expressed as a positive feature, like the others, and not a negative feature, because target features cannot have dependencies on the disabling of some other feature. So +soft-float has now become -hard-float. Fixes PR26970. Pull in r283061 from upstream clang trunk (by Hal Finkel): [PowerPC] Enable soft-float for PPC64, and +soft-float -> -hard-float Enable soft-float support on PPC64, as the backend now supports it. Also, the backend now uses -hard-float instead of +soft-float, so set the target features accordingly. Fixes PR26970. Reported by: Mark Millard PR: 214433 MFC r309212: Add a few missed clang 3.9.0 files to OptionalObsoleteFiles. MFC r309262: Fix packaging for clang, lldb and lld 3.9.0 During the upgrade of clang/llvm etc to 3.9.0 in r309124, the PACKAGE directive in the usr.bin/clang/*.mk files got dropped accidentally. Restore it, with a few minor changes and additions: * Correct license in clang.ucl to NCSA * Add PACKAGE=clang for clang and most of the "ll" tools * Put lldb in its own package * Put lld in its own package Reviewed by: gjb, jmallett Differential Revision: https://reviews.freebsd.org/D8666 MFC r309656: During the bootstrap phase, when building the minimal llvm library on PowerPC, add lib/Support/Atomic.cpp. This is needed because upstream llvm revision r271821 disabled the use of std::call_once, which causes some fallback functions from Atomic.cpp to be used instead. Reported by: Mark Millard PR: 214902 MFC r309835: Tentatively apply https://reviews.llvm.org/D18730 to work around gcc PR 70528 (bogus error: constructor required before non-static data member). This should fix buildworld with the external gcc package. Reported by: https://jenkins.freebsd.org/job/FreeBSD_HEAD_amd64_gcc/ MFC r310194: Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to 3.9.1 release. Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11 support to build; see UPDATING for more information. Release notes for llvm, clang and lld will be available here: <http://releases.llvm.org/3.9.1/docs/ReleaseNotes.html> <http://releases.llvm.org/3.9.1/tools/clang/docs/ReleaseNotes.html> <http://releases.llvm.org/3.9.1/tools/lld/docs/ReleaseNotes.html> Relnotes: yes
Diffstat (limited to 'contrib/libc++/include/locale')
-rw-r--r--contrib/libc++/include/locale316
1 files changed, 51 insertions, 265 deletions
diff --git a/contrib/libc++/include/locale b/contrib/libc++/include/locale
index 84cb5a5..3d804e8 100644
--- a/contrib/libc++/include/locale
+++ b/contrib/libc++/include/locale
@@ -180,6 +180,7 @@ template <class charT> class messages_byname;
#include <__config>
#include <__locale>
+#include <__debug>
#include <algorithm>
#include <memory>
#include <ios>
@@ -213,6 +214,12 @@ template <class charT> class messages_byname;
#pragma GCC system_header
#endif
+#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
+#include <__bsd_locale_defaults.h>
+#else
+#include <__bsd_locale_fallbacks.h>
+#endif
+
_LIBCPP_BEGIN_NAMESPACE_STD
#if defined(__APPLE__) || defined(__FreeBSD__)
@@ -228,189 +235,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
typedef _VSTD::unique_ptr<__locale_struct, decltype(&freelocale)> __locale_unique_ptr;
-#ifndef _LIBCPP_LOCALE__L_EXTENSIONS
-typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
-#endif
-
-// 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.
-#if defined(__linux__) || defined(__EMSCRIPTEN__) || defined(_AIX) || \
- defined(_NEWLIB_VERSION) || defined(__GLIBC__)
-
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
-decltype(MB_CUR_MAX_L(_VSTD::declval<locale_t>()))
-inline _LIBCPP_INLINE_VISIBILITY
-__mb_cur_max_l(locale_t __l)
-{
- return MB_CUR_MAX_L(__l);
-}
-#else // _LIBCPP_LOCALE__L_EXTENSIONS
-inline _LIBCPP_ALWAYS_INLINE
-decltype(MB_CUR_MAX) __mb_cur_max_l(locale_t __l)
-{
- __locale_raii __current(uselocale(__l), uselocale);
- return MB_CUR_MAX;
-}
-#endif // _LIBCPP_LOCALE__L_EXTENSIONS
-
-inline _LIBCPP_ALWAYS_INLINE
-wint_t __btowc_l(int __c, locale_t __l)
-{
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- return btowc_l(__c, __l);
-#else
- __locale_raii __current(uselocale(__l), uselocale);
- return btowc(__c);
-#endif
-}
-
-inline _LIBCPP_ALWAYS_INLINE
-int __wctob_l(wint_t __c, locale_t __l)
-{
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- return wctob_l(__c, __l);
-#else
- __locale_raii __current(uselocale(__l), uselocale);
- return wctob(__c);
-#endif
-}
-
-inline _LIBCPP_ALWAYS_INLINE
-size_t __wcsnrtombs_l(char *__dest, const wchar_t **__src, size_t __nwc,
- size_t __len, mbstate_t *__ps, locale_t __l)
-{
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- return wcsnrtombs_l(__dest, __src, __nwc, __len, __ps, __l);
-#else
- __locale_raii __current(uselocale(__l), uselocale);
- return wcsnrtombs(__dest, __src, __nwc, __len, __ps);
-#endif
-}
-
-inline _LIBCPP_ALWAYS_INLINE
-size_t __wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l)
-{
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- return wcrtomb_l(__s, __wc, __ps, __l);
-#else
- __locale_raii __current(uselocale(__l), uselocale);
- return wcrtomb(__s, __wc, __ps);
-#endif
-}
-
-inline _LIBCPP_ALWAYS_INLINE
-size_t __mbsnrtowcs_l(wchar_t * __dest, const char **__src, size_t __nms,
- size_t __len, mbstate_t *__ps, locale_t __l)
-{
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- return mbsnrtowcs_l(__dest, __src, __nms, __len, __ps, __l);
-#else
- __locale_raii __current(uselocale(__l), uselocale);
- return mbsnrtowcs(__dest, __src, __nms, __len, __ps);
-#endif
-}
-
-inline _LIBCPP_ALWAYS_INLINE
-size_t __mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n,
- mbstate_t *__ps, locale_t __l)
-{
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- return mbrtowc_l(__pwc, __s, __n, __ps, __l);
-#else
- __locale_raii __current(uselocale(__l), uselocale);
- return mbrtowc(__pwc, __s, __n, __ps);
-#endif
-}
-
-inline _LIBCPP_ALWAYS_INLINE
-int __mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l)
-{
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- return mbtowc_l(__pwc, __pmb, __max, __l);
-#else
- __locale_raii __current(uselocale(__l), uselocale);
- return mbtowc(__pwc, __pmb, __max);
-#endif
-}
-
-inline _LIBCPP_ALWAYS_INLINE
-size_t __mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l)
-{
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- return mbrlen_l(__s, __n, __ps, __l);
-#else
- __locale_raii __current(uselocale(__l), uselocale);
- return mbrlen(__s, __n, __ps);
-#endif
-}
-
-inline _LIBCPP_ALWAYS_INLINE
-lconv *__localeconv_l(locale_t __l)
-{
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- return localeconv_l(__l);
-#else
- __locale_raii __current(uselocale(__l), uselocale);
- return localeconv();
-#endif
-}
-
-inline _LIBCPP_ALWAYS_INLINE
-size_t __mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len,
- mbstate_t *__ps, locale_t __l)
-{
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- return mbsrtowcs_l(__dest, __src, __len, __ps, __l);
-#else
- __locale_raii __current(uselocale(__l), uselocale);
- return mbsrtowcs(__dest, __src, __len, __ps);
-#endif
-}
-
-inline
-int __snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) {
- va_list __va;
- va_start(__va, __format);
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- int __res = vsnprintf_l(__s, __n, __l, __format, __va);
-#else
- __locale_raii __current(uselocale(__l), uselocale);
- int __res = vsnprintf(__s, __n, __format, __va);
-#endif
- va_end(__va);
- return __res;
-}
-
-inline
-int __asprintf_l(char **__s, locale_t __l, const char *__format, ...) {
- va_list __va;
- va_start(__va, __format);
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- int __res = vasprintf_l(__s, __l, __format, __va);
-#else
- __locale_raii __current(uselocale(__l), uselocale);
- int __res = vasprintf(__s, __format, __va);
-#endif
- va_end(__va);
- return __res;
-}
-
-inline
-int __sscanf_l(const char *__s, locale_t __l, const char *__format, ...) {
- va_list __va;
- va_start(__va, __format);
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- int __res = vsscanf_l(__s, __l, __format, __va);
-#else
- __locale_raii __current(uselocale(__l), uselocale);
- int __res = vsscanf(__s, __format, __va);
-#endif
- va_end(__va);
- return __res;
-}
-
-#endif // __linux__
// __scan_keyword
// Scans [__b, __e) until a match is found in the basic_strings range
@@ -933,6 +757,28 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
}
template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
+_Tp __do_strtod(const char* __a, char** __p2);
+
+template <>
+inline _LIBCPP_INLINE_VISIBILITY
+float __do_strtod<float>(const char* __a, char** __p2) {
+ return strtof_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
+}
+
+template <>
+inline _LIBCPP_INLINE_VISIBILITY
+double __do_strtod<double>(const char* __a, char** __p2) {
+ return strtod_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
+}
+
+template <>
+inline _LIBCPP_INLINE_VISIBILITY
+long double __do_strtod<long double>(const char* __a, char** __p2) {
+ return strtold_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
+}
+
+template <class _Tp>
_Tp
__num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err)
{
@@ -941,7 +787,7 @@ __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err)
typename remove_reference<decltype(errno)>::type __save_errno = errno;
errno = 0;
char *__p2;
- long double __ld = strtold_l(__a, &__p2, _LIBCPP_GET_C_LOCALE);
+ _Tp __ld = __do_strtod<_Tp>(__a, &__p2);
typename remove_reference<decltype(errno)>::type __current_errno = errno;
if (__current_errno == 0)
errno = __save_errno;
@@ -952,7 +798,7 @@ __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err)
}
else if (__current_errno == ERANGE)
__err = ios_base::failbit;
- return static_cast<_Tp>(__ld);
+ return __ld;
}
__err = ios_base::failbit;
return 0;
@@ -1188,11 +1034,7 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
}
// Stage 3
__buf.resize(__a_end - __a);
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- if (sscanf_l(__buf.c_str(), _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1)
-#else
- if (__sscanf_l(__buf.c_str(), _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1)
-#endif
+ if (__libcpp_sscanf_l(__buf.c_str(), _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1)
__err = ios_base::failbit;
// EOF checked
if (__b == __e)
@@ -1556,13 +1398,9 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
this->__format_int(__fmt+1, __len, true, __iob.flags());
const unsigned __nbuf = (numeric_limits<long>::digits / 3)
+ ((numeric_limits<long>::digits % 3) != 0)
- + 1;
+ + 2;
char __nar[__nbuf];
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
-#else
- int __nc = __snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
-#endif
+ int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar while adding thousands separators
@@ -1588,11 +1426,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+ ((numeric_limits<long long>::digits % 3) != 0)
+ 2;
char __nar[__nbuf];
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
-#else
- int __nc = __snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
-#endif
+ int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar while adding thousands separators
@@ -1618,11 +1452,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+ ((numeric_limits<unsigned long>::digits % 3) != 0)
+ 1;
char __nar[__nbuf];
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
-#else
- int __nc = __snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
-#endif
+ int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar while adding thousands separators
@@ -1648,11 +1478,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+ ((numeric_limits<unsigned long long>::digits % 3) != 0)
+ 1;
char __nar[__nbuf];
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
-#else
- int __nc = __snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
-#endif
+ int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar while adding thousands separators
@@ -1679,34 +1505,17 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
char* __nb = __nar;
int __nc;
if (__specify_precision)
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- __nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
+ __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
(int)__iob.precision(), __v);
-#else
- __nc = __snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
- (int)__iob.precision(), __v);
-#endif
else
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- __nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
-#else
- __nc = __snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
-#endif
+ __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
unique_ptr<char, void(*)(void*)> __nbh(0, free);
if (__nc > static_cast<int>(__nbuf-1))
{
if (__specify_precision)
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- __nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
-#else
- __nc = __asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
-#endif
+ __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
else
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- __nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
-#else
- __nc = __asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
-#endif
+ __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
if (__nb == 0)
__throw_bad_alloc();
__nbh.reset(__nb);
@@ -1747,34 +1556,17 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
char* __nb = __nar;
int __nc;
if (__specify_precision)
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- __nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
- (int)__iob.precision(), __v);
-#else
- __nc = __snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
+ __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
(int)__iob.precision(), __v);
-#endif
else
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- __nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
-#else
- __nc = __snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
-#endif
+ __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
unique_ptr<char, void(*)(void*)> __nbh(0, free);
if (__nc > static_cast<int>(__nbuf-1))
{
if (__specify_precision)
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- __nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
-#else
- __nc = __asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
-#endif
+ __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
else
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- __nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
-#else
- __nc = __asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
-#endif
+ __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
if (__nb == 0)
__throw_bad_alloc();
__nbh.reset(__nb);
@@ -1810,11 +1602,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
char __fmt[6] = "%p";
const unsigned __nbuf = 20;
char __nar[__nbuf];
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
-#else
- int __nc = __snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
-#endif
+ int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar
@@ -3526,11 +3314,7 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
// secure memory for digit storage
if (__n > __bs-1)
{
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- __n = static_cast<size_t>(asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units));
-#else
- __n = __asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units);
-#endif
+ __n = static_cast<size_t>(__libcpp_asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units));
if (__bb == 0)
__throw_bad_alloc();
__hn.reset(__bb);
@@ -3850,7 +3634,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
: __byte_err_string_(_VSTD::move(__wc.__byte_err_string_)),
__wide_err_string_(_VSTD::move(__wc.__wide_err_string_)),
__cvtptr_(__wc.__cvtptr_),
- __cvtstate_(__wc.__cvtstate_), __cvtcount_(__wc.__cvtstate_)
+ __cvtstate_(__wc.__cvtstate_), __cvtcount_(__wc.__cvtcount_)
{
__wc.__cvtptr_ = nullptr;
}
@@ -4140,7 +3924,9 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow()
}
else
{
- memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
+ _LIBCPP_ASSERT(!(__extbufnext_ == NULL && (__extbufend_ != __extbufnext_)), "underflow moving from NULL" );
+ if (__extbufend_ != __extbufnext_)
+ memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
streamsize __nmemb = _VSTD::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
OpenPOWER on IntegriCloud