Compare commits

...

27 Commits

Author SHA1 Message Date
Dave Zarzycki
50a9361e2d "Tagging libcpp-31 from https://llvm.org/svn/llvm-project/libcxx/branches/apple"
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/tags/libcpp-31@138525 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-24 23:38:33 +00:00
Dave Zarzycki
1d41df08d3 More different better header install locations
<rdar://problem/9866843> Need to change install location of libc++ headers


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/apple@138524 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-24 23:37:58 +00:00
Dave Zarzycki
85c01426ad Install headers in more clang relative locations
Fix Apple bug 9978441 by installing the headers in yet more locations so
that clang may find them when installed as a part of iOS SDKs.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/apple@138209 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-20 19:00:48 +00:00
Howard Hinnant
3006f595eb Fixed <rdar://problem/9969674>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/apple@137860 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-17 20:30:53 +00:00
Howard Hinnant
84fd172cd6 Fix r9901265
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/apple@137565 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-13 23:20:02 +00:00
Howard Hinnant
9b3829cb5b Install headers at usr/clang-ide/lib/c++
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/apple@137152 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-09 21:34:49 +00:00
Howard Hinnant
da9c0f1fba Fix PR10507. http://llvm.org/bugs/show_bug.cgi?id=10507
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/apple@136575 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-30 17:40:17 +00:00
Howard Hinnant
a9ad2ca8bd Synch up with recent changes in trunk
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/apple@136574 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-30 17:35:20 +00:00
Howard Hinnant
8ffa5d58e0 Correct misspelling: _LIBCPP_APPLE_STABLE_ABI -> _LIBCPP_STABLE_APPLE_ABI
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/apple@136570 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-30 16:37:03 +00:00
Howard Hinnant
791e11cf33 Fix radar 9866843
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/apple@136569 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-30 16:35:55 +00:00
Howard Hinnant
4d933b2b44 Apple branch created
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/apple@136568 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-30 16:28:35 +00:00
Howard Hinnant
4f598034d2 http://llvm.org/bugs/show_bug.cgi?id=10469
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135897 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-24 23:59:50 +00:00
Howard Hinnant
fa06d75e8d Optimization of string::operator< by M.E. O'Neill. Discussion in http://llvm.org/bugs/show_bug.cgi?id=10461
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135893 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-24 21:45:06 +00:00
Howard Hinnant
2644a7b3da http://llvm.org/bugs/show_bug.cgi?id=10461
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135873 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-24 15:07:21 +00:00
Howard Hinnant
099084d52f http://llvm.org/bugs/show_bug.cgi?id=10455
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135854 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-23 16:14:35 +00:00
Dave Zarzycki
b3296ae5bc Test commit
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135774 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-22 17:08:57 +00:00
Howard Hinnant
bf6666f7a0 Correct test.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135460 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 01:07:49 +00:00
Sean Hunt
541cb301a1 Adjust two tests to account for a nasty change in copying behavior
between C++03 and C++0x and its effect on exceptions, and another two to
not test move construction when rvalue references are not available.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135445 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 23:51:25 +00:00
Sean Hunt
13aaf422e4 Make all fstream tests use tmpnam if creating files, rather than
hard-coded names.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135444 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 23:51:21 +00:00
Sean Hunt
e6440c6fa2 Do a litmus test of using tmpnam to generate safe temporary file names
for the tests that open new data files.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135422 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 20:46:16 +00:00
Sean Hunt
737a351850 Given that __underlying_type is now available in clang, implement
std::underlying_type.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135410 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 18:37:21 +00:00
Sean Hunt
2d81f3d1f3 Give A an explicitly non-throwing destructor so that B's destructor is
itself non-throwing.  Since nested_exception's destructor is
non-throwing, if B's destructor is not, this causes an error in C++03
mode due to the overriding function having a more lax specification.
This did not occur in C++0x mode as A's destructor was implicitly
non-throwing.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135400 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 17:07:53 +00:00
Howard Hinnant
464aa5cad3 http://llvm.org/bugs/show_bug.cgi?id=10390
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135393 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 15:51:59 +00:00
Howard Hinnant
bcbbd4d14f Revert locale for apple back to original design, getting rid of now useless helper *_l functions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135272 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 14:46:11 +00:00
Howard Hinnant
9a2078137f _LIBCXX_STABLE_APPLE_ABI -> _LIBCPP_STABLE_APPLE_ABI
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135271 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 14:25:40 +00:00
Sean Hunt
a78264f872 Fix wchar tests by not assuming that tm is complete and by using the
proper va_list time on non-darwin platforms.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135247 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 05:44:47 +00:00
Sean Hunt
f3907e6cc0 Reapply 135035 with proper conditional inclusion, hopefully solving
issues with it.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135246 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 05:40:33 +00:00
49 changed files with 918 additions and 549 deletions

