Compare commits

..

40 Commits

Author SHA1 Message Date
NAKAMURA Takumi
b13c5fc1a9 Suppress condition/mutex/thread stuff. 2011-05-01 21:53:00 +09:00
NAKAMURA Takumi
4e66976786 Suppress test/localization. 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
8074505c5d test: Suppress exception-required tests. 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
efdce87766 Suppress -fPIC. 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
fd9aadef51 test: Add _win32_seterrormode.fail.cpp to silence Exception diaalogs on Windows desktop. 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
6d50da017f test/utilities/type.index/type.index.members/lt.pass.cpp: I don't understand what it is! 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
ae185c2977 test: wchar_t might be "unsigned short" for Win32 targets. 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
79356f49bd fstream: fseeko, ftello 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
9117a0a174 test/diagnostics/*err*: Disable 4 tests lack of system_error. 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
591952787f chrono.cpp: suppress clock_gettime() 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
8082261d2c codecvt<wchar_t, char, mbstate_t>::do_unshift(): return noconv 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
b101cb1408 locale.cpp: tweak strftime_l to strftime 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
cb5181c5a2 locale.cpp: disabled wip 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
c3089afe8d locale.cpp: Tweak for Win32, newlocale() and freelocale(). 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
be2e6396c3 locale.cpp: Tweak for Win32. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
0428d2a325 locale: suppress long double 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
5ee0769693 locale: Add bogus asprintf() for Win32. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
164d6b8bda locale: Win32 tweak. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
117920302f locale: Supress NLS things. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
16acf2ae93 system_error: FIXME: WS2 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
f9d6039245 string.cpp: SECURE_API and swprintf_s() 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
4cf42dadd4 __locale: _isctype 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
51ae55e510 __locale: Add LC_XXX_MASK for Win32. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
aeaeb51343 __locale: std::uint32_t may be available here. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
b05cdf81ba test/lit.cfg: Remove -nodefaultlibs for mingw32-clang. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
4a796725e0 test/lit.cfg: Fix suffix. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
5a9ed2486b __config: mingw32 no-excpetions 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
beb21a0990 __config: #define _LIBCPP_VISIBILITY_TAG 0 // on mingw32. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
12f526f712 __config: Add endian check based on target processor. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
bd94c33cc3 __config: Tweak yvals.h macro to avoid symbol clashes. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
9dc188d64d new.cpp: split new and delete into 8 files. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
9055a62ed4 new: move __new_hander to _STD. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
17c8c462ae exception.cpp: std::uncaught_exception() may return false with -fno-exceptions. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
ec97728ba0 test/utilities: Fix LLP64-aware. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
cb430f3a47 test: Mark 316 tests as XFAIL to rename to xfail.pass.cpp. 2011-05-01 21:52:09 +09:00
NAKAMURA Takumi
d3665e1d9d test/lit.cfg: Add .xfail.pass.cpp, to expect compiling successfully and to fail to run. 2011-05-01 21:52:08 +09:00
NAKAMURA Takumi
6911fb59fd Mark 218 tests as fail to compile lack of C++0x features. 2011-05-01 21:52:08 +09:00
NAKAMURA Takumi
a177c5da7b test/lit.cfg: Python-2.4 does not accept "delete" in tempfile.NamedTemporaryFile. 2011-05-01 21:52:08 +09:00
NAKAMURA Takumi
352c9e1a46 __std_stream: Fix error checking in __stdoutbuf<_CharT>::sync(). 2011-05-01 21:52:08 +09:00
NAKAMURA Takumi
710f61ba2a include/__locale: Tweak __tab_.
FIXME: wip! wip!
2011-05-01 21:52:08 +09:00
1059 changed files with 1284 additions and 87158 deletions

View File

@@ -9,12 +9,6 @@ OBJROOT=.
SYMROOT=.
export TRIPLE=-apple-
ifeq (,$(RC_INDIGO))
INSTALL_PREFIX=""
else
INSTALL_PREFIX="$(SDKROOT)"
endif
installsrc:: $(SRCROOT)
ditto $(SRCDIRS)/include $(SRCROOT)/include
@@ -26,19 +20,19 @@ 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)/usr/include/c++/v1/ext
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/usr/include/c++/v1/
chown -R root:wheel $(DSTROOT)/usr/include
chmod 755 $(DSTROOT)/usr/include/c++/v1
chmod 644 $(DSTROOT)/usr/include/c++/v1/*
chmod 755 $(DSTROOT)/usr/include/c++/v1/ext
chmod 644 $(DSTROOT)/usr/include/c++/v1/ext/*
install:: installhdrs $(DESTDIR)
cd lib && ./buildit
ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM $(SYMROOT)/usr/lib/libc++.1.dylib
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib
strip -S -o $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
cd $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib && ln -s libc++.1.dylib libc++.dylib
mkdir -p $(DSTROOT)/usr/lib
strip -S -o $(DSTROOT)/usr/lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
cd $(DSTROOT)/usr/lib && ln -s libc++.1.dylib libc++.dylib

View File

@@ -25,7 +25,6 @@ check_cxx_compiler_flag(/GR- LIBCXX_HAS_NO_GR_FLAG)
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
check_library_exists(c printf "" LIBCXX_HAS_C_LIB)
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
# Check C++0x features

View File

@@ -13,6 +13,13 @@
#pragma GCC system_header
#ifdef __MINGW32__
#include <yvals.h>
#undef _STD
#undef _C2
#define _LIBCPP_VISIBILITY_TAG 0
#endif
#define _LIBCPP_VERSION 1000
#define _LIBCPP_ABI_VERSION 1
@@ -47,10 +54,10 @@
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
#endif // __FreeBSD__
#ifdef _WIN32
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
#endif // _WIN32
#if !defined(_LIBCPP_LITTLE_ENDIAN) && (defined(__i386__) || defined(__x86_64__))
#define _LIBCPP_LITTLE_ENDIAN 1
#define _LIBCPP_BIG_ENDIAN 0
#endif
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
# include <endian.h>
@@ -91,9 +98,8 @@
#if defined(__clang__)
//#if !__has_feature(cxx_alias_templates)
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
//#endif
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#ifdef __linux__
@@ -104,7 +110,7 @@ typedef __char32_t char32_t;
#endif
#endif
#if !(__has_feature(cxx_exceptions))
#if !(__has_feature(cxx_exceptions)) || defined(__MINGW32__)
#define _LIBCPP_NO_EXCEPTIONS
#endif
@@ -144,7 +150,6 @@ typedef __char32_t char32_t;
#if !(__has_feature(cxx_auto_type))
#define _LIBCPP_HAS_NO_AUTO_TYPE
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#endif
#if !(__has_feature(cxx_variadic_templates))
@@ -169,14 +174,6 @@ namespace std {
#define _LIBCPP_HAS_NO_CONSTEXPR
#endif
#if (__has_feature(cxx_noexcept))
# define _NOEXCEPT noexcept
# define _NOEXCEPT_(x) noexcept(x)
#else
# define _NOEXCEPT throw()
# define _NOEXCEPT_(x)
#endif
// end defined(__clang__)
#elif defined(__GNUC__)
@@ -188,9 +185,6 @@ namespace std {
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_CONSTEXPR
#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE

View File

@@ -281,55 +281,161 @@ struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const volatile>
// __invoke
// bullets 1 and 2
// first bullet
template <class _F, class _A0, class ..._Args>
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype((_STD::forward<_A0>(__a0).*__f)(_STD::forward<_Args>(__args)...))
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...), _T1&& __t1, _Arg&& ...__arg)
{
return (_STD::forward<_A0>(__a0).*__f)(_STD::forward<_Args>(__args)...);
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _F, class _A0, class ..._Args>
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype(((*_STD::forward<_A0>(__a0)).*__f)(_STD::forward<_Args>(__args)...))
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_A0>(__a0)).*__f)(_STD::forward<_Args>(__args)...);
return (_STD::forward<const _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
}
// bullets 3 and 4
template <class _F, class _A0>
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_F&& __f, _A0&& __a0)
-> decltype(_STD::forward<_A0>(__a0).*__f)
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) volatile, _T1&& __t1, _Arg&& ...__arg)
{
return _STD::forward<_A0>(__a0).*__f;
return (_STD::forward<volatile _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _F, class _A0>
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_F&& __f, _A0&& __a0)
-> decltype((*_STD::forward<_A0>(__a0)).*__f)
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const volatile, _T1&& __t1, _Arg&& ...__arg)
{
return (*_STD::forward<_A0>(__a0)).*__f;
return (_STD::forward<const volatile _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
}
// bullet 5
// second bullet
template <class _F, class ..._Args>
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_F&& __f, _Args&& ...__args)
-> decltype(_STD::forward<_F>(__f)(_STD::forward<_Args>(__args)...))
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...), _T1&& __t1, _Arg&& ...__arg)
{
return _STD::forward<_F>(__f)(_STD::forward<_Args>(__args)...);
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) volatile, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const volatile, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
// third bullet
template <class _R, class _T, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_base_of<_T, typename remove_reference<_T1>::type>::value,
typename __apply_cv<_T1, _R>::type&&
>::type
__invoke(_R _T::* __f, _T1&& __t1)
{
return _STD::forward<_T1>(__t1).*__f;
}
// forth bullet
template <class _T1, class _R, bool>
struct __4th_helper
{
};
template <class _T1, class _R>
struct __4th_helper<_T1, _R, true>
{
typedef typename __apply_cv<decltype(*_STD::declval<_T1>()), _R>::type type;
};
template <class _R, class _T, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename __4th_helper<_T1, _R,
!is_base_of<_T,
typename remove_reference<_T1>::type
>::value
>::type&&
__invoke(_R _T::* __f, _T1&& __t1)
{
return (*_STD::forward<_T1>(__t1)).*__f;
}
// fifth bullet
template <class _F, class ..._T>
inline _LIBCPP_INLINE_VISIBILITY
typename result_of<_F(_T...)>::type
__invoke(_F&& __f, _T&& ...__t)
{
return _STD::forward<_F>(__f)(_STD::forward<_T>(__t)...);
}
template <class _Tp, class ..._Args>
@@ -362,7 +468,7 @@ public:
// invoke
template <class... _ArgTypes>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_of<type&, _ArgTypes...>::type
typename __invoke_return<type&, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const
{
return __invoke(get(), _STD::forward<_ArgTypes>(__args)...);

View File

@@ -19,7 +19,21 @@
#include <cstdint>
#include <cctype>
#include <locale.h>
#ifdef __MINGW32__
typedef _locale_t locale_t;
#include <xlocinfo.h>
#define LC_COLLATE_MASK _M_COLLATE
#define LC_CTYPE_MASK _M_CTYPE
#define LC_MONETARY_MASK _M_MONETARY
#define LC_NUMERIC_MASK _M_NUMERIC
#define LC_TIME_MASK _M_TIME
#define LC_MESSAGES_MASK _M_MESSAGES
#define LC_ALL_MASK _M_ALL
#else
#include <xlocale.h>
#endif
#pragma GCC system_header
@@ -302,7 +316,7 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
class _LIBCPP_VISIBLE ctype_base
{
public:
typedef __uint32_t mask;
typedef std::uint32_t mask;
#if __APPLE__
static const mask space = _CTYPE_S;
@@ -315,6 +329,17 @@ public:
static const mask punct = _CTYPE_P;
static const mask xdigit = _CTYPE_X;
static const mask blank = _CTYPE_B;
#elif defined(__MINGW32__)
static const mask space = _SPACE;
static const mask print = (_BLANK|_PUNCT|_ALPHA|_DIGIT);
static const mask cntrl = _CONTROL;
static const mask upper = _UPPER;
static const mask lower = _LOWER;
static const mask alpha = _ALPHA;
static const mask digit = _DIGIT;
static const mask punct = _PUNCT;
static const mask xdigit = _HEX;
static const mask blank = _BLANK;
#else // __APPLE__
static const mask space = _ISspace;
static const mask print = _ISprint;
@@ -451,7 +476,7 @@ public:
_LIBCPP_ALWAYS_INLINE
bool is(mask __m, char_type __c) const
{
return isascii(__c) ? __tab_[__c] & __m : false;
return isascii(__c) ? (__tab_ ? __tab_[__c] & __m : _isctype(__c, __m)) : false;
}
_LIBCPP_ALWAYS_INLINE

View File

@@ -14,7 +14,35 @@
#include <__config>
#include <chrono>
#include <system_error>
#ifdef __MINGW32__
typedef unsigned pthread_t;
typedef unsigned pthread_mutex_t;
typedef unsigned pthread_mutexattr_t;
typedef unsigned pthread_cond_t;
typedef unsigned pthread_key_t;
#define PTHREAD_MUTEX_INITIALIZER 0
#define PTHREAD_COND_INITIALIZER 0
#define PTHREAD_MUTEX_RECURSIVE 0
#define pthread_mutex_init(a,b) (*(a) = 0, -1)
#define pthread_mutex_destroy(a) (-1)
#define pthread_mutex_lock(a) (-1)
#define pthread_mutex_trylock(a) (-1)
#define pthread_mutex_unlock(a) (-1)
#define pthread_mutexattr_settype(a,b) (*(a) = (b), -1)
#define pthread_mutexattr_init(a) (*(a) = 0, -1)
#define pthread_mutexattr_destroy(a) (-1)
#define pthread_self() (-1)
#define pthread_equal(a,b) (0)
#define pthread_getspecific(a) ((void*)0)
#define pthread_cond_destroy(a) (-1)
#define pthread_cond_signal(a) (-1)
#define pthread_cond_broadcast(a) (-1)
#define pthread_cond_wait(a,b) (-1)
#define pthread_cond_timedwait(a,b,c) (-1)
#define sched_yield() (-1)
#else
#include <pthread.h>
#endif
#pragma GCC system_header

View File

@@ -288,12 +288,12 @@ __stdoutbuf<_CharT>::sync()
__r = __cv_->unshift(__st_, __extbuf,
__extbuf + sizeof(__extbuf),
__extbe);
if (__r == codecvt_base::error)
return -1;
size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb)
return -1;
} while (__r == codecvt_base::partial);
if (__r == codecvt_base::error)
return -1;
if (fflush(__file_))
return -1;
return 0;

View File

@@ -303,340 +303,8 @@ long double truncl(long double x);
#pragma GCC system_header
// signbit
#ifdef signbit
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_signbit(_A1 __x)
{
return signbit(__x);
}
#undef signbit
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
signbit(_A1 __x)
{
return __libcpp_signbit(__x);
}
#endif // signbit
// fpclassify
#ifdef fpclassify
template <class _A1>
_LIBCPP_ALWAYS_INLINE
int
__libcpp_fpclassify(_A1 __x)
{
return fpclassify(__x);
}
#undef fpclassify
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_floating_point<_A1>::value, int>::type
fpclassify(_A1 __x)
{
return __libcpp_fpclassify(__x);
}
#endif // fpclassify
// isfinite
#ifdef isfinite
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isfinite(_A1 __x)
{
return isfinite(__x);
}
#undef isfinite
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
isfinite(_A1 __x)
{
return __libcpp_isfinite(__x);
}
#endif // isfinite
// isinf
#ifdef isinf
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isinf(_A1 __x)
{
return isinf(__x);
}
#undef isinf
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
isinf(_A1 __x)
{
return __libcpp_isinf(__x);
}
#endif // isinf
// isnan
#ifdef isnan
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isnan(_A1 __x)
{
return isnan(__x);
}
#undef isnan
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
isnan(_A1 __x)
{
return __libcpp_isnan(__x);
}
#endif // isnan
// isnormal
#ifdef isnormal
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isnormal(_A1 __x)
{
return isnormal(__x);
}
#undef isnormal
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
isnormal(_A1 __x)
{
return __libcpp_isnormal(__x);
}
#endif // isnormal
// isgreater
#ifdef isgreater
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isgreater(_A1 __x, _A2 __y)
{
return isgreater(__x, __y);
}
#undef isgreater
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if
<
std::is_floating_point<_A1>::value &&
std::is_floating_point<_A2>::value,
bool
>::type
isgreater(_A1 __x, _A2 __y)
{
return __libcpp_isgreater(__x, __y);
}
#endif // isgreater
// isgreaterequal
#ifdef isgreaterequal
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isgreaterequal(_A1 __x, _A2 __y)
{
return isgreaterequal(__x, __y);
}
#undef isgreaterequal
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if
<
std::is_floating_point<_A1>::value &&
std::is_floating_point<_A2>::value,
bool
>::type
isgreaterequal(_A1 __x, _A2 __y)
{
return __libcpp_isgreaterequal(__x, __y);
}
#endif // isgreaterequal
// isless
#ifdef isless
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isless(_A1 __x, _A2 __y)
{
return isless(__x, __y);
}
#undef isless
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if
<
std::is_floating_point<_A1>::value &&
std::is_floating_point<_A2>::value,
bool
>::type
isless(_A1 __x, _A2 __y)
{
return __libcpp_isless(__x, __y);
}
#endif // isless
// islessequal
#ifdef islessequal
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_islessequal(_A1 __x, _A2 __y)
{
return islessequal(__x, __y);
}
#undef islessequal
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if
<
std::is_floating_point<_A1>::value &&
std::is_floating_point<_A2>::value,
bool
>::type
islessequal(_A1 __x, _A2 __y)
{
return __libcpp_islessequal(__x, __y);
}
#endif // islessequal
// islessgreater
#ifdef islessgreater
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_islessgreater(_A1 __x, _A2 __y)
{
return islessgreater(__x, __y);
}
#undef islessgreater
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if
<
std::is_floating_point<_A1>::value &&
std::is_floating_point<_A2>::value,
bool
>::type
islessgreater(_A1 __x, _A2 __y)
{
return __libcpp_islessgreater(__x, __y);
}
#endif // islessgreater
// isunordered
#ifdef isunordered
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isunordered(_A1 __x, _A2 __y)
{
return isunordered(__x, __y);
}
#undef isunordered
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if
<
std::is_floating_point<_A1>::value &&
std::is_floating_point<_A2>::value,
bool
>::type
isunordered(_A1 __x, _A2 __y)
{
return __libcpp_isunordered(__x, __y);
}
#endif // isunordered
_LIBCPP_BEGIN_NAMESPACE_STD
using ::signbit;
using ::fpclassify;
using ::isfinite;
using ::isinf;
using ::isnan;
using ::isnormal;
using ::isgreater;
using ::isgreaterequal;
using ::isless;
using ::islessequal;
using ::islessgreater;
using ::isunordered;
using ::isunordered;
using ::float_t;
using ::double_t;
@@ -961,6 +629,348 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
tanh(_A1 __x) {return tanh((double)__x);}
// signbit
#ifndef signbit
#error Implementation error: signbit not defined
#else
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_signbit(_A1 __x)
{
return signbit(__x);
}
#undef signbit
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, bool>::type
signbit(_A1 __x)
{
return __libcpp_signbit(__x);
}
#endif // signbit
// fpclassify
#ifndef fpclassify
#error Implementation error: fpclassify not defined
#else
template <class _A1>
_LIBCPP_ALWAYS_INLINE
int
__libcpp_fpclassify(_A1 __x)
{
return fpclassify(__x);
}
#undef fpclassify
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, int>::type
fpclassify(_A1 __x)
{
return __libcpp_fpclassify(__x);
}
#endif // fpclassify
// isfinite
#ifndef isfinite
#error Implementation error: isfinite not defined
#else
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isfinite(_A1 __x)
{
return isfinite(__x);
}
#undef isfinite
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, bool>::type
isfinite(_A1 __x)
{
return __libcpp_isfinite(__x);
}
#endif // isfinite
// isinf
#ifndef isinf
#error Implementation error: isinf not defined
#else
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isinf(_A1 __x)
{
return isinf(__x);
}
#undef isinf
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, bool>::type
isinf(_A1 __x)
{
return __libcpp_isinf(__x);
}
#endif // isinf
// isnan
#ifndef isnan
#error Implementation error: isnan not defined
#else
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isnan(_A1 __x)
{
return isnan(__x);
}
#undef isnan
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, bool>::type
isnan(_A1 __x)
{
return __libcpp_isnan(__x);
}
#endif // isnan
// isnormal
#ifndef isnormal
#error Implementation error: isnormal not defined
#else
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isnormal(_A1 __x)
{
return isnormal(__x);
}
#undef isnormal
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, bool>::type
isnormal(_A1 __x)
{
return __libcpp_isnormal(__x);
}
#endif // isnormal
// isgreater
#ifndef isgreater
#error Implementation error: isgreater not defined
#else
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isgreater(_A1 __x, _A2 __y)
{
return isgreater(__x, __y);
}
#undef isgreater
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_floating_point<_A1>::value &&
is_floating_point<_A2>::value,
bool
>::type
isgreater(_A1 __x, _A2 __y)
{
return __libcpp_isgreater(__x, __y);
}
#endif // isgreater
// isgreaterequal
#ifndef isgreaterequal
#error Implementation error: isgreaterequal not defined
#else
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isgreaterequal(_A1 __x, _A2 __y)
{
return isgreaterequal(__x, __y);
}
#undef isgreaterequal
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_floating_point<_A1>::value &&
is_floating_point<_A2>::value,
bool
>::type
isgreaterequal(_A1 __x, _A2 __y)
{
return __libcpp_isgreaterequal(__x, __y);
}
#endif // isgreaterequal
// isless
#ifndef isless
#error Implementation error: isless not defined
#else
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isless(_A1 __x, _A2 __y)
{
return isless(__x, __y);
}
#undef isless
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_floating_point<_A1>::value &&
is_floating_point<_A2>::value,
bool
>::type
isless(_A1 __x, _A2 __y)
{
return __libcpp_isless(__x, __y);
}
#endif // isless
// islessequal
#ifndef islessequal
#error Implementation error: islessequal not defined
#else
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_islessequal(_A1 __x, _A2 __y)
{
return islessequal(__x, __y);
}
#undef islessequal
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_floating_point<_A1>::value &&
is_floating_point<_A2>::value,
bool
>::type
islessequal(_A1 __x, _A2 __y)
{
return __libcpp_islessequal(__x, __y);
}
#endif // islessequal
// islessgreater
#ifndef islessgreater
#error Implementation error: islessgreater not defined
#else
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_islessgreater(_A1 __x, _A2 __y)
{
return islessgreater(__x, __y);
}
#undef islessgreater
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_floating_point<_A1>::value &&
is_floating_point<_A2>::value,
bool
>::type
islessgreater(_A1 __x, _A2 __y)
{
return __libcpp_islessgreater(__x, __y);
}
#endif // islessgreater
// isunordered
#ifndef isunordered
#error Implementation error: isunordered not defined
#else
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
__libcpp_isunordered(_A1 __x, _A2 __y)
{
return isunordered(__x, __y);
}
#undef isunordered
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_floating_point<_A1>::value &&
is_floating_point<_A2>::value,
bool
>::type
isunordered(_A1 __x, _A2 __y)
{
return __libcpp_isunordered(__x, __y);
}
#endif // isunordered
// acosh
using ::acosh;

View File

@@ -173,6 +173,11 @@ typedef basic_fstream<wchar_t> wfstream;
#pragma GCC system_header
#ifdef _WIN32
#define fseeko fseek
#define ftello ftell
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>

View File

@@ -1510,12 +1510,21 @@ __mu(reference_wrapper<_Tp> __t, _Uj&)
return __t.get();
}
template <bool _IsBindExpr, class _Ti, class ..._Uj>
struct __mu_return1 {};
template <class _Ti, class ..._Uj>
struct __mu_return1<true, _Ti, _Uj...>
{
typedef typename result_of<_Ti(_Uj...)>::type type;
};
template <class _Ti, class ..._Uj, size_t ..._Indx>
inline _LIBCPP_INLINE_VISIBILITY
typename __invoke_of<_Ti&, _Uj...>::type
__mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>)
typename __mu_return1<true, _Ti, _Uj...>::type
__mu_expand(_Ti& __ti, tuple<_Uj...>&& __uj, __tuple_indices<_Indx...>)
{
return __ti(_STD::forward<_Uj>(get<_Indx>(__uj))...);
return __ti(_STD::forward<typename tuple_element<_Indx, _Uj>::type>(get<_Indx>(__uj))...);
}
template <class _Ti, class ..._Uj>
@@ -1523,7 +1532,7 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_bind_expression<_Ti>::value,
typename __invoke_of<_Ti&, _Uj...>::type
typename __mu_return1<is_bind_expression<_Ti>::value, _Ti, _Uj...>::type
>::type
__mu(_Ti& __ti, tuple<_Uj...>& __uj)
{
@@ -1567,31 +1576,24 @@ __mu(_Ti& __ti, _Uj& __uj)
return __ti;
}
template <class _Ti, bool IsReferenceWrapper, bool IsBindEx, bool IsPh,
class _TupleUj>
template <class _Ti, bool IsBindEx, bool IsPh, class _TupleUj>
struct ____mu_return;
template <class _Ti, class ..._Uj>
struct ____mu_return<_Ti, false, true, false, tuple<_Uj...> >
struct ____mu_return<_Ti, true, false, tuple<_Uj...> >
{
typedef typename __invoke_of<_Ti&, _Uj...>::type type;
typedef typename result_of<_Ti(_Uj...)>::type type;
};
template <class _Ti, class _TupleUj>
struct ____mu_return<_Ti, false, false, true, _TupleUj>
struct ____mu_return<_Ti, false, true, _TupleUj>
{
typedef typename tuple_element<is_placeholder<_Ti>::value - 1,
_TupleUj>::type&& type;
};
template <class _Ti, class _TupleUj>
struct ____mu_return<_Ti, true, false, false, _TupleUj>
{
typedef typename _Ti::type& type;
};
template <class _Ti, class _TupleUj>
struct ____mu_return<_Ti, false, false, false, _TupleUj>
struct ____mu_return<_Ti, false, false, _TupleUj>
{
typedef _Ti& type;
};
@@ -1599,20 +1601,25 @@ struct ____mu_return<_Ti, false, false, false, _TupleUj>
template <class _Ti, class _TupleUj>
struct __mu_return
: public ____mu_return<_Ti,
__is_reference_wrapper<_Ti>::value,
is_bind_expression<_Ti>::value,
0 < is_placeholder<_Ti>::value,
_TupleUj>
{
};
template <class _Ti, class _TupleUj>
struct __mu_return<reference_wrapper<_Ti>, _TupleUj>
{
typedef _Ti& type;
};
template <class _F, class _BoundArgs, class _TupleUj>
struct __bind_return;
template <class _F, class ..._BoundArgs, class _TupleUj>
struct __bind_return<_F, tuple<_BoundArgs...>, _TupleUj>
{
typedef typename __invoke_of
typedef typename __invoke_return
<
_F&,
typename __mu_return
@@ -1626,7 +1633,7 @@ struct __bind_return<_F, tuple<_BoundArgs...>, _TupleUj>
template <class _F, class ..._BoundArgs, class _TupleUj>
struct __bind_return<_F, const tuple<_BoundArgs...>, _TupleUj>
{
typedef typename __invoke_of
typedef typename __invoke_return
<
_F&,
typename __mu_return
@@ -1648,12 +1655,10 @@ __apply_functor(_F& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>,
template<class _F, class ..._BoundArgs>
class __bind
: public __weak_result_type<typename decay<_F>::type>
: public __weak_result_type<_F>
{
typedef typename decay<_F>::type _Fd;
typedef tuple<typename decay<_BoundArgs>::type...> _Td;
_Fd __f_;
_Td __bound_args_;
_F __f_;
tuple<_BoundArgs...> __bound_args_;
typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
public:
@@ -1670,16 +1675,17 @@ public:
template <class ..._Args>
_LIBCPP_INLINE_VISIBILITY
typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type
typename __bind_return<_F, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
operator()(_Args&& ...__args)
{
// compiler bug workaround
return __apply_functor(__f_, __bound_args_, __indices(),
tuple<_Args&&...>(_STD::forward<_Args>(__args)...));
}
template <class ..._Args>
_LIBCPP_INLINE_VISIBILITY
typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type
typename __bind_return<_F, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
operator()(_Args&& ...__args) const
{
return __apply_functor(__f_, __bound_args_, __indices(),
@@ -1698,10 +1704,6 @@ class __bind_r
public:
typedef _R result_type;
_LIBCPP_INLINE_VISIBILITY
__bind_r(__bind_r&& __b)
: base(_STD::forward<base>(__b)) {}
template <class _G, class ..._BA>
_LIBCPP_INLINE_VISIBILITY
explicit __bind_r(_G&& __f, _BA&& ...__bound_args)
@@ -1730,19 +1732,19 @@ struct __is_bind_expression<__bind_r<_R, _F, _BoundArgs...> > : public true_type
template<class _F, class ..._BoundArgs>
inline _LIBCPP_INLINE_VISIBILITY
__bind<_F, _BoundArgs...>
__bind<typename decay<_F>::type, typename decay<_BoundArgs>::type...>
bind(_F&& __f, _BoundArgs&&... __bound_args)
{
typedef __bind<_F, _BoundArgs...> type;
typedef __bind<typename decay<_F>::type, typename decay<_BoundArgs>::type...> type;
return type(_STD::forward<_F>(__f), _STD::forward<_BoundArgs>(__bound_args)...);
}
template<class _R, class _F, class ..._BoundArgs>
inline _LIBCPP_INLINE_VISIBILITY
__bind_r<_R, _F, _BoundArgs...>
__bind_r<_R, typename decay<_F>::type, typename decay<_BoundArgs>::type...>
bind(_F&& __f, _BoundArgs&&... __bound_args)
{
typedef __bind_r<_R, _F, _BoundArgs...> type;
typedef __bind_r<_R, typename decay<_F>::type, typename decay<_BoundArgs>::type...> type;
return type(_STD::forward<_F>(__f), _STD::forward<_BoundArgs>(__bound_args)...);
}

View File

@@ -858,115 +858,6 @@ __deferred_assoc_state<void, _F>::__execute()
#endif // _LIBCPP_NO_EXCEPTIONS
}
template <class _R, class _F>
class __async_assoc_state
: public __assoc_state<_R>
{
typedef __assoc_state<_R> base;
_F __func_;
virtual void __on_zero_shared();
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
explicit __async_assoc_state(_F&& __f);
#endif
virtual void __execute();
};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _R, class _F>
inline _LIBCPP_INLINE_VISIBILITY
__async_assoc_state<_R, _F>::__async_assoc_state(_F&& __f)
: __func_(_STD::forward<_F>(__f))
{
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _R, class _F>
void
__async_assoc_state<_R, _F>::__execute()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
this->set_value(__func_());
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
this->set_exception(current_exception());
}
#endif // _LIBCPP_NO_EXCEPTIONS
}
template <class _R, class _F>
void
__async_assoc_state<_R, _F>::__on_zero_shared()
{
this->wait();
base::__on_zero_shared();
}
template <class _F>
class __async_assoc_state<void, _F>
: public __assoc_sub_state
{
typedef __assoc_sub_state base;
_F __func_;
virtual void __on_zero_shared();
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
explicit __async_assoc_state(_F&& __f);
#endif
virtual void __execute();
};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _F>
inline _LIBCPP_INLINE_VISIBILITY
__async_assoc_state<void, _F>::__async_assoc_state(_F&& __f)
: __func_(_STD::forward<_F>(__f))
{
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _F>
void
__async_assoc_state<void, _F>::__execute()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
__func_();
this->set_value();
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
this->set_exception(current_exception());
}
#endif // _LIBCPP_NO_EXCEPTIONS
}
template <class _F>
void
__async_assoc_state<void, _F>::__on_zero_shared()
{
this->wait();
base::__on_zero_shared();
}
template <class> class promise;
template <class> class shared_future;
template <class> class atomic_future;
@@ -983,14 +874,6 @@ __make_deferred_assoc_state(_F&& __f);
__make_deferred_assoc_state(_F __f);
#endif
template <class _R, class _F>
future<_R>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__make_async_assoc_state(_F&& __f);
#else
__make_async_assoc_state(_F __f);
#endif
template <class _R>
class _LIBCPP_VISIBLE future
{
@@ -1002,16 +885,11 @@ class _LIBCPP_VISIBLE future
template <class> friend class shared_future;
template <class> friend class atomic_future;
template <class _R1, class _F>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _R1, class _F>
friend future<_R1> __make_deferred_assoc_state(_F&& __f);
template <class _R1, class _F>
friend future<_R1> __make_async_assoc_state(_F&& __f);
#else
template <class _R1, class _F>
friend future<_R1> __make_deferred_assoc_state(_F __f);
template <class _R1, class _F>
friend future<_R1> __make_async_assoc_state(_F __f);
#endif
public:
@@ -1105,16 +983,11 @@ class _LIBCPP_VISIBLE future<_R&>
template <class> friend class shared_future;
template <class> friend class atomic_future;
template <class _R1, class _F>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _R1, class _F>
friend future<_R1> __make_deferred_assoc_state(_F&& __f);
template <class _R1, class _F>
friend future<_R1> __make_async_assoc_state(_F&& __f);
#else
template <class _R1, class _F>
friend future<_R1> __make_deferred_assoc_state(_F __f);
template <class _R1, class _F>
friend future<_R1> __make_async_assoc_state(_F __f);
#endif
public:
@@ -1203,16 +1076,11 @@ class _LIBCPP_VISIBLE future<void>
template <class> friend class shared_future;
template <class> friend class atomic_future;
template <class _R1, class _F>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _R1, class _F>
friend future<_R1> __make_deferred_assoc_state(_F&& __f);
template <class _R1, class _F>
friend future<_R1> __make_async_assoc_state(_F&& __f);
#else
template <class _R1, class _F>
friend future<_R1> __make_deferred_assoc_state(_F __f);
template <class _R1, class _F>
friend future<_R1> __make_async_assoc_state(_F __f);
#endif
public:
@@ -2166,72 +2034,36 @@ __make_deferred_assoc_state(_F __f)
return future<_R>(__h.get());
}
template <class _R, class _F>
future<_R>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__make_async_assoc_state(_F&& __f)
#else
__make_async_assoc_state(_F __f)
#endif
{
unique_ptr<__async_assoc_state<_R, _F>, __release_shared_count>
__h(new __async_assoc_state<_R, _F>(_STD::forward<_F>(__f)));
_STD::thread(&__async_assoc_state<_R, _F>::__execute, __h.get()).detach();
return future<_R>(__h.get());
}
template <class _F, class... _Args>
class __async_func
{
tuple<_F, _Args...> __f_;
public:
typedef typename __invoke_of<_F, _Args...>::type _R;
_LIBCPP_INLINE_VISIBILITY
explicit __async_func(_F&& __f, _Args&&... __args)
: __f_(_STD::move(__f), _STD::move(__args)...) {}
_LIBCPP_INLINE_VISIBILITY
__async_func(__async_func&& __f) : __f_(_STD::move(__f.__f_)) {}
_R operator()()
{
typedef typename __make_tuple_indices<1+sizeof...(_Args), 1>::type _Index;
return __execute(_Index());
}
private:
template <size_t ..._Indices>
_R
__execute(__tuple_indices<_Indices...>)
{
return __invoke(_STD::move(_STD::get<0>(__f_)), _STD::move(_STD::get<_Indices>(__f_))...);
}
};
template <class _F, class... _Args>
future<typename __invoke_of<typename decay<_F>::type, typename decay<_Args>::type...>::type>
future<typename result_of<_F(_Args...)>::type>
async(launch __policy, _F&& __f, _Args&&... __args)
{
typedef __async_func<typename decay<_F>::type, typename decay<_Args>::type...> _BF;
typedef typename _BF::_R _R;
typedef typename result_of<_F(_Args...)>::type _R;
future<_R> __r;
if (__policy & launch::async)
__r = _STD::__make_async_assoc_state<_R>(_BF(__decay_copy(_STD::forward<_F>(__f)),
__decay_copy(_STD::forward<_Args>(__args))...));
{
packaged_task<_R()> __pk(bind(_STD::forward<_F>(__f),
_STD::forward<_Args>(__args)...));
__r = __pk.get_future();
thread(_STD::move(__pk)).detach();
}
else if (__policy & launch::deferred)
__r = _STD::__make_deferred_assoc_state<_R>(_BF(__decay_copy(_STD::forward<_F>(__f)),
__decay_copy(_STD::forward<_Args>(__args))...));
__r = _STD::__make_deferred_assoc_state<_R>(bind(_STD::forward<_F>(__f),
_STD::forward<_Args>(__args)...));
return __r;
}
template <class _F, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
future<typename __invoke_of<typename decay<_F>::type, typename decay<_Args>::type...>::type>
typename enable_if
<
!is_same<typename decay<_F>::type, launch>::value,
future<typename result_of<_F(_Args...)>::type>
>::type
async(_F&& __f, _Args&&... __args)
{
return _STD::async(launch::any, _STD::forward<_F>(__f),
_STD::forward<_Args>(__args)...);
return async(launch::any, _STD::forward<_F>(__f),
_STD::forward<_Args>(__args)...);
}
#endif // _LIBCPP_HAS_NO_VARIADICS

View File

@@ -20,7 +20,6 @@ namespace std
template<class charT> struct char_traits;
template<class T> class allocator;
class ios_base;
template <class charT, class traits = char_traits<charT> > class basic_ios;
template <class charT, class traits = char_traits<charT> > class basic_streambuf;

View File

@@ -186,7 +186,10 @@ template <class charT> class messages_byname;
#endif
#include <cstdlib>
#include <ctime>
#ifndef _WIN32
#include <nl_types.h>
#endif
#pragma GCC system_header
@@ -303,7 +306,14 @@ __nolocale_asprintf(char** __ret,
{
va_list __ap;
va_start(__ap, __format);
int __result = vasprintf(__ret, __format, __ap);
int __result;
#ifdef _WIN32
*__ret = (char*)malloc(4096);
__result = vsprintf(*__ret, __format, __ap);
*__ret = (char*)realloc(*__ret, __result + 1);
#else
__result = vasprintf(__ret, __format, __ap);
#endif
va_end(__ap);
return __result;
}
@@ -748,7 +758,12 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
int __save_errno = errno;
errno = 0;
char *__p2;
long long __ll = strtoll_l(__a, &__p2, __base, 0);
long long __ll;
#ifdef _WIN32
__ll = _strtoi64_l(__a, &__p2, __base, 0);
#else
__ll = strtoll_l(__a, &__p2, __base, 0);
#endif
int __current_errno = errno;
if (__current_errno == 0)
errno = __save_errno;
@@ -788,7 +803,12 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
int __save_errno = errno;
errno = 0;
char *__p2;
unsigned long long __ll = strtoull_l(__a, &__p2, __base, 0);
unsigned long long __ll;
#ifdef _WIN32
__ll = _strtoui64_l(__a, &__p2, __base, 0);
#else
__ll = strtoull_l(__a, &__p2, __base, 0);
#endif
int __current_errno = errno;
if (__current_errno == 0)
errno = __save_errno;
@@ -816,7 +836,13 @@ __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err)
if (__a != __a_end)
{
char *__p2;
long double __ld = strtold_l(__a, &__p2, 0);
long double __ld;
#ifdef _WIN32
// Win32 does not use "long double".
__ld = _strtod_l(__a, &__p2, 0);
#else
__ld = strtold_l(__a, &__p2, 0);
#endif
if (__p2 != __a_end)
{
__err = ios_base::failbit;
@@ -1676,11 +1702,17 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
template <class _CharT, class _OutputIterator>
_OutputIterator
num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
char_type __fl, long double __v) const
char_type __fl, long double __lv) const
{
// Stage 1 - Get number in narrow char
char __fmt[8] = {'%', 0};
#ifdef _WIN32
const char* __len = "";
double __v = __lv;
#else
const char* __len = "L";
long double __v = __lv;
#endif
bool __specify_precision = this->__format_float(__fmt+1, __len, __iob.flags());
const unsigned __nbuf = 30;
char __nar[__nbuf];
@@ -3565,10 +3597,14 @@ template <class _CharT>
typename messages<_CharT>::catalog
messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
{
#ifdef __MINGW32__
return -1;
#else
catalog __cat = reinterpret_cast<catalog>(catopen(__nm.c_str(), NL_CAT_LOCALE));
if (__cat != -1)
__cat = static_cast<catalog>((static_cast<size_t>(__cat) >> 1));
return __cat;
#endif
}
template <class _CharT>
@@ -3576,6 +3612,10 @@ typename messages<_CharT>::string_type
messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
const string_type& __dflt) const
{
#ifdef __MINGW32__
string_type __w;
return __w;
#else
string __ndflt;
__narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__ndflt),
__dflt.c_str(),
@@ -3588,16 +3628,19 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
__widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w),
__n, __n + strlen(__n));
return __w;
#endif
}
template <class _CharT>
void
messages<_CharT>::do_close(catalog __c) const
{
#ifndef __MINGW32__
if (__c != -1)
__c <<= 1;
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
catclose(__cat);
#endif
}
extern template class messages<char>;

View File

@@ -794,7 +794,7 @@ struct _LIBCPP_VISIBLE pointer_traits
typedef typename __pointer_traits_difference_type<pointer>::type difference_type;
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _Up> using rebind = typename __pointer_traits_rebind<pointer, _Up>::type;
template <class _Up> using rebind = __pointer_traits_rebind<pointer, _Up>::type;
#else
template <class _Up> struct rebind
{typedef typename __pointer_traits_rebind<pointer, _Up>::type other;};
@@ -1331,7 +1331,7 @@ struct _LIBCPP_VISIBLE allocator_traits
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _Tp> using rebind_alloc =
typename __allocator_traits_rebind<allocator_type, _Tp>::type;
__allocator_traits_rebind<allocator_type, _Tp>::type;
template <class _Tp> using rebind_traits = allocator_traits<rebind_alloc<_Tp>>;
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _Tp> struct rebind_alloc
@@ -3338,7 +3338,7 @@ inline _LIBCPP_INLINE_VISIBILITY
shared_ptr<_Tp>&
shared_ptr<_Tp>::operator=(auto_ptr<_Yp>&& __r)
{
shared_ptr(_STD::move(__r)).swap(*this);
shared_ptr(__r).swap(*this);
return *this;
}
@@ -3586,10 +3586,10 @@ private:
public:
weak_ptr();
template<class _Yp> weak_ptr(shared_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0);
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type = __nat());
weak_ptr(weak_ptr const& __r);
template<class _Yp> weak_ptr(weak_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0);
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type = __nat());
~weak_ptr();
@@ -3640,7 +3640,7 @@ template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type)
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
{
@@ -3652,7 +3652,7 @@ template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type)
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
{

View File

@@ -175,9 +175,6 @@ template<class Callable, class ...Args>
#include <__config>
#include <__mutex_base>
#include <functional>
#ifndef _LIBCPP_HAS_NO_VARIADICS
#include <tuple>
#endif
#pragma GCC system_header
@@ -458,39 +455,6 @@ private:
#endif // _LIBCPP_HAS_NO_VARIADICS
};
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _F>
class __call_once_param
{
_F __f_;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(_F&& __f) : __f_(_STD::move(__f)) {}
#else
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(const _F& __f) : __f_(__f) {}
#endif
_LIBCPP_INLINE_VISIBILITY
void operator()()
{
typedef typename __make_tuple_indices<tuple_size<_F>::value, 1>::type _Index;
__execute(_Index());
}
private:
template <size_t ..._Indices>
_LIBCPP_INLINE_VISIBILITY
void __execute(__tuple_indices<_Indices...>)
{
__invoke(_STD::move(_STD::get<0>(__f_)), _STD::move(_STD::get<_Indices>(__f_))...);
}
};
#else
template <class _F>
class __call_once_param
{
@@ -511,8 +475,6 @@ public:
}
};
#endif
template <class _F>
void
__call_once_proxy(void* __vp)
@@ -532,9 +494,10 @@ call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
{
if (__builtin_expect(__flag.__state_ , ~0ul) != ~0ul)
{
typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _G;
__call_once_param<_G> __p(_G(__decay_copy(_STD::forward<_Callable>(__func)),
__decay_copy(_STD::forward<_Args>(__args))...));
typedef decltype(std::bind(std::forward<_Callable>(__func),
std::forward<_Args>(__args)...)) _G;
__call_once_param<_G> __p(std::bind(std::forward<_Callable>(__func),
std::forward<_Args>(__args)...));
__call_once(__flag.__state_, &__p, &__call_once_proxy<_G>);
}
}

View File

@@ -90,6 +90,18 @@ _LIBCPP_VISIBLE new_handler get_new_handler() throw();
} // std
#if __APPLE__
#include <cxxabi.h>
// On Darwin, there are two STL shared libraries and a lower level ABI
// shared libray. The global holding the current new handler is
// in the ABI library and named __cxa_new_handler.
#define __new_handler __cxxabiapple::__cxa_new_handler
#else // __APPLE__
_LIBCPP_BEGIN_NAMESPACE_STD
extern ::std::new_handler __new_handler;
_LIBCPP_END_NAMESPACE_STD
#endif
_LIBCPP_VISIBLE void* operator new(std::size_t) throw(std::bad_alloc);
_LIBCPP_VISIBLE void* operator new(std::size_t, const std::nothrow_t&) throw();
_LIBCPP_VISIBLE void operator delete(void*) throw();

View File

@@ -547,11 +547,11 @@ operator==(const scoped_allocator_adaptor<_OuterA1>& __a,
return __a.outer_allocator() == __b.outer_allocator();
}
template <class _OuterA1, class _OuterA2, class _InnerA0, class... _InnerAllocs>
template <class _OuterA1, class _OuterA2, class... _InnerAllocs>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const scoped_allocator_adaptor<_OuterA1, _InnerA0, _InnerAllocs...>& __a,
const scoped_allocator_adaptor<_OuterA2, _InnerA0, _InnerAllocs...>& __b)
operator==(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a,
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b)
{
return __a.outer_allocator() == __b.outer_allocator() &&
__a.inner_allocator() == __b.inner_allocator();

View File

@@ -115,22 +115,22 @@ public:
enum class errc
{
address_family_not_supported, // EAFNOSUPPORT
address_in_use, // EADDRINUSE
address_not_available, // EADDRNOTAVAIL
already_connected, // EISCONN
// address_family_not_supported, // EAFNOSUPPORT
// address_in_use, // EADDRINUSE
// address_not_available, // EADDRNOTAVAIL
// already_connected, // EISCONN
argument_list_too_long, // E2BIG
argument_out_of_domain, // EDOM
bad_address, // EFAULT
bad_file_descriptor, // EBADF
bad_message, // EBADMSG
// bad_message, // EBADMSG
broken_pipe, // EPIPE
connection_aborted, // ECONNABORTED
connection_already_in_progress, // EALREADY
connection_refused, // ECONNREFUSED
connection_reset, // ECONNRESET
// connection_aborted, // ECONNABORTED
// connection_already_in_progress, // EALREADY
// connection_refused, // ECONNREFUSED
// connection_reset, // ECONNRESET
cross_device_link, // EXDEV
destination_address_required, // EDESTADDRREQ
// destination_address_required, // EDESTADDRREQ
device_or_resource_busy, // EBUSY
directory_not_empty, // ENOTEMPTY
executable_format_error, // ENOEXEC
@@ -138,8 +138,8 @@ enum class errc
file_too_large, // EFBIG
filename_too_long, // ENAMETOOLONG
function_not_supported, // ENOSYS
host_unreachable, // EHOSTUNREACH
identifier_removed, // EIDRM
// host_unreachable, // EHOSTUNREACH
// identifier_removed, // EIDRM
illegal_byte_sequence, // EILSEQ
inappropriate_io_control_operation, // ENOTTY
interrupted, // EINTR
@@ -147,16 +147,16 @@ enum class errc
invalid_seek, // ESPIPE
io_error, // EIO
is_a_directory, // EISDIR
message_size, // EMSGSIZE
network_down, // ENETDOWN
network_reset, // ENETRESET
network_unreachable, // ENETUNREACH
no_buffer_space, // ENOBUFS
// message_size, // EMSGSIZE
// network_down, // ENETDOWN
// network_reset, // ENETRESET
// network_unreachable, // ENETUNREACH
// no_buffer_space, // ENOBUFS
no_child_process, // ECHILD
no_link, // ENOLINK
// no_link, // ENOLINK
no_lock_available, // ENOLCK
no_message_available, // ENODATA
no_message, // ENOMSG
// no_message, // ENOMSG
no_protocol_option, // ENOPROTOOPT
no_space_on_device, // ENOSPC
no_stream_resources, // ENOSR
@@ -246,22 +246,42 @@ struct _LIBCPP_VISIBLE is_error_condition_enum
struct errc
{
enum _ {
#ifdef EAFNOSUPPORT
address_family_not_supported = EAFNOSUPPORT,
#endif
#ifdef EADDRINUSE
address_in_use = EADDRINUSE,
#endif
#ifdef EADDRNOTAVAIL
address_not_available = EADDRNOTAVAIL,
#endif
#ifdef EISCONN
already_connected = EISCONN,
#endif
argument_list_too_long = E2BIG,
argument_out_of_domain = EDOM,
bad_address = EFAULT,
bad_file_descriptor = EBADF,
#ifdef EBADMSG
bad_message = EBADMSG,
#endif
broken_pipe = EPIPE,
#ifdef ECONNABORTED
connection_aborted = ECONNABORTED,
#endif
#ifdef EALREADY
connection_already_in_progress = EALREADY,
#endif
#ifdef ECONNREFUSED
connection_refused = ECONNREFUSED,
#endif
#ifdef ECONNRESET
connection_reset = ECONNRESET,
#endif
cross_device_link = EXDEV,
#ifdef EDESTADDRREQ
destination_address_required = EDESTADDRREQ,
#endif
device_or_resource_busy = EBUSY,
directory_not_empty = ENOTEMPTY,
executable_format_error = ENOEXEC,
@@ -269,8 +289,12 @@ enum _ {
file_too_large = EFBIG,
filename_too_long = ENAMETOOLONG,
function_not_supported = ENOSYS,
#ifdef EHOSTUNREACH
host_unreachable = EHOSTUNREACH,
#endif
#ifdef EIDRM
identifier_removed = EIDRM,
#endif
illegal_byte_sequence = EILSEQ,
inappropriate_io_control_operation = ENOTTY,
interrupted = EINTR,
@@ -278,21 +302,37 @@ enum _ {
invalid_seek = ESPIPE,
io_error = EIO,
is_a_directory = EISDIR,
#ifdef EMSGSIZE
message_size = EMSGSIZE,
#endif
#ifdef ENETDOWN
network_down = ENETDOWN,
#endif
#ifdef ENETRESET
network_reset = ENETRESET,
#endif
#ifdef ENETUNREACH
network_unreachable = ENETUNREACH,
#endif
#ifdef ENOBUFS
no_buffer_space = ENOBUFS,
#endif
no_child_process = ECHILD,
#ifdef ENOLINK
no_link = ENOLINK,
#endif
no_lock_available = ENOLCK,
#ifdef ENOMSG
#ifdef ENODATA
no_message_available = ENODATA,
#else
no_message_available = ENOMSG,
#endif
no_message = ENOMSG,
#endif
#ifdef ENOPROTOOPT,
no_protocol_option = ENOPROTOOPT,
#endif
no_space_on_device = ENOSPC,
#ifdef ENOSR
no_stream_resources = ENOSR,
@@ -304,24 +344,42 @@ enum _ {
no_such_file_or_directory = ENOENT,
no_such_process = ESRCH,
not_a_directory = ENOTDIR,
#ifdef ENOTSOCK
not_a_socket = ENOTSOCK,
#endif
#ifdef ENOSTR
not_a_stream = ENOSTR,
#else
not_a_stream = EINVAL,
#endif
#ifdef ENOTCONN
not_connected = ENOTCONN,
#endif
not_enough_memory = ENOMEM,
#ifdef ENOTSUP
not_supported = ENOTSUP,
#endif
#ifdef ECANCELED
operation_canceled = ECANCELED,
#endif
#ifdef EINPROGRESS
operation_in_progress = EINPROGRESS,
#endif
operation_not_permitted = EPERM,
#ifdef EOPNOTSUPP
operation_not_supported = EOPNOTSUPP,
#endif
#ifdef EWOULDBLOCK
operation_would_block = EWOULDBLOCK,
#endif
owner_dead = EOWNERDEAD,
permission_denied = EACCES,
#ifdef EPROTO
protocol_error = EPROTO,
#endif
#ifdef EPROTONOSUPPORT
protocol_not_supported = EPROTONOSUPPORT,
#endif
read_only_file_system = EROFS,
resource_deadlock_would_occur = EDEADLK,
resource_unavailable_try_again = EAGAIN,
@@ -329,17 +387,27 @@ enum _ {
state_not_recoverable = ENOTRECOVERABLE,
#ifdef ETIME
stream_timeout = ETIME,
#else
#elif defined(ETIMEDOUT)
stream_timeout = ETIMEDOUT,
#endif
#ifdef ETXTBSY
text_file_busy = ETXTBSY,
#endif
#ifdef ETIMEDOUT
timed_out = ETIMEDOUT,
#endif
too_many_files_open_in_system = ENFILE,
too_many_files_open = EMFILE,
too_many_links = EMLINK,
#ifdef ELOOP
too_many_symbolic_link_levels = ELOOP,
#endif
#ifdef EOVERFLOW
value_too_large = EOVERFLOW,
wrong_protocol_type = EPROTOTYPE
#endif
#ifdef EPROTOTYPE
wrong_protocol_type = EPROTOTYPE,
#endif
};
_ __v_;

View File

@@ -95,10 +95,15 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
#include <system_error>
#include <chrono>
#include <__mutex_base>
#ifndef _LIBCPP_HAS_NO_VARIADICS
#include <tuple>
#endif
#ifdef __MINGW32__
#define pthread_key_delete(a) (-1)
#define pthread_join(a,b) (-1)
#define pthread_detach(a) (-1)
#define nanosleep(a,b) (-1)
#define pthread_key_create(a,b) (-1)
#else
#include <pthread.h>
#endif
#pragma GCC system_header
@@ -318,44 +323,6 @@ public:
__thread_specific_ptr<__thread_struct>& __thread_local_data();
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _F, class ..._Args, size_t ..._Indices>
inline _LIBCPP_INLINE_VISIBILITY
void
__threaad_execute(tuple<_F, _Args...>& __t, __tuple_indices<_Indices...>)
{
__invoke(_STD::move(_STD::get<0>(__t)), _STD::move(_STD::get<_Indices>(__t))...);
}
template <class _F>
void*
__thread_proxy(void* __vp)
{
__thread_local_data().reset(new __thread_struct);
std::unique_ptr<_F> __p(static_cast<_F*>(__vp));
typedef typename __make_tuple_indices<tuple_size<_F>::value, 1>::type _Index;
__threaad_execute(*__p, _Index());
return nullptr;
}
template <class _F, class ..._Args,
class
>
thread::thread(_F&& __f, _Args&&... __args)
{
typedef tuple<typename decay<_F>::type, typename decay<_Args>::type...> _G;
_STD::unique_ptr<_G> __p(new _G(__decay_copy(_STD::forward<_F>(__f)),
__decay_copy(_STD::forward<_Args>(__args))...));
int __ec = pthread_create(&__t_, 0, &__thread_proxy<_G>, __p.get());
if (__ec == 0)
__p.release();
else
__throw_system_error(__ec, "thread constructor failed");
}
#else // _LIBCPP_HAS_NO_VARIADICS
template <class _F>
void*
__thread_proxy(void* __vp)
@@ -366,6 +333,25 @@ __thread_proxy(void* __vp)
return nullptr;
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _F, class ..._Args,
class
>
thread::thread(_F&& __f, _Args&&... __args)
{
typedef decltype(bind(std::forward<_F>(__f), std::forward<_Args>(__args)...)) _G;
std::unique_ptr<_G> __p(new _G(bind(std::forward<_F>(__f),
std::forward<_Args>(__args)...)));
int __ec = pthread_create(&__t_, 0, &__thread_proxy<_G>, __p.get());
if (__ec == 0)
__p.release();
else
__throw_system_error(__ec, "thread constructor failed");
}
#else // _LIBCPP_HAS_NO_VARIADICS
template <class _F>
thread::thread(_F __f)
{

File diff suppressed because it is too large Load Diff

View File

@@ -27,13 +27,12 @@ endif()
append_if(libraries LIBCXX_HAS_PTHREAD_LIB pthread)
append_if(libraries LIBCXX_HAS_C_LIB c)
append_if(libraries LIBCXX_HAS_M_LIB m)
append_if(libraries LIBCXX_HAS_RT_LIB rt)
append_if(libraries LIBCXX_HAS_GCC_S_LIB gcc_s)
target_link_libraries(cxx ${libraries})
# Setup flags.
append_if(compile_flags LIBCXX_HAS_FPIC_FLAG -fPIC)
#append_if(compile_flags LIBCXX_HAS_FPIC_FLAG -fPIC)
append_if(link_flags LIBCXX_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
set_target_properties(cxx

View File

@@ -17,17 +17,9 @@ then
CXX=clang++
fi
if [ -z "$CC" ]
then
CC=clang
fi
if [ -z $MACOSX_DEPLOYMENT_TARGET ]
then
if [ -z $IPHONEOS_DEPLOYMENT_TARGET ]
then
MACOSX_DEPLOYMENT_TARGET=10.6
fi
MACOSX_DEPLOYMENT_TARGET=10.6
fi
if [ -z $RC_ProjectSourceVersion ]
@@ -37,7 +29,7 @@ fi
case $TRIPLE in
*-apple-*)
if [ -z $RC_XBS ]
if [ -z $RC_BUILDIT ]
then
RC_CFLAGS="-arch i386 -arch x86_64"
fi
@@ -53,28 +45,16 @@ case $TRIPLE in
-Wl,-unexported_symbols_list,libc++unexp.exp \
/usr/lib/libSystem.B.dylib"
else
EXTRA_FLAGS="-std=c++0x "
RE_EXPORT_LINE="/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++abi.exp"
if [ -n "$SDKROOT" ]
then
EXTRA_FLAGS+="-isysroot ${SDKROOT}"
if echo "${RC_ARCHS}" | grep -q "armv7"
then
RE_EXPORT_LINE="${SDKROOT}/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++sjlj-abi.exp"
else
RE_EXPORT_LINE="-Wl,-reexport_library,${SDKROOT}/usr/lib/libc++abi.dylib"
fi
CXX=`xcrun -sdk "${SDKROOT}" -find clang++`
CC=`xcrun -sdk "${SDKROOT}" -find clang`
fi
LDSHARED_FLAGS="-o libc++.1.dylib \
EXTRA_FLAGS="-std=c++0x"
LDSHARED_FLAGS="-o libc++.1.dylib \
-dynamiclib -nodefaultlibs \
-current_version ${RC_ProjectSourceVersion} -compatibility_version 1 \
-install_name /usr/lib/libc++.1.dylib \
${SDKROOT}/usr/lib/libc++abi.dylib \
-lSystem \
-Wl,-unexported_symbols_list,libc++unexp.exp \
${RE_EXPORT_LINE} \
-Wl,-force_symbols_not_weak_list,notweak.exp "
-Wl,-reexported_symbols_list,libc++abi.exp \
-Wl,-force_symbols_not_weak_list,notweak.exp"
fi
;;
*)
@@ -86,7 +66,7 @@ case $TRIPLE in
;;
esac
if [ -z $RC_XBS ]
if [ -z $RC_BUILDIT ]
then
rm -f libc++.1.$SOEXT*
fi
@@ -98,11 +78,11 @@ for FILE in ../src/*.cpp; do
done
$CC *.o $RC_CFLAGS $LDSHARED_FLAGS $EXTRA_FLAGS
cc *.o $RC_CFLAGS $LDSHARED_FLAGS
#libtool -static -o libc++.a *.o
if [ -z $RC_XBS ]
if [ -z $RC_BUILDIT ]
then
rm *.o
fi

View File

@@ -1,159 +0,0 @@
___cxa_allocate_exception
___cxa_end_catch
___cxa_demangle
___cxa_current_exception_type
___cxa_call_unexpected
___cxa_free_exception
___cxa_get_exception_ptr
___cxa_get_globals
___cxa_get_globals_fast
___cxa_guard_abort
___cxa_guard_acquire
___cxa_guard_release
___cxa_rethrow
___cxa_pure_virtual
___cxa_begin_catch
___cxa_throw
___cxa_vec_cctor
___cxa_vec_cleanup
___cxa_vec_ctor
___cxa_vec_delete
___cxa_vec_delete2
___cxa_vec_delete3
___cxa_vec_dtor
___cxa_vec_new
___cxa_vec_new2
___cxa_vec_new3
___dynamic_cast
___gxx_personality_sj0
__ZTIDi
__ZTIDn
__ZTIDs
__ZTIPDi
__ZTIPDn
__ZTIPDs
__ZTIPKDi
__ZTIPKDn
__ZTIPKDs
__ZTSPm
__ZTSPl
__ZTSPj
__ZTSPi
__ZTSPh
__ZTSPf
__ZTSPe
__ZTSPd
__ZTSPc
__ZTSPb
__ZTSPa
__ZTSPKc
__ZTSPKy
__ZTSPKx
__ZTSPKw
__ZTSPKv
__ZTSPKt
__ZTSPKs
__ZTSPKm
__ZTSPKl
__ZTSPKi
__ZTSPKh
__ZTSPs
__ZTSPt
__ZTSPv
__ZTSPw
__ZTSPKa
__ZTSPx
__ZTSPy
__ZTSPKd
__ZTSPKe
__ZTSPKj
__ZTSPKb
__ZTSPKf
__ZTSv
__ZTSt
__ZTSs
__ZTSm
__ZTSl
__ZTSj
__ZTSi
__ZTSh
__ZTSf
__ZTSe
__ZTSd
__ZTSc
__ZTSw
__ZTSx
__ZTSy
__ZTSb
__ZTSa
__ZTIPKh
__ZTIPKf
__ZTIPKe
__ZTIPKd
__ZTIPKc
__ZTIPKb
__ZTIPKa
__ZTIPy
__ZTIPx
__ZTIPw
__ZTIPv
__ZTIPt
__ZTIPs
__ZTIPm
__ZTIPl
__ZTIPj
__ZTIPi
__ZTIPKi
__ZTIPKj
__ZTIPKl
__ZTIPKm
__ZTIPKs
__ZTIPKt
__ZTIPKv
__ZTIPKw
__ZTIPKx
__ZTIPKy
__ZTIPa
__ZTIPb
__ZTIPc
__ZTIPd
__ZTIPe
__ZTIPf
__ZTIPh
__ZTVN10__cxxabiv129__pointer_to_member_type_infoE
__ZTVN10__cxxabiv116__enum_type_infoE
__ZTVN10__cxxabiv117__array_type_infoE
__ZTVN10__cxxabiv117__class_type_infoE
__ZTVN10__cxxabiv117__pbase_type_infoE
__ZTVN10__cxxabiv119__pointer_type_infoE
__ZTVN10__cxxabiv120__function_type_infoE
__ZTVN10__cxxabiv120__si_class_type_infoE
__ZTVN10__cxxabiv121__vmi_class_type_infoE
__ZTVN10__cxxabiv123__fundamental_type_infoE
__ZTIa
__ZTIb
__ZTIc
__ZTId
__ZTIe
__ZTIf
__ZTIh
__ZTIi
__ZTIj
__ZTIl
__ZTIm
__ZTIs
__ZTIt
__ZTSN10__cxxabiv129__pointer_to_member_type_infoE
__ZTSN10__cxxabiv123__fundamental_type_infoE
__ZTSN10__cxxabiv121__vmi_class_type_infoE
__ZTSN10__cxxabiv120__si_class_type_infoE
__ZTSN10__cxxabiv120__function_type_infoE
__ZTSN10__cxxabiv119__pointer_type_infoE
__ZTSN10__cxxabiv117__pbase_type_infoE
__ZTSN10__cxxabiv117__class_type_infoE
__ZTSN10__cxxabiv117__array_type_infoE
__ZTSN10__cxxabiv116__enum_type_infoE
__ZTIy
__ZTIx
__ZTIw
__ZTIv

View File

@@ -116,10 +116,16 @@ steady_clock::now()
steady_clock::time_point
steady_clock::now()
{
#ifdef __MINGW32__
timeval tv;
gettimeofday(&tv, 0);
return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
#else
struct timespec tp;
if (0 != clock_gettime(CLOCK_MONOTONIC, &tp))
__throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC) failed");
return time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
#endif
}
#endif // __APPLE__

View File

@@ -57,8 +57,10 @@ condition_variable::__do_timed_wait(unique_lock<mutex>& lk,
ts.tv_sec = static_cast<decltype(ts.tv_sec)>(s.count());
ts.tv_nsec = static_cast<decltype(ts.tv_nsec)>((d - s).count());
int ec = pthread_cond_timedwait(&__cv_, lk.mutex()->native_handle(), &ts);
#ifndef __MINGW32__
if (ec != 0 && ec != ETIMEDOUT)
__throw_system_error(ec, "condition_variable timed_wait failed");
#endif
}
void

View File

@@ -77,6 +77,9 @@ std::terminate()
bool std::uncaught_exception() throw()
{
#ifdef _LIBCPP_NO_EXCEPTIONS
return false;
#endif
#if __APPLE__
// on Darwin, there is a helper function so __cxa_get_globals is private
return __cxxabiapple::__cxa_uncaught_exception();

View File

@@ -18,7 +18,20 @@
#include "cstring"
#include "cwctype"
#include "__sso_allocator"
#ifdef __MINGW32__
#define iswctype_l _iswctype_l
#define strcoll_l _strcoll_l
#define strftime_l(a,b,c,d,e) strftime(a,b,c,d)
#define strxfrm_l _strxfrm_l
#define tolower_l _tolower_l
#define toupper_l _toupper_l
#define towlower_l _towlower_l
#define towupper_l _towupper_l
#define wcscoll_l _wcscoll_l
#define wcsxfrm_l _wcsxfrm_l
#else
#include <langinfo.h>
#endif
#include <stdlib.h>
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -561,6 +574,22 @@ locale::id::__init()
// template <> class collate_byname<char>
static inline
locale_t newlocale(int m, const char *l, locale_t b) {
#if 0
return _create_locale(LC_ALL, l);
#else
return 0;
#endif
}
static inline
void freelocale(locale_t p) {
#if 0 // why!
_free_locale(p);
#endif
}
collate_byname<char>::collate_byname(const char* n, size_t refs)
: collate<char>(refs),
__l(newlocale(LC_ALL_MASK, n, 0))
@@ -1359,6 +1388,9 @@ codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st,
for (extern_type* p = tmp; n; --n) // write it
*to_nxt++ = *p++;
return ok;
#elif defined(_WIN32)
to_nxt = to;
return noconv;
#else
return error;
#endif

View File

@@ -18,110 +18,16 @@
// in the ABI library and named __cxa_new_handler.
#define __new_handler __cxxabiapple::__cxa_new_handler
#else // __APPLE__
static std::new_handler __new_handler;
_LIBCPP_BEGIN_NAMESPACE_STD
::std::new_handler __new_handler;
_LIBCPP_END_NAMESPACE_STD
#endif
#if 0
// Implement all new and delete operators as weak definitions
// in this shared library, so that they can be overriden by programs
// that define non-weak copies of the functions.
__attribute__((__weak__, __visibility__("default")))
void *
operator new(std::size_t size) throw (std::bad_alloc)
{
if (size == 0)
size = 1;
void* p;
while ((p = ::malloc(size)) == 0)
{
// If malloc fails and there is a new_handler,
// call it to try free up memory.
std::new_handler nh = std::get_new_handler();
if (nh)
nh();
else
#ifndef _LIBCPP_NO_EXCEPTIONS
throw std::bad_alloc();
#else
break;
#endif
}
return p;
}
__attribute__((__weak__, __visibility__("default")))
void*
operator new(size_t size, const std::nothrow_t&) throw()
{
void* p = 0;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
p = ::operator new(size);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
}
#endif // _LIBCPP_NO_EXCEPTIONS
return p;
}
__attribute__((__weak__, __visibility__("default")))
void*
operator new[](size_t size) throw (std::bad_alloc)
{
return ::operator new(size);
}
__attribute__((__weak__, __visibility__("default")))
void*
operator new[](size_t size, const std::nothrow_t& nothrow) throw()
{
void* p = 0;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
p = ::operator new[](size);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
}
#endif // _LIBCPP_NO_EXCEPTIONS
return p;
}
__attribute__((__weak__, __visibility__("default")))
void
operator delete(void* ptr) throw ()
{
if (ptr)
::free(ptr);
}
__attribute__((__weak__, __visibility__("default")))
void
operator delete(void* ptr, const std::nothrow_t&) throw ()
{
::operator delete(ptr);
}
__attribute__((__weak__, __visibility__("default")))
void
operator delete[] (void* ptr) throw ()
{
::operator delete (ptr);
}
__attribute__((__weak__, __visibility__("default")))
void
operator delete[] (void* ptr, const std::nothrow_t&) throw ()
{
::operator delete[](ptr);
}
namespace std
{

7
src/new_ZdaPv.cpp Normal file
View File

@@ -0,0 +1,7 @@
#include "new"
void
operator delete[] (void* ptr) throw ()
{
::operator delete (ptr);
}

View File

@@ -0,0 +1,7 @@
#include "new"
void
operator delete[] (void* ptr, const std::nothrow_t&) throw ()
{
::operator delete[](ptr);
}

10
src/new_ZdlPv.cpp Normal file
View File

@@ -0,0 +1,10 @@
#include <stdlib.h>
#include "new"
void
operator delete(void* ptr) throw ()
{
if (ptr)
::free(ptr);
}

View File

@@ -0,0 +1,7 @@
#include "new"
void
operator delete(void* ptr, const std::nothrow_t&) throw ()
{
::operator delete(ptr);
}

7
src/new_Znay.cpp Normal file
View File

@@ -0,0 +1,7 @@
#include "new"
void*
operator new[](size_t size) throw (std::bad_alloc)
{
return ::operator new(size);
}

View File

@@ -0,0 +1,19 @@
#include "new"
void*
operator new[](size_t size, const std::nothrow_t& nothrow) throw()
{
void* p = 0;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
p = ::operator new[](size);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
}
#endif // _LIBCPP_NO_EXCEPTIONS
return p;
}

26
src/new_Znwy.cpp Normal file
View File

@@ -0,0 +1,26 @@
#include <stdlib.h>
#include "new"
void *
operator new(std::size_t size) throw (std::bad_alloc)
{
if (size == 0)
size = 1;
void* p;
while ((p = ::malloc(size)) == 0)
{
// If malloc fails and there is a new_handler,
// call it to try free up memory.
std::new_handler nh = std::get_new_handler();
if (nh)
nh();
else
#ifndef _LIBCPP_NO_EXCEPTIONS
throw std::bad_alloc();
#else
break;
#endif
}
return p;
}

View File

@@ -0,0 +1,19 @@
#include "new"
void*
operator new(size_t size, const std::nothrow_t&) throw()
{
void* p = 0;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
p = ::operator new(size);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
}
#endif // _LIBCPP_NO_EXCEPTIONS
return p;
}

View File

@@ -7,11 +7,17 @@
//
//===----------------------------------------------------------------------===//
#define MINGW_HAS_SECURE_API
#include "string"
#include "cstdlib"
#include "cwchar"
#include "cerrno"
#ifdef _WIN32
#define swprintf swprintf_s
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template class __basic_string_common<true>;

View File

@@ -12,7 +12,10 @@
#include "vector"
#include "future"
#include <sys/types.h>
#ifdef __MINGW32__
#else
#include <sys/sysctl.h>
#endif
_LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -0,0 +1,15 @@
#include <windows.h>
namespace {
class Win32ctor {
public:
Win32ctor() {
SetErrorMode(SEM_FAILCRITICALERRORS |
SEM_NOGPFAULTERRORBOX |
SEM_NOOPENFILEERRORBOX);
}
};
static Win32ctor ctor;
}

View File

@@ -24,7 +24,7 @@ public:
bool operator==(const Emplaceable& x) const
{return int_ == x.int_ && double_ == x.double_;}
bool operator<(const Emplaceable& x) const
{return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_);}
{return int_ < x.int_ || int_ == x.int_ && double_ < x.double_;}
int get() const {return int_;}
};

Some files were not shown because too many files have changed in this diff Show More