diff options
Diffstat (limited to 'system')
67 files changed, 4865 insertions, 2387 deletions
diff --git a/system/include/libcxx/CREDITS.TXT b/system/include/libcxx/CREDITS.TXT index 52948510..5e4d14ec 100644 --- a/system/include/libcxx/CREDITS.TXT +++ b/system/include/libcxx/CREDITS.TXT @@ -33,6 +33,14 @@ E: mclow.lists@gmail.com E: marshall@idio.com D: Minor patches and bug fixes. +N: Bill Fisher +E: william.w.fisher@gmail.com +D: Regex bug fixes. + +N: Matthew Dempsky +E: matthew@dempsky.org +D: Minor patches and bug fixes. + N: Google Inc. D: Copyright owner and contributor of the CityHash algorithm @@ -48,6 +56,10 @@ N: Argyrios Kyrtzidis E: kyrtzidis@apple.com D: Bug fixes. +N: Bruce Mitchener, Jr. +E: bruce.mitchener@gmail.com +D: Emscripten-related changes. + N: Michel Morin E: mimomorin@gmail.com D: Minor patches to is_convertible. @@ -74,6 +86,14 @@ D: Implemented Cityhash as the string hash function on 64-bit machines N: Richard Smith D: Minor patches. +N: Joerg Sonnenberger +E: joerg@NetBSD.org +D: NetBSD port. + +N: Stephan Tolksdorf +E: st@quanttec.com +D: Minor <atomic> fix + N: Michael van der Westhuizen E: r1mikey at gmail dot com @@ -85,6 +105,10 @@ N: Zhang Xiongpang E: zhangxiongpang@gmail.com D: Minor patches and bug fixes. +N: Zhihao Yuan +E: lichray@gmail.com +D: Standard compatibility fixes. + N: Jeffrey Yasskin E: jyasskin@gmail.com E: jyasskin@google.com diff --git a/system/include/libcxx/__bit_reference b/system/include/libcxx/__bit_reference index 1621deb8..857dd5a4 100644 --- a/system/include/libcxx/__bit_reference +++ b/system/include/libcxx/__bit_reference @@ -173,6 +173,8 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __storage_type __b = *__first.__seg_ & __m; if (__b) return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b))); + if (__n == __dn) + return _It(__first.__seg_, __first.__ctz_ + __n); __n -= __dn; ++__first.__seg_; } @@ -207,6 +209,8 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __storage_type __b = ~*__first.__seg_ & __m; if (__b) return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b))); + if (__n == __dn) + return _It(__first.__seg_, __first.__ctz_ + __n); __n -= __dn; ++__first.__seg_; } @@ -333,7 +337,7 @@ __fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) } // do middle whole words __storage_type __nw = __n / __bits_per_word; - _VSTD::memset(__first.__seg_, 0, __nw * sizeof(__storage_type)); + _VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), 0, __nw * sizeof(__storage_type)); __n -= __nw * __bits_per_word; // do last partial word if (__n > 0) @@ -363,7 +367,7 @@ __fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) } // do middle whole words __storage_type __nw = __n / __bits_per_word; - _VSTD::memset(__first.__seg_, -1, __nw * sizeof(__storage_type)); + _VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), -1, __nw * sizeof(__storage_type)); __n -= __nw * __bits_per_word; // do last partial word if (__n > 0) @@ -430,7 +434,9 @@ __copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsCon // __first.__ctz_ == 0; // do middle words __storage_type __nw = __n / __bits_per_word; - _VSTD::memmove(__result.__seg_, __first.__seg_, __nw * sizeof(__storage_type)); + _VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_), + _VSTD::__to_raw_pointer(__first.__seg_), + __nw * sizeof(__storage_type)); __n -= __nw * __bits_per_word; __result.__seg_ += __nw; // do last word @@ -569,7 +575,9 @@ __copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_C __storage_type __nw = __n / __bits_per_word; __result.__seg_ -= __nw; __last.__seg_ -= __nw; - _VSTD::memmove(__result.__seg_, __last.__seg_, __nw * sizeof(__storage_type)); + _VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_), + _VSTD::__to_raw_pointer(__last.__seg_), + __nw * sizeof(__storage_type)); __n -= __nw * __bits_per_word; // do last word if (__n > 0) @@ -870,6 +878,7 @@ struct __bit_array { typedef typename _Cp::difference_type difference_type; typedef typename _Cp::__storage_type __storage_type; + typedef typename _Cp::__storage_pointer __storage_pointer; typedef typename _Cp::iterator iterator; static const unsigned __bits_per_word = _Cp::__bits_per_word; static const unsigned _Np = 4; @@ -880,9 +889,15 @@ struct __bit_array _LIBCPP_INLINE_VISIBILITY static difference_type capacity() {return static_cast<difference_type>(_Np * __bits_per_word);} _LIBCPP_INLINE_VISIBILITY explicit __bit_array(difference_type __s) : __size_(__s) {} - _LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__word_, 0);} - _LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(__word_ + __size_ / __bits_per_word, - static_cast<unsigned>(__size_ % __bits_per_word));} + _LIBCPP_INLINE_VISIBILITY iterator begin() + { + return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]), 0); + } + _LIBCPP_INLINE_VISIBILITY iterator end() + { + return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]) + __size_ / __bits_per_word, + static_cast<unsigned>(__size_ % __bits_per_word)); + } }; template <class _Cp> @@ -1093,7 +1108,11 @@ private: unsigned __ctz_; public: - _LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT +#if _LIBCPP_STD_VER > 11 + : __seg_(nullptr), __ctz_(0) +#endif + {} _LIBCPP_INLINE_VISIBILITY __bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT diff --git a/system/include/libcxx/__config b/system/include/libcxx/__config index 959390d5..b1f0d958 100644 --- a/system/include/libcxx/__config +++ b/system/include/libcxx/__config @@ -11,7 +11,7 @@ #ifndef _LIBCPP_CONFIG #define _LIBCPP_CONFIG -#ifndef _MSC_VER // explicit macro necessary because it is only defined below in this file +#if !defined(_MSC_VER) || defined(__clang__) #pragma GCC system_header #endif @@ -56,19 +56,36 @@ # endif // __LONG_LONG_SUPPORTED #endif // __FreeBSD__ +#ifdef __NetBSD__ +# include <sys/endian.h> +# if _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_LITTLE_ENDIAN 1 +# define _LIBCPP_BIG_ENDIAN 0 +# else // _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_LITTLE_ENDIAN 0 +# define _LIBCPP_BIG_ENDIAN 1 +# endif // _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_HAS_QUICK_EXIT +#endif // __NetBSD__ + #ifdef _WIN32 # define _LIBCPP_LITTLE_ENDIAN 1 # define _LIBCPP_BIG_ENDIAN 0 // Compiler intrinsics (GCC or MSVC) -# if (defined(_MSC_VER) && _MSC_VER >= 1400) \ +# if defined(__clang__) \ + || (defined(_MSC_VER) && _MSC_VER >= 1400) \ || (defined(__GNUC__) && _GNUC_VER > 403) -# define _LIBCP_HAS_IS_BASE_OF +# define _LIBCPP_HAS_IS_BASE_OF # endif +# if defined(_MSC_VER) && !defined(__clang__) +# define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler +# endif +# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library #endif // _WIN32 #ifdef __linux__ # if defined(__GNUC__) && _GNUC_VER >= 403 -# define _LIBCP_HAS_IS_BASE_OF +# define _LIBCPP_HAS_IS_BASE_OF # endif #endif @@ -116,7 +133,7 @@ #endif #ifndef _LIBCPP_INLINE_VISIBILITY -# ifdef _MSC_VER +# ifdef _LIBCPP_MSVC # define _LIBCPP_INLINE_VISIBILITY __forceinline # else // MinGW GCC and Clang # define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__)) @@ -128,13 +145,17 @@ #endif #ifndef _LIBCPP_ALWAYS_INLINE -# ifdef _MSC_VER +# ifdef _LIBCPP_MSVC # define _LIBCPP_ALWAYS_INLINE __forceinline # endif #endif #endif // _WIN32 +#ifndef __has_attribute +#define __has_attribute(__x) 0 +#endif + #ifndef _LIBCPP_HIDDEN #define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) #endif @@ -212,7 +233,9 @@ typedef __char32_t char32_t; # define _LIBCPP_NORETURN __attribute__ ((noreturn)) #endif +#if !(__has_feature(cxx_defaulted_functions)) #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS +#endif // !(__has_feature(cxx_defaulted_functions)) #if !(__has_feature(cxx_deleted_functions)) #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS @@ -255,7 +278,7 @@ typedef __char32_t char32_t; #endif #if __has_feature(is_base_of) -# define _LIBCP_HAS_IS_BASE_OF +# define _LIBCPP_HAS_IS_BASE_OF #endif // Objective-C++ features (opt-in) @@ -272,9 +295,19 @@ typedef __char32_t char32_t; #define _LIBCPP_HAS_NO_CONSTEXPR #endif -#if defined(__FreeBSD__) && (__ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L) +#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L +#if defined(__FreeBSD__) #define _LIBCPP_HAS_QUICK_EXIT #define _LIBCPP_HAS_C11_FEATURES +#elif defined(__linux__) +#include <features.h> +#if __GLIBC_PREREQ(2, 15) +#define _LIBCPP_HAS_QUICK_EXIT +#endif +#if __GLIBC_PREREQ(2, 17) +#define _LIBCPP_HAS_C11_FEATURES +#endif +#endif #endif #if (__has_feature(cxx_noexcept)) @@ -368,7 +401,7 @@ namespace _LIBCPP_NAMESPACE { using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); } -#elif defined(_MSC_VER) +#elif defined(_LIBCPP_MSVC) #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES #define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER @@ -390,7 +423,7 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); namespace std { } -#endif // __clang__ || __GNUC___ || _MSC_VER +#endif // __clang__ || __GNUC__ || _LIBCPP_MSVC #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS typedef unsigned short char16_t; @@ -418,8 +451,14 @@ template <unsigned> struct __static_assert_check {}; #define _LIBCPP_CONSTEXPR constexpr #endif +#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS +#define _LIBCPP_DEFAULT {} +#else +#define _LIBCPP_DEFAULT = default; +#endif + #ifdef __GNUC__ -#define _NOALIAS __attribute__((malloc)) +#define _NOALIAS __attribute__((__malloc__)) #else #define _NOALIAS #endif @@ -451,7 +490,7 @@ template <unsigned> struct __static_assert_check {}; #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__; #endif -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__) || defined(__NetBSD__) #define _LIBCPP_LOCALE__L_EXTENSIONS 1 #endif #ifdef __FreeBSD__ @@ -476,10 +515,18 @@ template <unsigned> struct __static_assert_check {}; # endif #endif -#ifdef _LIBCPP_DEBUG2 -# include <__debug> +#ifndef _LIBCPP_STD_VER +# if __cplusplus <= 201103L +# define _LIBCPP_STD_VER 11 +# else +# define _LIBCPP_STD_VER 13 // current year, or date of c++14 ratification +# endif +#endif // _LIBCPP_STD_VER + +#if _LIBCPP_STD_VER <= 11 +#define _LIBCPP_CONSTEXPR_AFTER_CXX11 #else -# define _LIBCPP_ASSERT(x, m) ((void)0) +#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr #endif #endif // _LIBCPP_CONFIG diff --git a/system/include/libcxx/__debug b/system/include/libcxx/__debug index 0d631bf0..bac580cf 100644 --- a/system/include/libcxx/__debug +++ b/system/include/libcxx/__debug @@ -24,6 +24,10 @@ #if _LIBCPP_DEBUG_LEVEL >= 2 +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + _LIBCPP_BEGIN_NAMESPACE_STD struct _LIBCPP_TYPE_VIS __c_node; @@ -171,7 +175,7 @@ public: bool __decrementable(const void* __i) const; bool __addable(const void* __i, ptrdiff_t __n) const; bool __subscriptable(const void* __i, ptrdiff_t __n) const; - bool __comparable(const void* __i, const void* __j) const; + bool __less_than_comparable(const void* __i, const void* __j) const; private: _LIBCPP_HIDDEN __i_node* __insert_iterator(void* __i); diff --git a/system/include/libcxx/__functional_03 b/system/include/libcxx/__functional_03 index b52d6926..662928d8 100644 --- a/system/include/libcxx/__functional_03 +++ b/system/include/libcxx/__functional_03 @@ -102,98 +102,98 @@ mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2)) template<class _Rp, class _Tp> inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)()> +__mem_fn<_Rp (_Tp::*)() const> mem_fn(_Rp (_Tp::* __pm)() const) { - return __mem_fn<_Rp (_Tp::*)()>(__pm); + return __mem_fn<_Rp (_Tp::*)() const>(__pm); } template<class _Rp, class _Tp, class _A0> inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0)> +__mem_fn<_Rp (_Tp::*)(_A0) const> mem_fn(_Rp (_Tp::* __pm)(_A0) const) { - return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0) const>(__pm); } template<class _Rp, class _Tp, class _A0, class _A1> inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1)> +__mem_fn<_Rp (_Tp::*)(_A0, _A1) const> mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const) { - return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0, _A1) const>(__pm); } template<class _Rp, class _Tp, class _A0, class _A1, class _A2> inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)> +__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const> mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const) { - return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const>(__pm); } template<class _Rp, class _Tp> inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)()> +__mem_fn<_Rp (_Tp::*)() volatile> mem_fn(_Rp (_Tp::* __pm)() volatile) { - return __mem_fn<_Rp (_Tp::*)()>(__pm); + return __mem_fn<_Rp (_Tp::*)() volatile>(__pm); } template<class _Rp, class _Tp, class _A0> inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0)> +__mem_fn<_Rp (_Tp::*)(_A0) volatile> mem_fn(_Rp (_Tp::* __pm)(_A0) volatile) { - return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0) volatile>(__pm); } template<class _Rp, class _Tp, class _A0, class _A1> inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1)> +__mem_fn<_Rp (_Tp::*)(_A0, _A1) volatile> mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) volatile) { - return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0, _A1) volatile>(__pm); } template<class _Rp, class _Tp, class _A0, class _A1, class _A2> inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)> +__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) volatile> mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) volatile) { - return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) volatile>(__pm); } template<class _Rp, class _Tp> inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)()> +__mem_fn<_Rp (_Tp::*)() const volatile> mem_fn(_Rp (_Tp::* __pm)() const volatile) { - return __mem_fn<_Rp (_Tp::*)()>(__pm); + return __mem_fn<_Rp (_Tp::*)() const volatile>(__pm); } template<class _Rp, class _Tp, class _A0> inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0)> +__mem_fn<_Rp (_Tp::*)(_A0) const volatile> mem_fn(_Rp (_Tp::* __pm)(_A0) const volatile) { - return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0) const volatile>(__pm); } template<class _Rp, class _Tp, class _A0, class _A1> inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1)> +__mem_fn<_Rp (_Tp::*)(_A0, _A1) const volatile> mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const volatile) { - return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0, _A1) const volatile>(__pm); } template<class _Rp, class _Tp, class _A0, class _A1, class _A2> inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)> +__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const volatile> mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const volatile) { - return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const volatile>(__pm); } // bad_function_call diff --git a/system/include/libcxx/__functional_base b/system/include/libcxx/__functional_base index 40a63a85..2bc2d2c1 100644 --- a/system/include/libcxx/__functional_base +++ b/system/include/libcxx/__functional_base @@ -50,13 +50,27 @@ public: static const bool value = sizeof(__test<_Tp>(0)) == 1; }; +#if _LIBCPP_STD_VER > 11 +template <class _Tp = void> +#else template <class _Tp> +#endif struct _LIBCPP_TYPE_VIS less : binary_function<_Tp, _Tp, bool> { _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const {return __x < __y;} }; +#if _LIBCPP_STD_VER > 11 +template <> +struct _LIBCPP_TYPE_VIS less<void> +{ + template <class _T1, class _T2> _LIBCPP_INLINE_VISIBILITY + auto operator()(_T1&& __t, _T2&& __u) const + { return _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u); } +}; +#endif + #ifdef _LIBCPP_HAS_NO_VARIADICS #include <__functional_base_03> @@ -292,7 +306,8 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile> // bullets 1 and 2 -template <class _Fp, class _A0, class ..._Args> +template <class _Fp, class _A0, class ..._Args, + class> inline _LIBCPP_INLINE_VISIBILITY auto __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) @@ -301,7 +316,8 @@ __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...); } |