View File

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

View File

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

View File

@@ -146,6 +146,9 @@ 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
@@ -188,6 +191,10 @@ 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__)
@@ -285,6 +292,10 @@ 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,9 +432,10 @@ public:
bool __value_constructed;
_LIBCPP_INLINE_VISIBILITY
explicit __hash_node_destructor(allocator_type& __na) _NOEXCEPT
explicit __hash_node_destructor(allocator_type& __na,
bool __constructed = false) _NOEXCEPT
: __na_(__na),
__value_constructed(false)
__value_constructed(__constructed)
{}
_LIBCPP_INLINE_VISIBILITY
@@ -1753,7 +1754,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()));
return __node_holder(__cn, _D(__node_alloc(), true));
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>

View File

@@ -1033,6 +1033,14 @@ 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,7 +204,9 @@ 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,7 +197,9 @@ 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,149 +197,202 @@ _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.
#if __APPLE__
#ifndef _LIBCPP_STABLE_APPLE_ABI
template <class _Tp>
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
decltype(MB_CUR_MAX_L(_VSTD::declval<locale_t>()))
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_sprintf(char* __restrict __str,
const char* __restrict __format, _Tp __v)
__mb_cur_max_l(locale_t __l)
{
return sprintf_l(__str, 0, __format, __v);
return MB_CUR_MAX_L(__l);
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_snprintf(char* __restrict __str, size_t __size,
const char* __restrict __format, _Tp __v)
#else // _LIBCPP_LOCALE__L_EXTENSIONS
_LIBCPP_ALWAYS_INLINE inline
decltype(MB_CUR_MAX) __mb_cur_max_l(locale_t __l)
{
return snprintf_l(__str, __size, 0, __format, __v);
__locale_raii __current(uselocale(__l), uselocale);
return MB_CUR_MAX;
}
#endif // _LIBCPP_LOCALE__L_EXTENSIONS
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_snprintf(char* __restrict __str, size_t __size,
const char* __restrict __format, int __prec, _Tp __v)
_LIBCPP_ALWAYS_INLINE inline
wint_t __btowc_l(int __c, locale_t __l)
{
return snprintf_l(__str, __size, 0, __format, __prec, __v);
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_asprintf(char** __ret, const char* __restrict __format, _Tp __v)
{
return asprintf_l(__ret, 0, __format, __v);
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_asprintf(char** __ret, const char* __restrict __format, int __prec,
_Tp __v)
{
return asprintf_l(__ret, 0, __format, __prec, __v);
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_sscanf(const char* __restrict __str,
const char* __restrict __format, _Tp* __v)
{
return sscanf_l(__str, 0, __format, __v);
}
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_isxdigit(int __c)
{
return isxdigit_l(__c, 0);
}
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_isdigit(int __c)
{
return isdigit_l(__c, 0);
}
#else // __APPLE__
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#ifdef _LIBCPP_STABLE_APPLE_ABI
return btowc_l(__c, __l);
#else
__locale_raii __current(uselocale(__l), uselocale);
return btowc(__c);
#endif
int
__nolocale_sprintf(char* __restrict __str,
const char* __restrict __format, ...)
{
va_list __ap;
va_start(__ap, __format);
int __result = vsprintf(__str, __format, __ap);
va_end(__ap);
return __result;
}
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, ...)
{
va_list __ap;
va_start(__ap, __format);
int __result = vsnprintf(__str, __size, __format, __ap);
va_end(__ap);
return __result;
}
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
int
__nolocale_asprintf(char** __ret,
const char* __restrict __format, ...)
{
va_list __ap;
va_start(__ap, __format);
int __result = vasprintf(__ret, __format, __ap);
va_end(__ap);
return __result;
}
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
int
__nolocale_sscanf(const char* __restrict __str,
const char* __restrict __format, ...)
{
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);
}
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_isdigit(int __c)
_LIBCPP_ALWAYS_INLINE inline
int __wctob_l(wint_t __c, locale_t __l)
{
return isdigit(__c);
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
return wctob_l(__c, __l);
#else
__locale_raii __current(uselocale(__l), uselocale);
return wctob(__c);
#endif
}
#endif // __APPLE__
_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)
{
#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
}
_LIBCPP_ALWAYS_INLINE 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
}
_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)
{
#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
}
_LIBCPP_ALWAYS_INLINE 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
}
_LIBCPP_ALWAYS_INLINE inline
int __mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
return mbtowc(__pwc, __pmb, __max, __l);
#else
__locale_raii __current(uselocale(__l), uselocale);
return mbtowc(__pwc, __pmb, __max);
#endif
}
_LIBCPP_ALWAYS_INLINE 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
}
_LIBCPP_ALWAYS_INLINE 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
}
_LIBCPP_ALWAYS_INLINE 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
}
_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;
}
_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
// __scan_keyword
// Scans [__b, __e) until a match is found in the basic_strings range
@@ -753,7 +806,11 @@ __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;
@@ -793,7 +850,11 @@ __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;
@@ -821,7 +882,11 @@ __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;
@@ -1226,7 +1291,11 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
break;
// Stage 3
__a[sizeof(__a)-1] = 0;
if (__nolocale_sscanf(__a, "%p", &__v) != 1)
#ifdef _LIBCPP_STABLE_APPLE_ABI
if (sscanf_l(__a, 0, "%p", &__v) != 1)
#else
if (__sscanf_l(__a, __cloc(), "%p", &__v) != 1)
#endif
__err = ios_base::failbit;
// EOF checked
if (__b == __e)
@@ -1331,13 +1400,21 @@ __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)
if (!__nolocale_isxdigit(*__ns))
#ifdef _LIBCPP_STABLE_APPLE_ABI
if (!isxdigit_l(*__ns, 0))
#else
if (!isxdigit_l(*__ns, __cloc()))
#endif
break;
}
else
{
for (__ns = __nf; __ns < __ne; ++__ns)
if (!__nolocale_isdigit(*__ns))
#ifdef _LIBCPP_STABLE_APPLE_ABI
if (!isdigit_l(*__ns, 0))
#else
if (!isdigit_l(*__ns, __cloc()))
#endif
break;
}
if (__grouping.empty())
@@ -1535,7 +1612,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+ ((numeric_limits<long>::digits % 3) != 0)
+ 1;
char __nar[__nbuf];
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
#ifdef _LIBCPP_STABLE_APPLE_ABI
int __nc = sprintf_l(__nar, 0, __fmt, __v);
#else
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
#endif
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar while adding thousands separators
@@ -1561,7 +1642,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+ ((numeric_limits<long long>::digits % 3) != 0)
+ 1;
char __nar[__nbuf];
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
#ifdef _LIBCPP_STABLE_APPLE_ABI
int __nc = sprintf_l(__nar, 0, __fmt, __v);
#else
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
#endif
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar while adding thousands separators
@@ -1587,7 +1672,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+ ((numeric_limits<unsigned long>::digits % 3) != 0)
+ 1;
char __nar[__nbuf];
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
#ifdef _LIBCPP_STABLE_APPLE_ABI
int __nc = sprintf_l(__nar, 0, __fmt, __v);
#else
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
#endif
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar while adding thousands separators
@@ -1613,7 +1702,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+ ((numeric_limits<unsigned long long>::digits % 3) != 0)
+ 1;
char __nar[__nbuf];
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
#ifdef _LIBCPP_STABLE_APPLE_ABI
int __nc = sprintf_l(__nar, 0, __fmt, __v);
#else
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
#endif
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar while adding thousands separators
@@ -1640,18 +1733,35 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
char* __nb = __nar;
int __nc;
if (__specify_precision)
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt,
#ifdef _LIBCPP_STABLE_APPLE_ABI
__nc = snprintf_l(__nb, __nbuf, 0, __fmt,
(int)__iob.precision(), __v);
#else
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt,
(int)__iob.precision(), __v);
#endif
else
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt, __v);
#ifdef _LIBCPP_STABLE_APPLE_ABI
__nc = snprintf_l(__nb, __nbuf, 0, __fmt, __v);
#else
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v);
#endif
unique_ptr<char, void(*)(void*)> __nbh(0, free);
if (__nc > static_cast<int>(__nbuf-1))
{
if (__specify_precision)
__nc = __nolocale_asprintf(&__nb, __fmt, (int)__iob.precision(),
__v);
#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
else
__nc = __nolocale_asprintf(&__nb, __fmt, __v);
#ifdef _LIBCPP_STABLE_APPLE_ABI
__nc = asprintf_l(&__nb, 0, __fmt, __v);
#else
__nc = __asprintf_l(&__nb, __cloc(), __fmt, (int)__iob.precision());
#endif
if (__nb == 0)
__throw_bad_alloc();
__nbh.reset(__nb);
@@ -1692,18 +1802,35 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
char* __nb = __nar;
int __nc;
if (__specify_precision)
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt,
#ifdef _LIBCPP_STABLE_APPLE_ABI
__nc = snprintf_l(__nb, __nbuf, 0, __fmt,
(int)__iob.precision(), __v);
#else
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt,
(int)__iob.precision(), __v);
#endif
else
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt, __v);
#ifdef _LIBCPP_STABLE_APPLE_ABI
__nc = snprintf_l(__nb, __nbuf, 0, __fmt, __v);
#else
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v);
#endif
unique_ptr<char, void(*)(void*)> __nbh(0, free);
if (__nc > static_cast<int>(__nbuf-1))
{
if (__specify_precision)
__nc = __nolocale_asprintf(&__nb, __fmt, (int)__iob.precision(),
__v);
#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
else
__nc = __nolocale_asprintf(&__nb, __fmt, __v);
#ifdef _LIBCPP_STABLE_APPLE_ABI
__nc = asprintf_l(&__nb, 0, __fmt, __v);
#else
__nc = __asprintf_l(&__nb, __cloc(), __fmt, (int)__iob.precision());
#endif
if (__nb == 0)
__throw_bad_alloc();
__nbh.reset(__nb);
@@ -1739,7 +1866,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
char __fmt[6] = "%p";
const unsigned __nbuf = 20;
char __nar[__nbuf];
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
#ifdef _LIBCPP_STABLE_APPLE_ABI
int __nc = sprintf_l(__nar, 0, __fmt, __v);
#else
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
#endif
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
// Stage 2 - Widen __nar
@@ -3423,7 +3554,11 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
// secure memory for digit storage
if (__n > __bs-1)
{
__n = __nolocale_asprintf(&__bb, "%.0Lf", __units);
#ifdef _LIBCPP_STABLE_APPLE_ABI
__n = asprintf_l(&__bb, 0, "%.0Lf", __units);
#else
__n = __asprintf_l(&__bb, __cloc(), "%.0Lf", __units);
#endif
if (__bb == 0)
__throw_bad_alloc();
__hn.reset(__bb);

View File

@@ -595,6 +595,7 @@ 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
@@ -1293,7 +1294,7 @@ struct __has_allocate_hint
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
#if !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class _Alloc, class _Tp, class ..._Args>
decltype(_VSTD::declval<_Alloc>().construct(_VSTD::declval<_Tp*>(),
@@ -4148,6 +4149,11 @@ 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

@@ -1577,6 +1577,27 @@ private:
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
#endif
_LIBCPP_INLINE_VISIBILITY
void
__move_assign_alloc(const basic_string& __str)
_NOEXCEPT_(
!__alloc_traits::propagate_on_container_move_assignment::value ||
is_nothrow_move_assignable<allocator_type>::value)
{__move_assign_alloc(__str, integral_constant<bool,
__alloc_traits::propagate_on_container_move_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const basic_string& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
{
__alloc() = _VSTD::move(__c.__alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const basic_string& __c, false_type)
_NOEXCEPT
{}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y)
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
@@ -2120,7 +2141,8 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr
{
clear();
shrink_to_fit();
__r_ = _VSTD::move(__str.__r_);
__r_.first() = __str.__r_.first();
__move_assign_alloc(__str);
__str.__zero();
}
@@ -3392,7 +3414,17 @@ _LIBCPP_INLINE_VISIBILITY inline
int
basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const _NOEXCEPT
{
return compare(0, npos, __str.data(), __str.size());
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;
}
template <class _CharT, class _Traits, class _Allocator>
@@ -3507,24 +3539,6 @@ 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
@@ -3534,24 +3548,6 @@ 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>
@@ -3589,25 +3585,7 @@ bool
operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
{
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;
return __lhs.compare(__rhs) < 0;
}
template<class _CharT, class _Traits, class _Allocator>
@@ -3616,25 +3594,7 @@ bool
operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
const _CharT* __rhs) _NOEXCEPT
{
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;
return __lhs.compare(__rhs) < 0;
}
template<class _CharT, class _Traits, class _Allocator>
@@ -3646,24 +3606,6 @@ 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>
@@ -3966,6 +3908,43 @@ 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,11 +3014,15 @@ 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)
{
@@ -3092,6 +3096,26 @@ 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<value_type>
rebind<const value_type>
#else
rebind<value_type>::other
rebind<const value_type>::other
#endif
pointer;

View File

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

View File

@@ -817,6 +817,8 @@ 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
@@ -2958,6 +2960,21 @@ 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,6 +56,7 @@ std::get_terminate() _NOEXCEPT
return __sync_fetch_and_add(&__terminate_handler, (std::terminate_handler)0);
}
_ATTRIBUTE(noreturn)
void
std::terminate() _NOEXCEPT
{

View File

@@ -22,101 +22,20 @@
#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
#ifndef _LIBCPP_APPLE_STABLE_ABI
#ifndef _LIBCPP_STABLE_APPLE_ABI
locale_t __cloc() {
// In theory this could create a race condition. In practice
// the race condition is non-fatal since it will just create
@@ -128,7 +47,7 @@ locale_t __cloc() {
return result;
#endif
}
#endif // _LIBCPP_APPLE_STABLE_ABI
#endif // _LIBCPP_STABLE_APPLE_ABI
namespace {
@@ -1023,7 +942,7 @@ ctype<char>::__classic_upper_table() _NOEXCEPT
return NULL;
#endif
}
#endif // _LIBCPP_APPLE_STABLE_ABI
#endif // _LIBCPP_STABLE_APPLE_ABI
// template <> class ctype_byname<char>
@@ -1245,21 +1164,33 @@ ctype_byname<wchar_t>::do_tolower(char_type* low, const char_type* high) const
wchar_t
ctype_byname<wchar_t>::do_widen(char c) const
{
return with_locale::btowc_l(c, __l);
#ifdef _LIBCPP_STABLE_APPLE_ABI
return btowc_l(c, __l);
#else
return __btowc_l(c, __l);
#endif
}
const char*
ctype_byname<wchar_t>::do_widen(const char* low, const char* high, char_type* dest) const
{
for (; low != high; ++low, ++dest)
*dest = with_locale::btowc_l(*low, __l);
#ifdef _LIBCPP_STABLE_APPLE_ABI
*dest = btowc_l(*low, __l);
#else
*dest = __btowc_l(*low, __l);
#endif
return low;
}
char
ctype_byname<wchar_t>::do_narrow(char_type c, char dfault) const
{
int r = with_locale::wctob_l(c, __l);
#ifdef _LIBCPP_STABLE_APPLE_ABI
int r = wctob_l(c, __l);
#else
int r = __wctob_l(c, __l);
#endif
return r != WEOF ? static_cast<char>(r) : dfault;
}
@@ -1268,7 +1199,11 @@ ctype_byname<wchar_t>::do_narrow(const char_type* low, const char_type* high, ch
{
for (; low != high; ++low, ++dest)
{
int r = with_locale::wctob_l(*low, __l);
#ifdef _LIBCPP_STABLE_APPLE_ABI
int r = wctob_l(*low, __l);
#else
int r = __wctob_l(*low, __l);
#endif
*dest = r != WEOF ? static_cast<char>(r) : dfault;
}
return low;
@@ -1378,13 +1313,21 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st,
{
// save state in case needed to reover to_nxt on error
mbstate_t save_state = st;
size_t n = with_locale::wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
#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
if (n == size_t(-1))
{
// need to recover to_nxt
for (to_nxt = to; frm != frm_nxt; ++frm)
{
n = with_locale::wcrtomb_l(to_nxt, *frm, &save_state, __l);
#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
if (n == size_t(-1))
break;
to_nxt += n;
@@ -1401,7 +1344,11 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st,
{
// Try to write the terminating null
extern_type tmp[MB_LEN_MAX];
n = with_locale::wcrtomb_l(tmp, intern_type(), &st, __l);
#ifdef _LIBCPP_STABLE_APPLE_ABI
n = wcrtomb_l(tmp, intern_type(), &st, __l);
#else
n = __wcrtomb_l(tmp, intern_type(), &st, __l);
#endif
if (n == size_t(-1)) // on error
return error;
if (n > to_end-to_nxt) // is there room?
@@ -1434,13 +1381,21 @@ codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st,
{
// save state in case needed to reover to_nxt on error
mbstate_t save_state = st;
size_t n = with_locale::mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
#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
if (n == size_t(-1))
{
// need to recover to_nxt
for (to_nxt = to; frm != frm_nxt; ++to_nxt)
{
n = with_locale::mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l);
#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
switch (n)
{
case 0:
@@ -1468,7 +1423,11 @@ codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st,
if (fend != frm_end) // set up next null terminated sequence
{
// Try to write the terminating null
n = with_locale::mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l);
#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
if (n != 0) // on error
return error;
++to_nxt;
@@ -1488,7 +1447,11 @@ codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st,
{
to_nxt = to;
extern_type tmp[MB_LEN_MAX];
size_t n = with_locale::wcrtomb_l(tmp, intern_type(), &st, __l);
#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
if (n == size_t(-1) || n == 0) // on error
return error;
--n;
@@ -1502,10 +1465,18 @@ codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st,
int
codecvt<wchar_t, char, mbstate_t>::do_encoding() const _NOEXCEPT
{
if (with_locale::mbtowc_l((wchar_t*) 0, (const char*) 0, MB_LEN_MAX, __l) == 0)
#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
{
// stateless encoding
if (__l == 0 || with_locale::mb_cur_max_l(__l) == 1) // there are no known constant length encodings
#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
return 1; // which take more than 1 char to form a wchar_t
return 0;
}
@@ -1525,7 +1496,11 @@ 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)
{
size_t n = with_locale::mbrlen_l(frm, frm_end-frm, &st, __l);
#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
switch (n)
{
case 0:
@@ -1547,7 +1522,11 @@ codecvt<wchar_t, char, mbstate_t>::do_length(state_type& st,
int
codecvt<wchar_t, char, mbstate_t>::do_max_length() const _NOEXCEPT
{
return __l == 0 ? 1 : with_locale::mb_cur_max_l(__l);
#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
}
// Valid UTF ranges
@@ -4090,13 +4069,17 @@ 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
lconv* lc = with_locale::localeconv_l(loc.get());
#ifdef _LIBCPP_STABLE_APPLE_ABI
lconv* lc = localeconv_l(loc.get());
#else
lconv* lc = __localeconv_l(loc.get());
#endif
if (*lc->decimal_point)
__decimal_point_ = *lc->decimal_point;
if (*lc->thousands_sep)
@@ -4129,13 +4112,17 @@ 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
lconv* lc = with_locale::localeconv_l(loc.get());
#ifdef _LIBCPP_STABLE_APPLE_ABI
lconv* lc = localeconv_l(loc.get());
#else
lconv* lc = __localeconv_l(loc.get());
#endif
if (*lc->decimal_point)
__decimal_point_ = *lc->decimal_point;
if (*lc->thousands_sep)
@@ -4726,7 +4713,11 @@ __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct)
wchar_t* wbb = wbuf;
mbstate_t mb = {0};
const char* bb = buf;
size_t i = with_locale::mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#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
if (i == -1)
__throw_runtime_error("locale not supported");
wchar_t* wbe = wbb + i;
@@ -4907,7 +4898,11 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
be = strftime_l(buf, 100, "%A", &t, __loc_);
mb = mbstate_t();
const char* bb = buf;
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#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
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
@@ -4915,7 +4910,11 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
be = strftime_l(buf, 100, "%a", &t, __loc_);
mb = mbstate_t();
bb = buf;
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#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
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
@@ -4928,7 +4927,11 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
be = strftime_l(buf, 100, "%B", &t, __loc_);
mb = mbstate_t();
const char* bb = buf;
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#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
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
@@ -4936,7 +4939,11 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
be = strftime_l(buf, 100, "%b", &t, __loc_);
mb = mbstate_t();
bb = buf;
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#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
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
@@ -4947,7 +4954,11 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
be = strftime_l(buf, 100, "%p", &t, __loc_);
mb = mbstate_t();
const char* bb = buf;
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#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
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
@@ -4956,7 +4967,11 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
be = strftime_l(buf, 100, "%p", &t, __loc_);
mb = mbstate_t();
bb = buf;
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#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
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
@@ -5231,7 +5246,11 @@ __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;
size_t j = with_locale::mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_);
#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
if (j == -1)
__throw_runtime_error("locale not supported");
__we = __wb + j;
@@ -5480,13 +5499,17 @@ 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
lconv* lc = with_locale::localeconv_l(loc.get());
#ifdef _LIBCPP_STABLE_APPLE_ABI
lconv* lc = localeconv_l(loc.get());
#else
lconv* lc = __localeconv_l(loc.get());
#endif
if (*lc->mon_decimal_point)
__decimal_point_ = *lc->mon_decimal_point;
else
@@ -5518,13 +5541,17 @@ 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
lconv* lc = with_locale::localeconv_l(loc.get());
#ifdef _LIBCPP_STABLE_APPLE_ABI
lconv* lc = localeconv_l(loc.get());
#else
lconv* lc = __localeconv_l(loc.get());
#endif
if (*lc->mon_decimal_point)
__decimal_point_ = *lc->mon_decimal_point;
else
@@ -5556,13 +5583,17 @@ 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
lconv* lc = with_locale::localeconv_l(loc.get());
#ifdef _LIBCPP_STABLE_APPLE_ABI
lconv* lc = localeconv_l(loc.get());
#else
lconv* lc = __localeconv_l(loc.get());
#endif
if (*lc->mon_decimal_point)
__decimal_point_ = static_cast<wchar_t>(*lc->mon_decimal_point);
else
@@ -5575,7 +5606,11 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
wchar_t wbuf[100];
mbstate_t mb = {0};
const char* bb = lc->currency_symbol;
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#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
if (j == -1)
__throw_runtime_error("locale not supported");
wchar_t* wbe = wbuf + j;
@@ -5590,7 +5625,11 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
{
mb = mbstate_t();
bb = lc->positive_sign;
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#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
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
@@ -5602,7 +5641,11 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
{
mb = mbstate_t();
bb = lc->negative_sign;
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#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
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
@@ -5617,13 +5660,17 @@ 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
lconv* lc = with_locale::localeconv_l(loc.get());
#ifdef _LIBCPP_STABLE_APPLE_ABI
lconv* lc = localeconv_l(loc.get());
#else
lconv* lc = __localeconv_l(loc.get());
#endif
if (*lc->mon_decimal_point)
__decimal_point_ = static_cast<wchar_t>(*lc->mon_decimal_point);
else
@@ -5636,7 +5683,11 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
wchar_t wbuf[100];
mbstate_t mb = {0};
const char* bb = lc->int_curr_symbol;
size_t j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#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
if (j == -1)
__throw_runtime_error("locale not supported");
wchar_t* wbe = wbuf + j;
@@ -5651,7 +5702,11 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
{
mb = mbstate_t();
bb = lc->positive_sign;
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#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
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
@@ -5663,7 +5718,11 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
{
mb = mbstate_t();
bb = lc->negative_sign;
j = with_locale::mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#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
if (j == -1)
__throw_runtime_error("locale not supported");
wbe = wbuf + j;

View File

@@ -32,10 +32,14 @@ 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), "");
@@ -88,7 +92,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,10 +19,12 @@
int main()
{
char temp[L_tmpnam];
tmpnam(temp);
{
std::filebuf f;
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.open(temp, 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);
@@ -33,11 +35,11 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == '2');
}
remove("test.dat");
remove(temp);
{
std::wfilebuf f;
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.open(temp, 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);
@@ -48,5 +50,5 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == L'2');
}
remove("test.dat");
remove(temp);
}

View File

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

View File

@@ -21,10 +21,12 @@
int main()
{
char temp[L_tmpnam];
tmpnam(temp);
{
std::filebuf f;
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.open(temp, 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 +37,11 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == '2');
}
remove("test.dat");
remove(temp);
{
std::wfilebuf f;
assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
| std::ios_base::trunc) != 0);
assert(f.open(temp, 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 +52,5 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == L'2');
}
remove("test.dat");
remove(temp);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -19,24 +19,26 @@
int main()
{
char temp[L_tmpnam];
tmpnam(temp);
{
std::fstream fs("test.dat", std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::fstream fs(temp, 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("test.dat");
std::remove(temp);
{
std::wfstream fs("test.dat", std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::wfstream fs(temp, 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("test.dat");
std::remove(temp);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -19,38 +19,40 @@
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("test.dat");
fs.open(temp);
assert(fs.is_open());
fs << c;
}
{
std::ifstream fs("test.dat");
std::ifstream fs(temp);
char c = 0;
fs >> c;
assert(c == 'a');
}
remove("test.dat");
remove(temp);
{
std::wofstream fs;
assert(!fs.is_open());
wchar_t c = L'a';
fs << c;
assert(fs.fail());
fs.open("test.dat");
fs.open(temp);
assert(fs.is_open());
fs << c;
}
{
std::wifstream fs("test.dat");
std::wifstream fs(temp);
wchar_t c = 0;
fs >> c;
assert(c == L'a');
}
remove("test.dat");
remove(temp);
}

View File

@@ -19,38 +19,40 @@
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("test.dat"));
fs.open(std::string(temp));
assert(fs.is_open());
fs << c;
}
{
std::ifstream fs("test.dat");
std::ifstream fs(temp);
char c = 0;
fs >> c;
assert(c == 'a');
}
remove("test.dat");
remove(temp);
{
std::wofstream fs;
assert(!fs.is_open());
wchar_t c = L'a';
fs << c;
assert(fs.fail());
fs.open(std::string("test.dat"));
fs.open(std::string(temp));
assert(fs.is_open());
fs << c;
}
{
std::wifstream fs("test.dat");
std::wifstream fs(temp);
wchar_t c = 0;
fs >> c;
assert(c == L'a');
}
remove("test.dat");
remove(temp);
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -85,9 +85,17 @@ 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,9 +77,15 @@ 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,8 +12,22 @@
// underlying_type
#include <type_traits>
#include <climits>
int main()
{
#error underlying_type is not implemented
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)
}

View File

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