Compare commits

..

3 Commits

Author SHA1 Message Date
Howard Hinnant
474be15134 Correct spelling _LIBCPP_STABLE_APPLE_ABI
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/apple25@136614 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-01 13:39:41 +00:00
Howard Hinnant
fbb2b54c17 branch off of libcpp-25
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/apple25@136613 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-01 13:34:00 +00:00
Howard Hinnant
0e1f6f5856 Tagging 25
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/tags/libcpp-25@135270 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 13:52:54 +00:00
49 changed files with 523 additions and 863 deletions

View File

@@ -20,4 +20,3 @@ D: Minor patches and bug fixes.
N: Bjorn Reese
E: breese@users.sourceforge.net
D: Initial regex prototype

View File

@@ -29,34 +29,13 @@ clean::
installhdrs::
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/*
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext/*
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/ext
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/include
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/*
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/ext
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/ext/*
install:: installhdrs $(DESTDIR)

View File

@@ -146,9 +146,6 @@ typedef __char32_t char32_t;
#if !(__has_feature(cxx_auto_type))
#define _LIBCPP_HAS_NO_AUTO_TYPE
#endif
#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#endif
@@ -191,10 +188,6 @@ namespace std {
# define _NOEXCEPT_(x)
#endif
#if __has_feature(underlying_type)
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
#endif
// end defined(__clang__)
#elif defined(__GNUC__)
@@ -292,10 +285,6 @@ template <unsigned> struct __static_assert_check {};
#define __has_feature(__x) 0
#endif
#ifdef __APPLE__
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
#endif
#ifdef __APPLE__
#define _LIBCPP_STABLE_APPLE_ABI
#endif

View File

@@ -432,10 +432,9 @@ public:
bool __value_constructed;
_LIBCPP_INLINE_VISIBILITY
explicit __hash_node_destructor(allocator_type& __na,
bool __constructed = false) _NOEXCEPT
explicit __hash_node_destructor(allocator_type& __na) _NOEXCEPT
: __na_(__na),
__value_constructed(__constructed)
__value_constructed(false)
{}
_LIBCPP_INLINE_VISIBILITY
@@ -1754,7 +1753,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
__pn->__next_ = __cn->__next_;
__cn->__next_ = nullptr;
--size();
return __node_holder(__cn, _D(__node_alloc(), true));
return __node_holder(__cn, _D(__node_alloc()));
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>

View File

@@ -1033,14 +1033,6 @@ struct _LIBCPP_VISIBLE hash<bitset<_Size> >
{return __bs.__hash_code();}
};
template <class _CharT, class _Traits, size_t _Size>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x);
template <class _CharT, class _Traits, size_t _Size>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x);
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_BITSET

View File

@@ -204,9 +204,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
#include <functional>
#include <stdexcept>
#if __DEPRECATED
#warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
#endif
#pragma GCC system_header

View File

@@ -197,9 +197,7 @@ template <class Value, class Hash, class Pred, class Alloc>
#include <__hash_table>
#include <functional>
#if __DEPRECATED
#warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
#endif
namespace __gnu_cxx {

View File

@@ -197,202 +197,149 @@ _LIBCPP_BEGIN_NAMESPACE_STD
locale_t __cloc();
#endif
typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
typedef _VSTD::unique_ptr<__locale_struct, decltype(&freelocale)> __locale_unique_ptr;
typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
// 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
#if __APPLE__
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
decltype(MB_CUR_MAX_L(_VSTD::declval<locale_t>()))
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__mb_cur_max_l(locale_t __l)
int
__nolocale_sprintf(char* __restrict __str,
const char* __restrict __format, _Tp __v)
{
return MB_CUR_MAX_L(__l);
return sprintf_l(__str, 0, __format, __v);
}
#else // _LIBCPP_LOCALE__L_EXTENSIONS
_LIBCPP_ALWAYS_INLINE inline
decltype(MB_CUR_MAX) __mb_cur_max_l(locale_t __l)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_snprintf(char* __restrict __str, size_t __size,
const char* __restrict __format, _Tp __v)
{
__locale_raii __current(uselocale(__l), uselocale);
return MB_CUR_MAX;
return snprintf_l(__str, __size, 0, __format, __v);
}
#endif // _LIBCPP_LOCALE__L_EXTENSIONS
_LIBCPP_ALWAYS_INLINE inline
wint_t __btowc_l(int __c, locale_t __l)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_snprintf(char* __restrict __str, size_t __size,
const char* __restrict __format, int __prec, _Tp __v)
{
#ifdef _LIBCPP_STABLE_APPLE_ABI
return btowc_l(__c, __l);
#else
__locale_raii __current(uselocale(__l), uselocale);
return btowc(__c);
#endif
return snprintf_l(__str, __size, 0, __format, __prec, __v);
}
_LIBCPP_ALWAYS_INLINE inline
int __wctob_l(wint_t __c, locale_t __l)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_asprintf(char** __ret, const char* __restrict __format, _Tp __v)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
return wctob_l(__c, __l);
#else
__locale_raii __current(uselocale(__l), uselocale);
return wctob(__c);
#endif
return asprintf_l(__ret, 0, __format, __v);
}
_LIBCPP_ALWAYS_INLINE inline
size_t __wcsnrtombs_l(char *__dest, const wchar_t **__src, size_t __nwc,
size_t __len, mbstate_t *__ps, locale_t __l)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_asprintf(char** __ret, const char* __restrict __format, int __prec,
_Tp __v)
{
#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
return asprintf_l(__ret, 0, __format, __prec, __v);
}
_LIBCPP_ALWAYS_INLINE inline
size_t __wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_sscanf(const char* __restrict __str,
const char* __restrict __format, _Tp* __v)
{
#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
return sscanf_l(__str, 0, __format, __v);
}
_LIBCPP_ALWAYS_INLINE inline
size_t __mbsnrtowcs_l(wchar_t * __dest, const char **__src, size_t __nms,
size_t __len, mbstate_t *__ps, locale_t __l)
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_isxdigit(int __c)
{
#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
return isxdigit_l(__c, 0);
}
_LIBCPP_ALWAYS_INLINE inline
size_t __mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n,
mbstate_t *__ps, locale_t __l)
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_isdigit(int __c)
{
#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
return isdigit_l(__c, 0);
}
_LIBCPP_ALWAYS_INLINE inline
int __mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l)
#else // __APPLE__
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
int
__nolocale_sprintf(char* __restrict __str,
const char* __restrict __format, ...)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
return mbtowc(__pwc, __pmb, __max, __l);
#else
__locale_raii __current(uselocale(__l), uselocale);
return mbtowc(__pwc, __pmb, __max);
#endif
va_list __ap;
va_start(__ap, __format);
int __result = vsprintf(__str, __format, __ap);
va_end(__ap);
return __result;
}
_LIBCPP_ALWAYS_INLINE inline
size_t __mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l)
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
int
__nolocale_snprintf(char* __restrict __str, size_t __size,
const char* __restrict __format, ...)
{
#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
va_list __ap;
va_start(__ap, __format);
int __result = vsnprintf(__str, __size, __format, __ap);
va_end(__ap);
return __result;
}
_LIBCPP_ALWAYS_INLINE inline
lconv *__localeconv_l(locale_t __l)
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
int
__nolocale_asprintf(char** __ret,
const char* __restrict __format, ...)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
return localeconv_l(__l);
#else
__locale_raii __current(uselocale(__l), uselocale);
return localeconv();
#endif
va_list __ap;
va_start(__ap, __format);
int __result = vasprintf(__ret, __format, __ap);
va_end(__ap);
return __result;
}
_LIBCPP_ALWAYS_INLINE inline
size_t __mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len,
mbstate_t *__ps, locale_t __l)
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
int
__nolocale_sscanf(const char* __restrict __str,
const char* __restrict __format, ...)
{
#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
va_list __ap;
va_start(__ap, __format);
int __result = vsscanf(__str, __format, __ap);
va_end(__ap);
return __result;
}
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_isxdigit(int __c)
{
return isxdigit(__c);
}
_LIBCPP_ALWAYS_INLINE inline
int __sprintf_l(char *__s, locale_t __l, const char *__format, ...) {
va_list __va;
va_start(__va, __format);
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
int __res = vsprintf_l(__s, __l, __format, __va);
#else
__locale_raii __current(uselocale(__l), uselocale);
int __res = vsprintf(__s, __format, __va);
#endif
va_end(__va);
return __res;
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_isdigit(int __c)
{
return isdigit(__c);
}
_LIBCPP_ALWAYS_INLINE 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;
}
_LIBCPP_ALWAYS_INLINE 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;
}
_LIBCPP_ALWAYS_INLINE 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 // _LIBCPP_STABLE_APPLE_ABI
#endif // __APPLE__
// __scan_keyword
// Scans [__b, __e) until a match is found in the basic_strings range
@@ -806,11 +753,7 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
int __save_errno = errno;
errno = 0;
char *__p2;
#ifdef _LIBCPP_STABLE_APPLE_ABI
long long __ll = strtoll_l(__a, &__p2, __base, 0);
#else
long long __ll = strtoll_l(__a, &__p2, __base, __cloc());
#endif
int __current_errno = errno;
if (__current_errno == 0)
errno = __save_errno;
@@ -850,11 +793,7 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
int __save_errno = errno;
errno = 0;
char *__p2;
#ifdef _LIBCPP_STABLE_APPLE_ABI
unsigned long long __ll = strtoull_l(__a, &__p2, __base, 0);
#else
unsigned long long __ll = strtoull_l(__a, &__p2, __base, __cloc());
#endif
int __current_errno = errno;
if (__current_errno == 0)
errno = __save_errno;
@@ -882,11 +821,7 @@ __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err)
if (__a != __a_end)
{
char *__p2;
#ifdef _LIBCPP_STABLE_APPLE_ABI
long double __ld = strtold_l(__a, &__p2, 0);
#else
long double __ld = strtold_l(__a, &__p2, __cloc());
#endif
if (__p2 != __a_end)
{
__err = ios_base::failbit;
@@ -1291,11 +1226,7 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
break;
// Stage 3
__a[sizeof(__a)-1] = 0;
#ifdef _LIBCPP_STABLE_APPLE_ABI
if (sscanf_l(__a, 0, "%p", &__v) != 1)
#else
if (__sscanf_l(__a, __cloc(), "%p", &__v) != 1)
#endif
if (__nolocale_sscanf(__a, "%p", &__v) != 1)
__err = ios_base::failbit;
// EOF checked
if (__b == __e)
@@ -1400,21 +1331,13 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
*__oe++ = __ct.widen(*__nf++);
*__oe++ = __ct.widen(*__nf++);
for (__ns = __nf; __ns < __ne; ++__ns)
#ifdef _LIBCPP_STABLE_APPLE_ABI
if (!isxdigit_l(*__ns, 0))
#else
if (!isxdigit_l(*__ns, __cloc()))
#endif
if (!__nolocale_isxdigit(*__ns))
break;
}
else
{
for (__ns = __nf; __ns < __ne; ++__ns)
#ifdef _LIBCPP_STABLE_APPLE_ABI
if (!isdigit_l(*__ns, 0))
#else
if (!isdigit_l(*__ns, __cloc()))
#endif
if (!__nolocale_isdigit(*__ns))
break;
}
if (__grouping.empty())
@@ -1612,11 +1535,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+ ((numeric_limits<long>::digits % 3) != 0)
+ 1;
char __nar[__nbuf];
#ifdef _LIBCPP_STABLE_APPLE_ABI
int __nc = sprintf_l(__nar, 0, __fmt, __v);
#else
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
#endif
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar while adding thousands separators
@@ -1642,11 +1561,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+ ((numeric_limits<long long>::digits % 3) != 0)
+ 1;
char __nar[__nbuf];
#ifdef _LIBCPP_STABLE_APPLE_ABI
int __nc = sprintf_l(__nar, 0, __fmt, __v);
#else
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
#endif
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar while adding thousands separators
@@ -1672,11 +1587,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_STABLE_APPLE_ABI
int __nc = sprintf_l(__nar, 0, __fmt, __v);
#else
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
#endif
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar while adding thousands separators
@@ -1702,11 +1613,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_STABLE_APPLE_ABI
int __nc = sprintf_l(__nar, 0, __fmt, __v);
#else
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
#endif
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar while adding thousands separators
@@ -1733,35 +1640,18 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
char* __nb = __nar;
int __nc;
if (__specify_precision)
#ifdef _LIBCPP_STABLE_APPLE_ABI
__nc = snprintf_l(__nb, __nbuf, 0, __fmt,
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt,
(int)__iob.precision(), __v);
#else
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt,
(int)__iob.precision(), __v);
#endif
else
#ifdef _LIBCPP_STABLE_APPLE_ABI
__nc = snprintf_l(__nb, __nbuf, 0, __fmt, __v);
#else
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v);
#endif
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt, __v);
unique_ptr<char, void(*)(void*)> __nbh(0, free);
if (__nc > static_cast<int>(__nbuf-1))
{
if (__specify_precision)
#ifdef _LIBCPP_STABLE_APPLE_ABI
__nc = asprintf_l(&__nb, 0, __fmt, (int)__iob.precision(), __v);
#else
__nc = __asprintf_l(&__nb, __cloc(), __fmt,
(int)__iob.precision());
#endif
__nc = __nolocale_asprintf(&__nb, __fmt, (int)__iob.precision(),
__v);
else
#ifdef _LIBCPP_STABLE_APPLE_ABI
__nc = asprintf_l(&__nb, 0, __fmt, __v);
#else
__nc = __asprintf_l(&__nb, __cloc(), __fmt, (int)__iob.precision());
#endif
__nc = __nolocale_asprintf(&__nb, __fmt, __v);
if (__nb == 0)
__throw_bad_alloc();
__nbh.reset(__nb);
@@ -1802,35 +1692,18 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
char* __nb = __nar;
int __nc;
if (__specify_precision)
#ifdef _LIBCPP_STABLE_APPLE_ABI
__nc = snprintf_l(__nb, __nbuf, 0, __fmt,
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt,
(int)__iob.precision(), __v);
#else
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt,
(int)__iob.precision(), __v);
#endif
else
#ifdef _LIBCPP_STABLE_APPLE_ABI
__nc = snprintf_l(__nb, __nbuf, 0, __fmt, __v);
#else
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v);
#endif
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt, __v);
unique_ptr<char, void(*)(void*)> __nbh(0, free);
if (__nc > static_cast<int>(__nbuf-1))
{
if (__specify_precision)
#ifdef _LIBCPP_STABLE_APPLE_ABI
__nc = asprintf_l(&__nb, 0, __fmt, (int)__iob.precision(), __v);
#else
__nc = __asprintf_l(&__nb, __cloc(), __fmt,
(int)__iob.precision());
#endif
__nc = __nolocale_asprintf(&__nb, __fmt, (int)__iob.precision(),
__v);
else
#ifdef _LIBCPP_STABLE_APPLE_ABI
__nc = asprintf_l(&__nb, 0, __fmt, __v);
#else
__nc = __asprintf_l(&__nb, __cloc(), __fmt, (int)__iob.precision());
#endif
__nc = __nolocale_asprintf(&__nb, __fmt, __v);
if (__nb == 0)
__throw_bad_alloc();
__nbh.reset(__nb);
@@ -1866,11 +1739,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_STABLE_APPLE_ABI
int __nc = sprintf_l(__nar, 0, __fmt, __v);
#else
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
#endif
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar
@@ -3554,11 +3423,7 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
// secure memory for digit storage
if (__n > __bs-1)
{
#ifdef _LIBCPP_STABLE_APPLE_ABI
__n = asprintf_l(&__bb, 0, "%.0Lf", __units);
#else
__n = __asprintf_l(&__bb, __cloc(), "%.0Lf", __units);
#endif
__n = __nolocale_asprintf(&__bb, "%.0Lf", __units);
if (__bb == 0)
__throw_bad_alloc();
__hn.reset(__bb);

View File

@@ -595,7 +595,6 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
#include <limits>
#include <iterator>
#include <__functional_base>
#include <iosfwd>
#if defined(_LIBCPP_NO_EXCEPTIONS)
#include <cassert>
#endif
@@ -1294,7 +1293,7 @@ struct __has_allocate_hint
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
#if !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE) && !defined(_LIBCPP_HAS_NO_VARIADICS)
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
template <class _Alloc, class _Tp, class ..._Args>
decltype(_VSTD::declval<_Alloc>().construct(_VSTD::declval<_Tp*>(),
@@ -4149,11 +4148,6 @@ struct _LIBCPP_VISIBLE hash<shared_ptr<_Tp> >
}
};
template<class _CharT, class _Traits, class _Y>
inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Y> const& __p);
//enum class
struct _LIBCPP_VISIBLE pointer_safety
{

View File

@@ -3392,17 +3392,7 @@ _LIBCPP_INLINE_VISIBILITY inline
int
basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const _NOEXCEPT
{
size_t __lhs_sz = size();
size_t __rhs_sz = __str.size();
int __result = traits_type::compare(data(), __str.data(),
_VSTD::min(__lhs_sz, __rhs_sz));
if (__result != 0)
return __result;
if (__lhs_sz < __rhs_sz)
return -1;
if (__lhs_sz > __rhs_sz)
return 1;
return 0;
return compare(0, npos, __str.data(), __str.size());
}
template <class _CharT, class _Traits, class _Allocator>
@@ -3517,6 +3507,24 @@ operator==(const _CharT* __lhs,
return __rhs.compare(__lhs) == 0;
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator==(const char* __lhs,
const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT
{
return strcmp(__lhs, __rhs.data()) == 0;
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator==(const wchar_t* __lhs,
const basic_string<wchar_t, char_traits<wchar_t>, _Allocator>& __rhs) _NOEXCEPT
{
return wcscmp(__lhs, __rhs.data()) == 0;
}
template<class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
@@ -3526,6 +3534,24 @@ operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
return __lhs.compare(__rhs) == 0;
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator==(const basic_string<char, char_traits<char>, _Allocator>& __lhs,
const char* __rhs) _NOEXCEPT
{
return strcmp(__lhs.data(), __rhs) == 0;
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator==(const basic_string<wchar_t, char_traits<wchar_t>, _Allocator>& __lhs,
const wchar_t* __rhs) _NOEXCEPT
{
return wcscmp(__lhs.data(), __rhs) == 0;
}
// operator!=
template<class _CharT, class _Traits, class _Allocator>
@@ -3563,7 +3589,25 @@ bool
operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
{
return __lhs.compare(__rhs) < 0;
return __lhs.cmpare(__rhs) < 0;
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator< (const basic_string<char, char_traits<char>, _Allocator>& __lhs,
const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT
{
return strcmp(__lhs.data(), __rhs.data()) < 0;
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator< (const basic_string<wchar_t, char_traits<wchar_t>, _Allocator>& __lhs,
const basic_string<wchar_t, char_traits<wchar_t>, _Allocator>& __rhs) _NOEXCEPT
{
return wcscmp(__lhs.data(), __rhs.data()) < 0;
}
template<class _CharT, class _Traits, class _Allocator>
@@ -3572,7 +3616,25 @@ bool
operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
const _CharT* __rhs) _NOEXCEPT
{
return __lhs.compare(__rhs) < 0;
return __lhs.compare(__rhs);
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator< (const basic_string<char, char_traits<char>, _Allocator>& __lhs,
const char* __rhs) _NOEXCEPT
{
return strcmp(__lhs.data(), __rhs) < 0;
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator< (const basic_string<wchar_t, char_traits<wchar_t>, _Allocator>& __lhs,
const wchar_t* __rhs) _NOEXCEPT
{
return wcscmp(__lhs.data(), __rhs) < 0;
}
template<class _CharT, class _Traits, class _Allocator>
@@ -3584,6 +3646,24 @@ operator< (const _CharT* __lhs,
return __rhs.compare(__lhs) > 0;
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator< (const char* __lhs,
const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT
{
return strcmp(__lhs, __rhs.data()) < 0;
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator< (const wchar_t* __lhs,
const basic_string<wchar_t, char_traits<wchar_t>, _Allocator>& __rhs) _NOEXCEPT
{
return wcscmp(__lhs, __rhs.data()) < 0;
}
// operator>
template<class _CharT, class _Traits, class _Allocator>
@@ -3886,43 +3966,6 @@ hash<basic_string<_CharT, _Traits, _Allocator> >::operator()(
return __r;
}
template<class _CharT, class _Traits, class _Allocator>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const basic_string<_CharT, _Traits, _Allocator>& __str);
template<class _CharT, class _Traits, class _Allocator>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Allocator>& __str);
template<class _CharT, class _Traits, class _Allocator>
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm);
template<class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Allocator>& __str);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>&& __is,
basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm);
template<class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>&& __is,
basic_string<_CharT, _Traits, _Allocator>& __str);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
extern template class basic_string<char>;
extern template class basic_string<wchar_t>;

View File

@@ -3014,15 +3014,11 @@ struct __invoke_of
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
typename enable_if
<
is_move_constructible<_Tp>::value &&
is_move_assignable<_Tp>::value
>::type
#else
void
#endif
swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value &&
is_nothrow_move_assignable<_Tp>::value)
{
@@ -3096,26 +3092,6 @@ struct __is_nothrow_swappable
#endif // __has_feature(cxx_noexcept)
#ifdef _LIBCXX_UNDERLYING_TYPE
template <class _Tp>
struct underlying_type
{
typedef _LIBCXX_UNDERLYING_TYPE(_Tp) type;
};
#else // _LIBCXX_UNDERLYING_TYPE
template <class _Tp, bool _Support = false>
struct underlying_type
{
static_assert(_Support, "The underyling_type trait requires compiler "
"support. Either no such support exists or "
"libc++ does not know how to use it.");
};
#endif // _LIBCXX_UNDERLYING_TYPE
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_TYPE_TRAITS

View File

@@ -560,9 +560,9 @@ public:
typedef const value_type& reference;
typedef typename __pointer_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<const value_type>
rebind<value_type>
#else
rebind<const value_type>::other
rebind<value_type>::other
#endif
pointer;

View File

@@ -226,12 +226,9 @@ struct _LIBCPP_VISIBLE pair
template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY
pair(const pair<_U1, _U2>& __p
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
,typename enable_if<is_constructible<_T1, _U1>::value &&
is_constructible<_T2, _U2>::value>::type* = 0
#endif
)
pair(const pair<_U1, _U2>& __p,
typename enable_if<is_constructible<_T1, _U1>::value &&
is_constructible<_T2, _U2>::value>::type* = 0)
: first(__p.first), second(__p.second) {}
_LIBCPP_INLINE_VISIBILITY

View File

@@ -817,8 +817,6 @@ public:
valarray& operator=(const gslice_array<value_type>& __ga);
valarray& operator=(const mask_array<value_type>& __ma);
valarray& operator=(const indirect_array<value_type>& __ia);
template <class _ValExpr>
valarray& operator=(const __val_expr<_ValExpr>& __v);
// element access:
_LIBCPP_INLINE_VISIBILITY
@@ -2960,21 +2958,6 @@ valarray<_Tp>::operator=(const indirect_array<value_type>& __ia)
return *this;
}
template <class _Tp>
template <class _ValExpr>
inline _LIBCPP_INLINE_VISIBILITY
valarray<_Tp>&
valarray<_Tp>::operator=(const __val_expr<_ValExpr>& __v)
{
size_t __n = __v.size();
if (size() != __n)
resize(__n);
value_type* __t = __begin_;
for (size_t __i = 0; __i != __n; ++__t, ++__i)
*__t = result_type(__v[__i]);
return *this;
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__val_expr<__slice_expr<const valarray<_Tp>&> >

View File

@@ -56,7 +56,6 @@ std::get_terminate() _NOEXCEPT
return __sync_fetch_and_add(&__terminate_handler, (std::terminate_handler)0);
}
_ATTRIBUTE(noreturn)
void
std::terminate() _NOEXCEPT
{

View File

@@ -22,16 +22,97 @@
#include <langinfo.h>
#include <stdlib.h>
#ifdef _LIBCPP_STABLE_APPLE_ABI
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(_VSTD::declval<locale_t>()))
inline _LIBCPP_INLINE_VISIBILITY
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
@@ -1164,33 +1245,21 @@ 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 _LIBCPP_STABLE_APPLE_ABI
return btowc_l(c, __l);
#else
return __btowc_l(c, __l);
#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
{
for (; low != high; ++low, ++dest)
#ifdef _LIBCPP_STABLE_APPLE_ABI
*dest = btowc_l(*low, __l);
#else
*dest = __btowc_l(*low, __l);
#endif
*dest = with_locale::btowc_l(*low, __l);
return low;
}
char
ctype_byname<wchar_t>::do_narrow(char_type c, char dfault) const
{
#ifdef _LIBCPP_STABLE_APPLE_ABI
int r = wctob_l(c, __l);
#else
int r = __wctob_l(c, __l);
#endif
int r = with_locale::wctob_l(c, __l);
return r != WEOF ? static_cast<char>(r) : dfault;
}
@@ -1199,11 +1268,7 @@ ctype_byname<wchar_t>::do_narrow(const char_type* low, const char_type* high, ch
{
for (; low != high; ++low, ++dest)
{
#ifdef _LIBCPP_STABLE_APPLE_ABI
int r = wctob_l(*low, __l);
#else
int r = __wctob_l(*low, __l);
#endif
int r = with_locale::wctob_l(*low, __l);
*dest = r != WEOF ? static_cast<char>(r) : dfault;
}
return low;
@@ -1313,21 +1378,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;
#ifdef _LIBCPP_STABLE_APPLE_ABI
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);
#endif
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)
{
#ifdef _LIBCPP_STABLE_APPLE_ABI
n = wcrtomb_l(to_nxt, *frm, &save_state, __l);
#else
n = __wcrtomb_l(to_nxt, *frm, &save_state, __l);
#endif
n = with_locale::wcrtomb_l(to_nxt, *frm, &save_state, __l);
if (n == size_t(-1))
break;
to_nxt += n;
@@ -1344,11 +1401,7 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st,
{
// Try to write the terminating null
extern_type tmp[MB_LEN_MAX];
#ifdef _LIBCPP_STABLE_APPLE_ABI
n = wcrtomb_l(tmp, intern_type(), &st, __l);
#else
n = __wcrtomb_l(tmp, intern_type(), &st, __l);
#endif
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?
@@ -1381,21 +1434,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;
#ifdef _LIBCPP_STABLE_APPLE_ABI
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);
#endif
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)
{
#ifdef _LIBCPP_STABLE_APPLE_ABI
n = mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l);
#else
n = __mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l);
#endif
n = with_locale::mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l);
switch (n)
{
case 0:
@@ -1423,11 +1468,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
#ifdef _LIBCPP_STABLE_APPLE_ABI
n = mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l);
#else
n = __mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l);
#endif
n = with_locale::mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l);
if (n != 0) // on error
return error;
++to_nxt;
@@ -1447,11 +1488,7 @@ codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st,
{
to_nxt = to;
extern_type tmp[MB_LEN_MAX];
#ifdef _LIBCPP_STABLE_APPLE_ABI
size_t n = wcrtomb_l(tmp, intern_type(), &st, __l);
#else
size_t n = __wcrtomb_l(tmp, intern_type(), &st, __l);
#endif
size_t n = with_locale::wcrtomb_l(tmp, intern_type(), &st, __l);
if (n == size_t(-1) || n == 0) // on error
return error;
--n;
@@ -1465,18 +1502,10 @@ codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st,
int
codecvt<wchar_t, char, mbstate_t>::do_encoding() const _NOEXCEPT
{
#ifdef _LIBCPP_STABLE_APPLE_ABI
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
if (with_locale::mbtowc_l((wchar_t*) 0, (const char*) 0, MB_LEN_MAX, __l) == 0)
{
// stateless encoding
#ifdef _LIBCPP_STABLE_APPLE_ABI
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
#endif
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;
}
@@ -1496,11 +1525,7 @@ codecvt<wchar_t, char, mbstate_t>::do_length(state_type& st,
int nbytes = 0;
for (size_t nwchar_t = 0; nwchar_t < mx && frm != frm_end; ++nwchar_t)
{
#ifdef _LIBCPP_STABLE_APPLE_ABI
size_t n = mbrlen_l(frm, frm_end-frm, &st, __l);
#else
size_t n = __mbrlen_l(frm, frm_end-frm, &st, __l);
#endif
size_t n = with_locale::mbrlen_l(frm, frm_end-frm, &st, __l);
switch (n)
{
case 0:
@@ -1522,11 +1547,7 @@ codecvt<wchar_t, char, mbstate_t>::do_length(state_type& st,
int
codecvt<wchar_t, char, mbstate_t>::do_max_length() const _NOEXCEPT
{
#ifdef _LIBCPP_STABLE_APPLE_ABI
return __l == 0 ? 1 : MB_CUR_MAX_L(__l);
#else
return __l == 0 ? 1 : __mb_cur_max_l(__l);
#endif
return __l == 0 ? 1 : with_locale::mb_cur_max_l(__l);
}
// Valid UTF ranges
@@ -4069,17 +4090,13 @@ numpunct_byname<char>::__init(const char* nm)
{
if (strcmp(nm, "C") != 0)
{
__locale_unique_ptr 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
#ifdef _LIBCPP_STABLE_APPLE_ABI
lconv* lc = localeconv_l(loc.get());
#else
lconv* lc = __localeconv_l(loc.get());
#endif
lconv* lc = with_locale::localeconv_l(loc.get());
if (*lc->decimal_point)
__decimal_point_ = *lc->decimal_point;
if (*lc->thousands_sep)
@@ -4112,17 +4129,13 @@ numpunct_byname<wchar_t>::__init(const char* nm)
{
if (strcmp(nm, "C") != 0)
{
__locale_unique_ptr 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
#ifdef _LIBCPP_STABLE_APPLE_ABI
lconv* lc = localeconv_l(loc.get());
#else
lconv* lc = __localeconv_l(loc.get());
#endif
lconv* lc = with_locale::localeconv_l(loc.get());
if (*lc->decimal_point)
__decimal_point_ = *lc->decimal_point;
if (*lc->thousands_sep)
@@ -4713,11 +4726,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;
#ifdef _LIBCPP_STABLE_APPLE_ABI
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_);
#endif
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;
@@ -4898,11 +4907,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;
#ifdef _LIBCPP_STABLE_APPLE_ABI
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_);
#endif
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;
@@ -4910,11 +4915,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;
#ifdef _LIBCPP_STABLE_APPLE_ABI
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_);
#endif
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;
@@ -4927,11 +4928,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;
#ifdef _LIBCPP_STABLE_APPLE_ABI
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_);
#endif
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;
@@ -4939,11 +4936,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;
#ifdef _LIBCPP_STABLE_APPLE_ABI
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_);
#endif
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;
@@ -4954,11 +4947,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;
#ifdef _LIBCPP_STABLE_APPLE_ABI
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_);
#endif
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;
@@ -4967,11 +4956,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;
#ifdef _LIBCPP_STABLE_APPLE_ABI
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_);
#endif
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;
@@ -5246,11 +5231,7 @@ __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm,
__do_put(__nar, __ne, __tm, __fmt, __mod);
mbstate_t mb = {0};
const char* __nb = __nar;
#ifdef _LIBCPP_STABLE_APPLE_ABI
size_t j = mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_);
#else
size_t j = __mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_);
#endif
size_t j = with_locale::mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_);
if (j == -1)
__throw_runtime_error("locale not supported");
__we = __wb + j;
@@ -5499,17 +5480,13 @@ void
moneypunct_byname<char, false>::init(const char* nm)
{
typedef moneypunct<char, false> base;
__locale_unique_ptr 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
#ifdef _LIBCPP_STABLE_APPLE_ABI
lconv* lc = localeconv_l(loc.get());
#else
lconv* lc = __localeconv_l(loc.get());
#endif
lconv* lc = with_locale::localeconv_l(loc.get());
if (*lc->mon_decimal_point)
__decimal_point_ = *lc->mon_decimal_point;
else
@@ -5541,17 +5518,13 @@ void
moneypunct_byname<char, true>::init(const char* nm)
{
typedef moneypunct<char, true> base;
__locale_unique_ptr 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
#ifdef _LIBCPP_STABLE_APPLE_ABI
lconv* lc = localeconv_l(loc.get());
#else
lconv* lc = __localeconv_l(loc.get());
#endif
lconv* lc = with_locale::localeconv_l(loc.get());
if (*lc->mon_decimal_point)
__decimal_point_ = *lc->mon_decimal_point;
else
@@ -5583,17 +5556,13 @@ void
moneypunct_byname<wchar_t, false>::init(const char* nm)
{
typedef moneypunct<wchar_t, false> base;
__locale_unique_ptr 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
#ifdef _LIBCPP_STABLE_APPLE_ABI
lconv* lc = localeconv_l(loc.get());
#else
lconv* lc = __localeconv_l(loc.get());
#endif
lconv* lc = with_locale::localeconv_l(loc.get());
if (*lc->mon_decimal_point)
__decimal_point_ = static_cast<wchar_t>(*lc->mon_decimal_point);
else
@@ -5606,11 +5575,7 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
wchar_t wbuf[100];
mbstate_t mb = {0};
const char* bb = lc->currency_symbol;
#ifdef _LIBCPP_STABLE_APPLE_ABI
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());
#endif
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;
@@ -5625,11 +5590,7 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
{
mb = mbstate_t();
bb = lc->positive_sign;
#ifdef _LIBCPP_STABLE_APPLE_ABI
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());
#endif
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;
@@ -5641,11 +5602,7 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
{
mb = mbstate_t();
bb = lc->negative_sign;
#ifdef _LIBCPP_STABLE_APPLE_ABI
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());
#endif
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;
@@ -5660,17 +5617,13 @@ void
moneypunct_byname<wchar_t, true>::init(const char* nm)
{
typedef moneypunct<wchar_t, true> base;
__locale_unique_ptr 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
#ifdef _LIBCPP_STABLE_APPLE_ABI
lconv* lc = localeconv_l(loc.get());
#else
lconv* lc = __localeconv_l(loc.get());
#endif
lconv* lc = with_locale::localeconv_l(loc.get());
if (*lc->mon_decimal_point)
__decimal_point_ = static_cast<wchar_t>(*lc->mon_decimal_point);
else
@@ -5683,11 +5636,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;
#ifdef _LIBCPP_STABLE_APPLE_ABI
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());
#endif
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;
@@ -5702,11 +5651,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
{
mb = mbstate_t();
bb = lc->positive_sign;
#ifdef _LIBCPP_STABLE_APPLE_ABI
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());
#endif
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;
@@ -5718,11 +5663,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
{
mb = mbstate_t();
bb = lc->negative_sign;
#ifdef _LIBCPP_STABLE_APPLE_ABI
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());
#endif
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;

View File

@@ -32,14 +32,10 @@ int main()
{
mbstate_t mb = {0};
size_t s = 0;
tm *tm = 0;
tm tm = {0};
wint_t w = 0;
::FILE* fp = 0;
#ifdef __APPLE__
__darwin_va_list va;
#else
__builtin_va_list va;
#endif
char* ns = 0;
wchar_t* ws = 0;
static_assert((std::is_same<decltype(fwprintf(fp, L"")), int>::value), "");
@@ -92,7 +88,7 @@ int main()
static_assert((std::is_same<decltype(wmemcpy(ws, L"", s)), wchar_t*>::value), "");
static_assert((std::is_same<decltype(wmemmove(ws, L"", s)), wchar_t*>::value), "");
static_assert((std::is_same<decltype(wmemset(ws, L' ', s)), wchar_t*>::value), "");
static_assert((std::is_same<decltype(wcsftime(ws, s, L"", tm)), size_t>::value), "");
static_assert((std::is_same<decltype(wcsftime(ws, s, L"", &tm)), size_t>::value), "");
static_assert((std::is_same<decltype(btowc(0)), wint_t>::value), "");
static_assert((std::is_same<decltype(wctob(w)), int>::value), "");
static_assert((std::is_same<decltype(mbsinit(&mb)), int>::value), "");

View File

@@ -19,12 +19,10 @@
int main()
{
char temp[L_tmpnam];
tmpnam(temp);
{
std::filebuf f;
assert(f.open(temp, std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn("123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -35,11 +33,11 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == '2');
}
remove(temp);
remove("test.dat");
{
std::wfilebuf f;
assert(f.open(temp, std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn(L"123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -50,5 +48,5 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == L'2');
}
remove(temp);
remove("test.dat");
}

View File

@@ -20,12 +20,10 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
char temp[L_tmpnam];
tmpnam(temp);
{
std::filebuf f;
assert(f.open(temp, std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn("123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -36,11 +34,11 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == '2');
}
remove(temp);
remove("test.dat");
{
std::wfilebuf f;
assert(f.open(temp, std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn(L"123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -51,6 +49,6 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == L'2');
}
remove(temp);
remove("test.dat");
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -21,12 +21,10 @@
int main()
{
char temp[L_tmpnam];
tmpnam(temp);
{
std::filebuf f;
assert(f.open(temp, std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn("123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -37,11 +35,11 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == '2');
}
remove(temp);
remove("test.dat");
{
std::wfilebuf f;
assert(f.open(temp, std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn(L"123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -52,5 +50,5 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == L'2');
}
remove(temp);
remove("test.dat");
}

View File

@@ -20,12 +20,10 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
char temp[L_tmpnam];
tmpnam(temp);
{
std::filebuf f;
assert(f.open(temp, std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn("123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -35,11 +33,11 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == '2');
}
remove(temp);
remove("test.dat");
{
std::wfilebuf f;
assert(f.open(temp, std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn(L"123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -49,6 +47,6 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == L'2');
}
remove(temp);
remove("test.dat");
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -16,36 +16,34 @@
int main()
{
char temp[L_tmpnam];
tmpnam(temp);
{
std::filebuf f;
assert(f.open(temp, std::ios_base::out) != 0);
assert(f.open("test.dat", std::ios_base::out) != 0);
assert(f.is_open());
assert(f.sputn("123", 3) == 3);
}
{
std::filebuf f;
assert(f.open(temp, std::ios_base::in) != 0);
assert(f.open("test.dat", std::ios_base::in) != 0);
assert(f.is_open());
assert(f.sbumpc() == '1');
assert(f.sbumpc() == '2');
assert(f.sbumpc() == '3');
}
remove(temp);
remove("test.dat");
{
std::wfilebuf f;
assert(f.open(temp, std::ios_base::out) != 0);
assert(f.open("test.dat", std::ios_base::out) != 0);
assert(f.is_open());
assert(f.sputn(L"123", 3) == 3);
}
{
std::wfilebuf f;
assert(f.open(temp, std::ios_base::in) != 0);
assert(f.open("test.dat", std::ios_base::in) != 0);
assert(f.is_open());
assert(f.sbumpc() == L'1');
assert(f.sbumpc() == L'2');
assert(f.sbumpc() == L'3');
}
remove(temp);
remove("test.dat");
}

View File

@@ -19,14 +19,11 @@
int main()
{
char temp1[L_tmpnam], temp2[L_tmpnam];
tmpnam(temp1);
tmpnam(temp2);
{
std::fstream fs1(temp1, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::fstream fs2(temp2, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::fstream fs1("test1.dat", std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::fstream fs2("test2.dat", std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
fs1 << 1 << ' ' << 2;
fs2 << 2 << ' ' << 1;
fs1.seekg(0);
@@ -43,13 +40,13 @@ int main()
fs2 >> i;
assert(i == 2);
}
std::remove(temp1);
std::remove(temp2);
std::remove("test1.dat");
std::remove("test2.dat");
{
std::wfstream fs1(temp1, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::wfstream fs2(temp2, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::wfstream fs1("test1.dat", std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::wfstream fs2("test2.dat", std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
fs1 << 1 << ' ' << 2;
fs2 << 2 << ' ' << 1;
fs1.seekg(0);
@@ -66,6 +63,6 @@ int main()
fs2 >> i;
assert(i == 2);
}
std::remove(temp1);
std::remove(temp2);
std::remove("test1.dat");
std::remove("test2.dat");
}

View File

@@ -20,11 +20,9 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
char temp[L_tmpnam];
tmpnam(temp);
{
std::fstream fso(temp, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::fstream fso("test.dat", std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::fstream fs;
fs = move(fso);
double x = 0;
@@ -33,10 +31,10 @@ int main()
fs >> x;
assert(x == 3.25);
}
std::remove(temp);
std::remove("test.dat");
{
std::wfstream fso(temp, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::wfstream fso("test.dat", std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::wfstream fs;
fs = move(fso);
double x = 0;
@@ -45,6 +43,6 @@ int main()
fs >> x;
assert(x == 3.25);
}
std::remove(temp);
std::remove("test.dat");
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -20,14 +20,11 @@
int main()
{
char temp1[L_tmpnam], temp2[L_tmpnam];
tmpnam(temp1);
tmpnam(temp2);
{
std::fstream fs1(temp1, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::fstream fs2(temp2, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::fstream fs1("test1.dat", std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::fstream fs2("test2.dat", std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
fs1 << 1 << ' ' << 2;
fs2 << 2 << ' ' << 1;
fs1.seekg(0);
@@ -44,13 +41,13 @@ int main()
fs2 >> i;
assert(i == 2);
}
std::remove(temp1);
std::remove(temp2);
std::remove("test1.dat");
std::remove("test2.dat");
{
std::wfstream fs1(temp1, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::wfstream fs2(temp2, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::wfstream fs1("test1.dat", std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::wfstream fs2("test2.dat", std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
fs1 << 1 << ' ' << 2;
fs2 << 2 << ' ' << 1;
fs1.seekg(0);
@@ -67,6 +64,6 @@ int main()
fs2 >> i;
assert(i == 2);
}
std::remove(temp1);
std::remove(temp2);
std::remove("test1.dat");
std::remove("test2.dat");
}

View File

@@ -20,11 +20,9 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
char temp[L_tmpnam];
tmpnam(temp);
{
std::fstream fso(temp, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::fstream fso("test.dat", std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::fstream fs = move(fso);
double x = 0;
fs << 3.25;
@@ -34,8 +32,8 @@ int main()
}
std::remove("test.dat");
{
std::wfstream fso(temp, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::wfstream fso("test.dat", std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::wfstream fs = move(fso);
double x = 0;
fs << 3.25;
@@ -43,6 +41,6 @@ int main()
fs >> x;
assert(x == 3.25);
}
std::remove(temp);
std::remove("test.dat");
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -19,26 +19,24 @@
int main()
{
char temp[L_tmpnam];
tmpnam(temp);
{
std::fstream fs(temp, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::fstream fs("test.dat", std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
double x = 0;
fs << 3.25;
fs.seekg(0);
fs >> x;
assert(x == 3.25);
}
std::remove(temp);
std::remove("test.dat");
{
std::wfstream fs(temp, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::wfstream fs("test.dat", std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
double x = 0;
fs << 3.25;
fs.seekg(0);
fs >> x;
assert(x == 3.25);
}
std::remove(temp);
std::remove("test.dat");
}

View File

@@ -19,10 +19,8 @@
int main()
{
char temp[L_tmpnam];
tmpnam(temp);
{
std::fstream fs(std::string(temp),
std::fstream fs(std::string("test.dat"),
std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
double x = 0;
@@ -31,9 +29,9 @@ int main()
fs >> x;
assert(x == 3.25);
}
std::remove(temp);
std::remove("test.dat");
{
std::wfstream fs(std::string(temp),
std::wfstream fs(std::string("test.dat"),
std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
double x = 0;
@@ -42,5 +40,5 @@ int main()
fs >> x;
assert(x == 3.25);
}
std::remove(temp);
std::remove("test.dat");
}

View File

@@ -19,24 +19,22 @@
int main()
{
char temp[L_tmpnam];
tmpnam(temp);
{
std::fstream fs;
assert(!fs.is_open());
fs.open(temp, std::ios_base::out);
fs.open("test.dat", std::ios_base::out);
assert(fs.is_open());
fs.close();
assert(!fs.is_open());
}
remove(temp);
remove("test.dat");
{
std::wfstream fs;
assert(!fs.is_open());
fs.open(temp, std::ios_base::out);
fs.open("test.dat", std::ios_base::out);
assert(fs.is_open());
fs.close();
assert(!fs.is_open());
}
remove(temp);
remove("test.dat");
}

View File

@@ -19,13 +19,11 @@
int main()
{
char temp[L_tmpnam];
tmpnam(temp);
{
std::fstream fs;
assert(!fs.is_open());
fs.open(temp, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
fs.open("test.dat", std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
assert(fs.is_open());
double x = 0;
fs << 3.25;
@@ -33,12 +31,12 @@ int main()
fs >> x;
assert(x == 3.25);
}
std::remove(temp);
std::remove("test.dat");
{
std::wfstream fs;
assert(!fs.is_open());
fs.open(temp, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
fs.open("test.dat", std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
assert(fs.is_open());
double x = 0;
fs << 3.25;
@@ -46,5 +44,5 @@ int main()
fs >> x;
assert(x == 3.25);
}
std::remove(temp);
std::remove("test.dat");
}

View File

@@ -19,13 +19,11 @@
int main()
{
char temp[L_tmpnam];
tmpnam(temp);
{
std::fstream fs;
assert(!fs.is_open());
fs.open(std::string(temp), std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
fs.open(std::string("test.dat"), std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
assert(fs.is_open());
double x = 0;
fs << 3.25;
@@ -33,12 +31,12 @@ int main()
fs >> x;
assert(x == 3.25);
}
std::remove(temp);
std::remove("test.dat");
{
std::wfstream fs;
assert(!fs.is_open());
fs.open(std::string(temp), std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
fs.open(std::string("test.dat"), std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
assert(fs.is_open());
double x = 0;
fs << 3.25;
@@ -46,5 +44,5 @@ int main()
fs >> x;
assert(x == 3.25);
}
std::remove(temp);
std::remove("test.dat");
}

View File

@@ -19,12 +19,9 @@
int main()
{
char temp1[L_tmpnam], temp2[L_tmpnam];
tmpnam(temp1);
tmpnam(temp2);
{
std::ofstream fs1(temp1);
std::ofstream fs2(temp2);
std::ofstream fs1("test1.dat");
std::ofstream fs2("test2.dat");
fs1 << 3.25;
fs2 << 4.5;
fs1.swap(fs2);
@@ -32,26 +29,26 @@ int main()
fs2 << ' ' << 4.5;
}
{
std::ifstream fs(temp1);
std::ifstream fs("test1.dat");
double x = 0;
fs >> x;
assert(x == 3.25);
fs >> x;
assert(x == 4.5);
}
remove(temp1);
remove("test1.dat");
{
std::ifstream fs(temp2);
std::ifstream fs("test2.dat");
double x = 0;
fs >> x;
assert(x == 4.5);
fs >> x;
assert(x == 3.25);
}
remove(temp2);
remove("test2.dat");
{
std::wofstream fs1(temp1);
std::wofstream fs2(temp2);
std::wofstream fs1("test1.dat");
std::wofstream fs2("test2.dat");
fs1 << 3.25;
fs2 << 4.5;
fs1.swap(fs2);
@@ -59,21 +56,21 @@ int main()
fs2 << ' ' << 4.5;
}
{
std::wifstream fs(temp1);
std::wifstream fs("test1.dat");
double x = 0;
fs >> x;
assert(x == 3.25);
fs >> x;
assert(x == 4.5);
}
remove(temp1);
remove("test1.dat");
{
std::wifstream fs(temp2);
std::wifstream fs("test2.dat");
double x = 0;
fs >> x;
assert(x == 4.5);
fs >> x;
assert(x == 3.25);
}
remove(temp2);
remove("test2.dat");
}

View File

@@ -20,33 +20,31 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
char temp[L_tmpnam];
tmpnam(temp);
{
std::ofstream fso(temp);
std::ofstream fso("test.dat");
std::ofstream fs;
fs = move(fso);
fs << 3.25;
}
{
std::ifstream fs(temp);
std::ifstream fs("test.dat");
double x = 0;
fs >> x;
assert(x == 3.25);
}
remove(temp);
remove("test.dat");
{
std::wofstream fso(temp);
std::wofstream fso("test.dat");
std::wofstream fs;
fs = move(fso);
fs << 3.25;
}
{
std::wifstream fs(temp);
std::wifstream fs("test.dat");
double x = 0;
fs >> x;
assert(x == 3.25);
}
remove(temp);
remove("test.dat");
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -20,12 +20,9 @@
int main()
{
char temp1[L_tmpnam], temp2[L_tmpnam];
tmpnam(temp1);
tmpnam(temp2);
{
std::ofstream fs1(temp1);
std::ofstream fs2(temp2);
std::ofstream fs1("test1.dat");
std::ofstream fs2("test2.dat");
fs1 << 3.25;
fs2 << 4.5;
swap(fs1, fs2);
@@ -33,26 +30,26 @@ int main()
fs2 << ' ' << 4.5;
}
{
std::ifstream fs(temp1);
std::ifstream fs("test1.dat");
double x = 0;
fs >> x;
assert(x == 3.25);
fs >> x;
assert(x == 4.5);
}
remove(temp1);
remove("test1.dat");
{
std::ifstream fs(temp2);
std::ifstream fs("test2.dat");
double x = 0;
fs >> x;
assert(x == 4.5);
fs >> x;
assert(x == 3.25);
}
remove(temp2);
remove("test2.dat");
{
std::wofstream fs1(temp1);
std::wofstream fs2(temp2);
std::wofstream fs1("test1.dat");
std::wofstream fs2("test2.dat");
fs1 << 3.25;
fs2 << 4.5;
swap(fs1, fs2);
@@ -60,21 +57,21 @@ int main()
fs2 << ' ' << 4.5;
}
{
std::wifstream fs(temp1);
std::wifstream fs("test1.dat");
double x = 0;
fs >> x;
assert(x == 3.25);
fs >> x;
assert(x == 4.5);
}
remove(temp1);
remove("test1.dat");
{
std::wifstream fs(temp2);
std::wifstream fs("test2.dat");
double x = 0;
fs >> x;
assert(x == 4.5);
fs >> x;
assert(x == 3.25);
}
remove(temp2);
remove("test2.dat");
}

View File

@@ -20,31 +20,29 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
char temp[L_tmpnam];
tmpnam(temp);
{
std::ofstream fso(temp);
std::ofstream fso("test.dat");
std::ofstream fs = move(fso);
fs << 3.25;
}
{
std::ifstream fs(temp);
std::ifstream fs("test.dat");
double x = 0;
fs >> x;
assert(x == 3.25);
}
remove(temp);
remove("test.dat");
{
std::wofstream fso(temp);
std::wofstream fso("test.dat");
std::wofstream fs = move(fso);
fs << 3.25;
}
{
std::wifstream fs(temp);
std::wifstream fs("test.dat");
double x = 0;
fs >> x;
assert(x == 3.25);
}
remove(temp);
remove("test.dat");
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -19,28 +19,26 @@
int main()
{
char temp[L_tmpnam];
tmpnam(temp);
{
std::ofstream fs(temp);
std::ofstream fs("test.dat");
fs << 3.25;
}
{
std::ifstream fs(temp);
std::ifstream fs("test.dat");
double x = 0;
fs >> x;
assert(x == 3.25);
}
remove(temp);
remove("test.dat");
{
std::wofstream fs(temp);
std::wofstream fs("test.dat");
fs << 3.25;
}
{
std::wifstream fs(temp);
std::wifstream fs("test.dat");
double x = 0;
fs >> x;
assert(x == 3.25);
}
remove(temp);
remove("test.dat");
}

View File

@@ -19,28 +19,26 @@
int main()
{
char temp[L_tmpnam];
tmpnam(temp);
{
std::ofstream fs((std::string(temp)));
std::ofstream fs(std::string("test.dat"));
fs << 3.25;
}
{
std::ifstream fs((std::string(temp)));
std::ifstream fs(std::string("test.dat"));
double x = 0;
fs >> x;
assert(x == 3.25);
}
remove(temp);
remove("test.dat");
{
std::wofstream fs((std::string(temp)));
std::wofstream fs(std::string("test.dat"));
fs << 3.25;
}
{
std::wifstream fs((std::string(temp)));
std::wifstream fs(std::string("test.dat"));
double x = 0;
fs >> x;
assert(x == 3.25);
}
remove(temp);
remove("test.dat");
}

View File

@@ -19,24 +19,22 @@
int main()
{
char temp[L_tmpnam];
tmpnam(temp);
{
std::ofstream fs;
assert(!fs.is_open());
fs.open(temp);
fs.open("test.dat");
assert(fs.is_open());
fs.close();
assert(!fs.is_open());
}
remove(temp);
remove("test.dat");
{
std::wofstream fs;
assert(!fs.is_open());
fs.open(temp);
fs.open("test.dat");
assert(fs.is_open());
fs.close();
assert(!fs.is_open());
}
remove(temp);
remove("test.dat");
}

View File

@@ -19,40 +19,38 @@
int main()
{
char temp[L_tmpnam];
tmpnam(temp);
{
std::ofstream fs;
assert(!fs.is_open());
char c = 'a';
fs << c;
assert(fs.fail());
fs.open(temp);
fs.open("test.dat");
assert(fs.is_open());
fs << c;
}
{
std::ifstream fs(temp);
std::ifstream fs("test.dat");
char c = 0;
fs >> c;
assert(c == 'a');
}
remove(temp);
remove("test.dat");
{
std::wofstream fs;
assert(!fs.is_open());
wchar_t c = L'a';
fs << c;
assert(fs.fail());
fs.open(temp);
fs.open("test.dat");
assert(fs.is_open());
fs << c;
}
{
std::wifstream fs(temp);
std::wifstream fs("test.dat");
wchar_t c = 0;
fs >> c;
assert(c == L'a');
}
remove(temp);
remove("test.dat");
}

View File

@@ -19,40 +19,38 @@
int main()
{
char temp[L_tmpnam];
tmpnam(temp);
{
std::ofstream fs;
assert(!fs.is_open());
char c = 'a';
fs << c;
assert(fs.fail());
fs.open(std::string(temp));
fs.open(std::string("test.dat"));
assert(fs.is_open());
fs << c;
}
{
std::ifstream fs(temp);
std::ifstream fs("test.dat");
char c = 0;
fs >> c;
assert(c == 'a');
}
remove(temp);
remove("test.dat");
{
std::wofstream fs;
assert(!fs.is_open());
wchar_t c = L'a';
fs << c;
assert(fs.fail());
fs.open(std::string(temp));
fs.open(std::string("test.dat"));
assert(fs.is_open());
fs << c;
}
{
std::wifstream fs(temp);
std::wifstream fs("test.dat");
wchar_t c = 0;
fs >> c;
assert(c == L'a');
}
remove(temp);
remove("test.dat");
}

View File

@@ -19,18 +19,16 @@
int main()
{
char temp[L_tmpnam];
tmpnam(temp);
{
std::ofstream fs(temp);
std::ofstream fs("test.dat");
std::filebuf* fb = fs.rdbuf();
assert(fb->sputc('r') == 'r');
}
remove(temp);
remove("test.dat");
{
std::wofstream fs(temp);
std::wofstream fs("test.dat");
std::wfilebuf* fb = fs.rdbuf();
assert(fb->sputc(L'r') == L'r');
}
remove(temp);
remove("test.dat");
}

View File

@@ -22,7 +22,7 @@ class A
int data_;
public:
explicit A(int data) : data_(data) {}
virtual ~A() _NOEXCEPT {}
virtual ~A() {}
friend bool operator==(const A& x, const A& y) {return x.data_ == y.data_;}
};

View File

@@ -32,14 +32,10 @@ int main()
{
std::mbstate_t mb = {0};
std::size_t s = 0;
std::tm *tm = 0;
std::tm tm = {0};
std::wint_t w = 0;
::FILE* fp = 0;
#ifdef __APPLE__
__darwin_va_list va;
#else
__builtin_va_list va;
#endif
char* ns = 0;
wchar_t* ws = 0;
static_assert((std::is_same<decltype(std::fwprintf(fp, L"")), int>::value), "");
@@ -97,7 +93,7 @@ int main()
static_assert((std::is_same<decltype(std::wmemcpy(ws, L"", s)), wchar_t*>::value), "");
static_assert((std::is_same<decltype(std::wmemmove(ws, L"", s)), wchar_t*>::value), "");
static_assert((std::is_same<decltype(std::wmemset(ws, L' ', s)), wchar_t*>::value), "");
static_assert((std::is_same<decltype(std::wcsftime(ws, s, L"", tm)), std::size_t>::value), "");
static_assert((std::is_same<decltype(std::wcsftime(ws, s, L"", &tm)), std::size_t>::value), "");
static_assert((std::is_same<decltype(std::btowc(0)), wint_t>::value), "");
static_assert((std::is_same<decltype(std::wctob(w)), int>::value), "");
static_assert((std::is_same<decltype(std::mbsinit(&mb)), int>::value), "");

View File

@@ -42,7 +42,6 @@ int A::count = 0;
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::shared_ptr<A> pA(new A);
A* ptrA = pA.get();
@@ -119,5 +118,4 @@ int main()
}
assert(B::count == 0);
assert(A::count == 0);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -42,7 +42,6 @@ int A::count = 0;
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::shared_ptr<A> pA(new A);
A* ptrA = pA.get();
@@ -119,5 +118,4 @@ int main()
}
assert(B::count == 0);
assert(A::count == 0);
#endif // _LIBCXX_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -85,17 +85,9 @@ int main()
}
catch (...)
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
assert(A::count == 1);
assert(B::count == 1);
assert(ptr.get() == raw_ptr);
#else
// Without rvalue references, ptr got copied into
// the shared_ptr destructor and the copy was
// destroyed during unwinding.
assert(A::count == 0);
assert(B::count == 0);
#endif
}
}
assert(A::count == 0);

View File

@@ -77,15 +77,9 @@ int main()
}
catch (...)
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
assert(A::count == 1);
assert(B::count == 1);
assert(ptr.get() == raw_ptr);
#else
assert(A::count == 0);
assert(B::count == 0);
assert(ptr.get() == 0);
#endif
}
}
assert(A::count == 0);

View File

@@ -12,22 +12,8 @@
// underlying_type
#include <type_traits>
#include <climits>
int main()
{
enum E { V = INT_MIN };
enum F { W = UINT_MAX };
static_assert((std::is_same<std::underlying_type<E>::type, int>::value),
"E has the wrong underlying type");
static_assert((std::is_same<std::underlying_type<F>::type, unsigned>::value),
"F has the wrong underlying type");
#if __has_feature(cxx_strong_enums)
enum G : char { };
static_assert((std::is_same<std::underlying_type<G>::type, char>::value),
"G has the wrong underlying type");
#endif // __has_feature(cxx_strong_enums)
#error underlying_type is not implemented
}

View File

@@ -260,7 +260,7 @@ changed. Please see:
<tr>
<td><tt>underlying_type&lt;T&gt;</tt></td>
<td bgcolor="#80FF80"><tt>__underlying_type(T)</tt></td>
<td bgcolor="#FF5965"><tt>__underlying_type(T)</tt></td>
</tr>
<tr>