diff options
author | Andrew Hsieh <andrewhsieh@google.com> | 2015-01-13 22:17:02 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-01-13 22:17:03 +0000 |
commit | 7714ae663f56992505cee31ddc8203f8c99da5a1 (patch) | |
tree | 9bcebab2edecf9266c332587fdd56fac8b3836c0 | |
parent | 8226f95d450857358fd08319a906c83739bd5035 (diff) | |
parent | 45b1d17d3c24e23b0955928e62881e6fd0f7b8c5 (diff) | |
download | prebuilts_ndk-7714ae663f56992505cee31ddc8203f8c99da5a1.zip prebuilts_ndk-7714ae663f56992505cee31ddc8203f8c99da5a1.tar.gz prebuilts_ndk-7714ae663f56992505cee31ddc8203f8c99da5a1.tar.bz2 |
Merge "Update llvm-libc++"
48 files changed, 837 insertions, 195 deletions
diff --git a/9/sources/android/support/include/ctype.h b/9/sources/android/support/include/ctype.h index 79af4b3..f9e859c 100644 --- a/9/sources/android/support/include/ctype.h +++ b/9/sources/android/support/include/ctype.h @@ -28,17 +28,17 @@ #ifndef NDK_ANDROID_SUPPORT_CTYPE_H #define NDK_ANDROID_SUPPORT_CTYPE_H -// __LP64__ - // Get the system header first. #include_next <ctype.h> + +#if !defined(__LP64__) + #include <xlocale.h> // for locale_t #ifdef __cplusplus extern "C" { #endif -#if !defined(__LP64__) int isalnum_l(int, locale_t); int isalpha_l(int, locale_t); int isblank_l(int, locale_t); @@ -47,7 +47,6 @@ int isgraph_l(int, locale_t); int isprint_l(int, locale_t); int ispunct_l(int, locale_t); int isspace_l(int, locale_t); -#endif // !__LP64__ int islower_l(int, locale_t); int isupper_l(int, locale_t); @@ -60,4 +59,6 @@ int toupper_l(int, locale_t); } // extern "C" #endif +#endif // !__LP64__ + #endif // NDK_ANDROID_SUPPORT_CTYPE_H diff --git a/9/sources/android/support/include/errno.h b/9/sources/android/support/include/errno.h index 40f4572..ca02371 100644 --- a/9/sources/android/support/include/errno.h +++ b/9/sources/android/support/include/errno.h @@ -37,6 +37,7 @@ #endif #define ELAST ENOTRECOVERABLE + #endif // !__LP64__ #endif /* NDK_ANDROID_SUPPORT_ERRNO_H */ diff --git a/9/sources/android/support/include/locale.h b/9/sources/android/support/include/locale.h index 872fce6..b051a97 100644 --- a/9/sources/android/support/include/locale.h +++ b/9/sources/android/support/include/locale.h @@ -29,6 +29,7 @@ #define NDK_ANDROID_SUPPORT_LOCALE_H #if defined(__LP64__) + #include_next <locale.h> #else diff --git a/9/sources/android/support/include/stdint.h b/9/sources/android/support/include/stdint.h index 14dc97d..f28797b 100644 --- a/9/sources/android/support/include/stdint.h +++ b/9/sources/android/support/include/stdint.h @@ -31,7 +31,9 @@ #include_next <stdint.h> #if !defined(__LP64__) + #include <limits.h> // For SIZE_MAX + #endif // !__LP64__ #endif // NDK_ANDROID_SUPPORT_STDINT_H diff --git a/9/sources/android/support/include/stdlib.h b/9/sources/android/support/include/stdlib.h index f145219..57e3d37 100644 --- a/9/sources/android/support/include/stdlib.h +++ b/9/sources/android/support/include/stdlib.h @@ -31,13 +31,15 @@ // __LP64__ #include_next <stdlib.h> + +#if !defined(__LP64__) + #include <xlocale.h> #ifdef __cplusplus extern "C" { #endif -#if !defined(__LP64__) long long strtoll(const char*, char**, int); long double strtold(const char*, char**); void _Exit(int); @@ -47,10 +49,11 @@ unsigned long strtoul_l(const char *nptr, char **endptr, int base, locale long long strtoll_l(const char *nptr, char **endptr, int base, locale_t loc); unsigned long long strtoull_l(const char *nptr, char **endptr, int base, locale_t loc); long double strtold_l(const char *nptr, char **endptr, locale_t loc); -#endif // !__LP64__ #ifdef __cplusplus } // extern "C" #endif +#endif // !__LP64__ + #endif // NDK_ANDROID_SUPPORT_STDLIB_H diff --git a/9/sources/android/support/include/string.h b/9/sources/android/support/include/string.h index d2edd19..732df75 100644 --- a/9/sources/android/support/include/string.h +++ b/9/sources/android/support/include/string.h @@ -28,9 +28,10 @@ #ifndef NDK_ANDROID_SUPPORT_STRING_H #define NDK_ANDROID_SUPPORT_STRING_H -// __LP64__ - #include_next <string.h> + +#if !defined(__LP64__) + #include <xlocale.h> #ifdef __cplusplus @@ -44,4 +45,6 @@ size_t strxfrm_l(char *, const char *, size_t, locale_t); } // extern "C" #endif +#endif // !__LP64__ + #endif // NDK_ANDROID_SUPPORT_STRING_H diff --git a/9/sources/android/support/include/time.h b/9/sources/android/support/include/time.h index 020dcbc..aadec60 100644 --- a/9/sources/android/support/include/time.h +++ b/9/sources/android/support/include/time.h @@ -31,6 +31,9 @@ // __LP64__ #include_next <time.h> + +#if !defined(__LP64__) + #include <xlocale.h> #ifdef __cplusplus @@ -44,4 +47,6 @@ size_t strftime_l(char *s, size_t maxsize, const char *format, } // extern "C" #endif +#endif // !__LP64__ + #endif // NDK_ANDROID_SUPPORT_TIME_H diff --git a/9/sources/android/support/include/wchar.h b/9/sources/android/support/include/wchar.h index 3253185..8947bcf 100644 --- a/9/sources/android/support/include/wchar.h +++ b/9/sources/android/support/include/wchar.h @@ -25,8 +25,6 @@ #ifndef NDK_ANDROID_SUPPORT_WCHAR_H #define NDK_ANDROID_SUPPORT_WCHAR_H -// __LP64__ - /* IMPORTANT NOTE: Unlike other headers in the support library, this * one doesn't try to include the Bionic header through #include_next. * @@ -63,17 +61,16 @@ * * - wscanf() / wfscanf() coming soon :) */ -#ifdef __cplusplus -extern "C" { -#endif - #if defined(__LP64__) -# include_next <wchar.h> -#include <xlocale.h> // for locale_t +#include_next <wchar.h> #else +#ifdef __cplusplus +extern "C" { +#endif + #include <stdarg.h> // for va_list #include <stdio.h> // for FILE #include <stddef.h> // for size_t @@ -222,8 +219,6 @@ wint_t towlower(wint_t); wint_t towupper(wint_t); wctype_t wctype(const char *); -#endif // !__LP64__ - int wcscoll_l(const wchar_t *, const wchar_t *, locale_t); size_t wcsxfrm_l(wchar_t *__restrict__, const wchar_t *__restrict__, size_t n, locale_t); @@ -231,4 +226,6 @@ size_t wcsxfrm_l(wchar_t *__restrict__, const wchar_t *__restrict__, size_t n, l } // extern "C" #endif +#endif // !__LP64__ + #endif // NDK_ANDROID_SUPPORT_WCHAR_H diff --git a/9/sources/android/support/include/wctype.h b/9/sources/android/support/include/wctype.h index 6efc58a..cc569fa 100644 --- a/9/sources/android/support/include/wctype.h +++ b/9/sources/android/support/include/wctype.h @@ -25,21 +25,21 @@ #ifndef NDK_ANDROID_SUPPORT_WCTYPE_H #define NDK_ANDROID_SUPPORT_WCTYPE_H -// __LP64__ - /* Please read note in wchar.h to see why the C library version of this * file is not included through #include_next here. */ #if defined(__LP64__) -#include_next <wctype.h> -#endif -#include <xlocale.h> + +# include_next <wctype.h> + +#else + +# include <xlocale.h> #ifdef __cplusplus extern "C" { #endif -#if !defined(__LP64__) typedef int wint_t; typedef int wctrans_t; typedef int wctype_t; @@ -87,10 +87,10 @@ int iswxdigit_l(wint_t, locale_t); int towlower_l(int, locale_t); int towupper_l(int, locale_t); -#endif // !__LP64__ - #ifdef __cplusplus } // extern "C" #endif +#endif // !__LP64__ + #endif // NDK_ANDROID_SUPPORT_WCTYPE_H diff --git a/9/sources/cxx-stl/llvm-libc++/libcxx/include/__bit_reference b/9/sources/cxx-stl/llvm-libc++/libcxx/include/__bit_reference index 37b7923..d9ebfbe 100644 --- a/9/sources/cxx-stl/llvm-libc++/libcxx/include/__bit_reference +++ b/9/sources/cxx-stl/llvm-libc++/libcxx/include/__bit_reference @@ -174,7 +174,7 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type if (__b) return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b))); if (__n == __dn) - return _It(__first.__seg_, __first.__ctz_ + __n); + return __first + __n; __n -= __dn; ++__first.__seg_; } @@ -210,7 +210,7 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type if (__b) return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b))); if (__n == __dn) - return _It(__first.__seg_, __first.__ctz_ + __n); + return __first + __n; __n -= __dn; ++__first.__seg_; } diff --git a/9/sources/cxx-stl/llvm-libc++/libcxx/include/__config b/9/sources/cxx-stl/llvm-libc++/libcxx/include/__config index 022541a..4d111d1 100644 --- a/9/sources/cxx-stl/llvm-libc++/libcxx/include/__config +++ b/9/sources/cxx-stl/llvm-libc++/libcxx/include/__config @@ -341,7 +341,11 @@ typedef __char32_t char32_t; #endif #if __has_feature(underlying_type) -# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T) +# define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) +#endif + +#if __has_feature(is_literal) +# define _LIBCPP_IS_LITERAL(T) __is_literal(T) #endif // Inline namespaces are available in Clang regardless of C++ dialect. @@ -373,12 +377,24 @@ namespace std { #define _LIBCPP_NORETURN __attribute__((noreturn)) +#if _GNUC_VER >= 407 +#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) +#define _LIBCPP_IS_LITERAL(T) __is_literal_type(T) +#endif + #if !__EXCEPTIONS #define _LIBCPP_NO_EXCEPTIONS #endif #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES + +// constexpr was added to GCC in 4.6 +#if _GNUC_VER < 406 +#define _LIBCPP_HAS_NO_CONSTEXPR +// Can only use constexpr in c++11 mode. +#elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L #define _LIBCPP_HAS_NO_CONSTEXPR +#endif #define _NOEXCEPT throw() #define _NOEXCEPT_(x) @@ -445,13 +461,14 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); #endif // Emulation of clang's __has_feature() for GCC on known cases -#ifndef __has_feature +#undef __has_feature +#define __has_feature(__x) __gxx__ ## __x #define __gxx__cxx_access_control_sfinae !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) || !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE) // Also see usage in 7 tests #define __gxx__cxx_alias_templates !defined(_LIBCPP_HAS_NO_TEMPLATE_ALIASES) #define __gxx__cxx_address_sanitizer !defined(_LIBCPP_HAS_NO_ASAN) #define __gxx__cxx_alignas 0 // Not sure, doesn't matter. -#define __gxx__cxx_atomic 0 // (_GNUC_VER >= 409) seems to support _Atomic in -std=c11 not -std=c++11 ! +#define __gxx__cxx_atomic (_GNUC_VER >= 407) #define __gxx__cxx_attributes 0 // Not sure. Also see usage in libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp #define __gxx__cxx_auto_type !defined(_LIBCPP_HAS_NO_AUTO_TYPE) #define __gxx__cxx_constexpr !defined(_LIBCPP_HAS_NO_CONSTEXPR) @@ -464,7 +481,7 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); #define __gxx__cxx_lambdas !defined(_LIBCPP_HAS_NO_LAMBDAS) #define __gxx__cxx_noexcept 0 // Not sure, doesn't matter. #define __gxx__cxx_nullptr !defined(_LIBCPP_HAS_NO_NULLPTR) -#define __gxx__cxx_reference_qualified_functions (_GNUC_VER > 408) // Since 4.8.1 +#define __gxx__cxx_reference_qualified_functions (_GNUC_VER >= 408) // Since 4.8.1 #ifdef _LIBCPP_NO_RTTI #define __gxx__cxx_rtti 0 #else @@ -488,7 +505,7 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); #define __gxx__is_empty 1 // Not sure. Also see usage in libcxx/include/type_traits #define __gxx__is_enum (_GNUC_VER >= 403) // See usage in libcxx/include/type_traits #define __gxx__is_final (_GNUC_VER >= 408) // Not if 4.7 work. 4.6 certainly not. Also see usage in libcxx/include/unordered_map,tuple,ext/hash_map,map,memory -#define __gxx__is_literal 0 // Not supported in GCC 4.8. Also see usage in libcxx/include/type_traits +#define __gxx__is_literal defined(_LIBCPP_IS_LITERAL) #define __gxx__is_pod (_GNUC_VER >= 403) // See usage in libcxx/include/type_traits #define __gxx__is_polymorphic 1 // Not sure. Also see usage in libcxx/include/type_traits #define __gxx__is_standard_layout 1 // Not sure. Also see usage in libcxx/include/type_traits @@ -498,11 +515,8 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); #define __gxx__is_union (_GNUC_VER >= 403) // See usage in libcxx/include/type_traits #define __gxx__objc_arc defined(_LIBCPP_HAS_OBJC_ARC) #define __gxx__objc_arc_weak defined(_LIBCPP_HAS_OBJC_ARC_WEAK) -#define __gxx__underlying_type 1 // Not sure. Also see usage in libcxx/include/type_traits +#define __gxx__underlying_type defined(_LIBCPP_UNDERLYING_TYPE) -#define __has_feature(__x) __gxx__ ## __x - -#endif // __has_feature #elif defined(_LIBCPP_MSVC) @@ -699,6 +713,11 @@ template <unsigned> struct __static_assert_check {}; #define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]] #endif +#ifndef _LIBCPP_HAS_NO_ASAN +extern "C" void __sanitizer_annotate_contiguous_container( + const void *, const void *, const void *, const void *); +#endif + // Try to find out if RTTI is disabled. // g++ and cl.exe have RTTI on by default and define a macro when it is. // g++ only defines the macro in 4.3.2 and onwards. diff --git a/9/sources/cxx-stl/llvm-libc++/libcxx/include/__mutex_base b/9/sources/cxx-stl/llvm-libc++/libcxx/include/__mutex_base index 293fead..122b0b7 100644 --- a/9/sources/cxx-stl/llvm-libc++/libcxx/include/__mutex_base +++ b/9/sources/cxx-stl/llvm-libc++/libcxx/include/__mutex_base @@ -22,12 +22,15 @@ _LIBCPP_BEGIN_NAMESPACE_STD +#if !_LIBCPP_SINGLE_THREADED + class _LIBCPP_TYPE_VIS mutex { pthread_mutex_t __m_; public: _LIBCPP_INLINE_VISIBILITY + #ifndef _LIBCPP_HAS_NO_CONSTEXPR constexpr mutex() _NOEXCEPT : __m_(PTHREAD_MUTEX_INITIALIZER) {} #else @@ -47,6 +50,7 @@ public: typedef pthread_mutex_t* native_handle_type; _LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;} }; +#endif // !_LIBCPP_SINGLE_THREADED struct _LIBCPP_TYPE_VIS defer_lock_t {}; struct _LIBCPP_TYPE_VIS try_to_lock_t {}; @@ -262,6 +266,7 @@ _LIBCPP_DECLARE_STRONG_ENUM(cv_status) }; _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status) +#if !_LIBCPP_SINGLE_THREADED class _LIBCPP_TYPE_VIS condition_variable { pthread_cond_t __cv_; @@ -315,6 +320,7 @@ private: void __do_timed_wait(unique_lock<mutex>& __lk, chrono::time_point<chrono::system_clock, chrono::nanoseconds>) _NOEXCEPT; }; +#endif // !_LIBCPP_SINGLE_THREADED template <class _To, class _Rep, class _Period> inline _LIBCPP_INLINE_VISIBILITY @@ -332,6 +338,7 @@ __ceil(chrono::duration<_Rep, _Period> __d) return __r; } +#if !_LIBCPP_SINGLE_THREADED template <class _Predicate> void condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred) @@ -396,6 +403,8 @@ condition_variable::wait_for(unique_lock<mutex>& __lk, _VSTD::move(__pred)); } +#endif // !_LIBCPP_SINGLE_THREADED + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___MUTEX_BASE diff --git a/9/sources/cxx-stl/llvm-libc++/libcxx/include/__refstring b/9/sources/cxx-stl/llvm-libc++/libcxx/include/__refstring new file mode 100644 index 0000000..6866bf1 --- /dev/null +++ b/9/sources/cxx-stl/llvm-libc++/libcxx/include/__refstring @@ -0,0 +1,139 @@ +//===------------------------ __refstring ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___REFSTRING +#define _LIBCPP___REFSTRING + +#include <__config> +#include <cstddef> +#include <cstring> +#if __APPLE__ +#include <dlfcn.h> +#include <mach-o/dyld.h> +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +class _LIBCPP_HIDDEN __libcpp_refstring +{ +private: + const char* str_; + + typedef int count_t; + + struct _Rep_base + { + std::size_t len; + std::size_t cap; + count_t count; + }; + + static + _Rep_base* + rep_from_data(const char *data_) _NOEXCEPT + { + char *data = const_cast<char *>(data_); + return reinterpret_cast<_Rep_base *>(data - sizeof(_Rep_base)); + } + static + char * + data_from_rep(_Rep_base *rep) _NOEXCEPT + { + char *data = reinterpret_cast<char *>(rep); + return data + sizeof(*rep); + } + +#if __APPLE__ + static + const char* + compute_gcc_empty_string_storage() _NOEXCEPT + { + void* handle = dlopen("/usr/lib/libstdc++.6.dylib", RTLD_NOLOAD); + if (handle == nullptr) + return nullptr; + void* sym = dlsym(handle, "_ZNSs4_Rep20_S_empty_rep_storageE"); + if (sym == nullptr) + return nullptr; + return data_from_rep(reinterpret_cast<_Rep_base *>(sym)); + } + + static + const char* + get_gcc_empty_string_storage() _NOEXCEPT + { + static const char* p = compute_gcc_empty_string_storage(); + return p; + } + + bool + uses_refcount() const + { + return str_ != get_gcc_empty_string_storage(); + } +#else + bool + uses_refcount() const + { + return true; + } +#endif + +public: + explicit __libcpp_refstring(const char* msg) { + std::size_t len = strlen(msg); + _Rep_base* rep = static_cast<_Rep_base *>(::operator new(sizeof(*rep) + len + 1)); + rep->len = len; + rep->cap = len; + rep->count = 0; + char *data = data_from_rep(rep); + std::memcpy(data, msg, len + 1); + str_ = data; + } + + __libcpp_refstring(const __libcpp_refstring& s) _NOEXCEPT : str_(s.str_) + { + if (uses_refcount()) + __sync_add_and_fetch(&rep_from_data(str_)->count, 1); + } + + __libcpp_refstring& operator=(const __libcpp_refstring& s) _NOEXCEPT + { + bool adjust_old_count = uses_refcount(); + struct _Rep_base *old_rep = rep_from_data(str_); + str_ = s.str_; + if (uses_refcount()) + __sync_add_and_fetch(&rep_from_data(str_)->count, 1); + if (adjust_old_count) + { + if (__sync_add_and_fetch(&old_rep->count, count_t(-1)) < 0) + { + ::operator delete(old_rep); + } + } + return *this; + } + + ~__libcpp_refstring() + { + if (uses_refcount()) + { + _Rep_base* rep = rep_from_data(str_); + if (__sync_add_and_fetch(&rep->count, count_t(-1)) < 0) + { + ::operator delete(rep); + } + } + } + + const char* c_str() const _NOEXCEPT {return str_;} +}; + +_LIBCPP_END_NAMESPACE_STD + +#endif //_LIBCPP___REFSTRING diff --git a/9/sources/cxx-stl/llvm-libc++/libcxx/include/atomic b/9/sources/cxx-stl/llvm-libc++/libcxx/include/atomic index f6ab1cb..0c4cd10 100644 --- a/9/sources/cxx-stl/llvm-libc++/libcxx/include/atomic +++ b/9/sources/cxx-stl/llvm-libc++/libcxx/include/atomic @@ -545,6 +545,266 @@ typedef enum memory_order memory_order_release, memory_order_acq_rel, memory_order_seq_cst } memory_order; +#if !defined(__clang__) + +namespace __gcc_atomic { +template <typename T> +struct __gcc_atomic_t { + __gcc_atomic_t() _NOEXCEPT {} + explicit __gcc_atomic_t(T value) _NOEXCEPT : __a_value(value) {} + T __a_value; +}; +#define _Atomic(x) __gcc_atomic::__gcc_atomic_t<x> + +template <typename T> T __create(); + +template <typename __Tp, typename __Td> +typename enable_if<sizeof(__Tp()->__a_value = __create<__Td>()), char>::type + __test_atomic_assignable(int); +template <typename T, typename U> +__two __test_atomic_assignable(...); + +template <typename __Tp, typename __Td> +struct __can_assign { + static const bool value = + sizeof(__test_atomic_assignable<__Tp, __Td>(1)) == sizeof(char); +}; + +static inline int __to_gcc_order(memory_order __order) { + switch (__order) { + case memory_order_relaxed: + return __ATOMIC_RELAXED; + case memory_order_consume: + return __ATOMIC_CONSUME; + case memory_order_acquire: + return __ATOMIC_ACQUIRE; + case memory_order_release: + return __ATOMIC_RELEASE; + case memory_order_acq_rel: + return __ATOMIC_ACQ_REL; + case memory_order_seq_cst: + return __ATOMIC_SEQ_CST; + } +} + +} // namespace __gcc_atomic + +template <typename _Tp> +static inline +typename enable_if< + __gcc_atomic::__can_assign<volatile _Atomic(_Tp)*, _Tp>::value>::type +__c11_atomic_init(volatile _Atomic(_Tp)* __a, _Tp __val) { + __a->__a_value = __val; +} + +template <typename _Tp> +static inline +typename enable_if< + !__gcc_atomic::__can_assign<volatile _Atomic(_Tp)*, _Tp>::value && + __gcc_atomic::__can_assign< _Atomic(_Tp)*, _Tp>::value>::type +__c11_atomic_init(volatile _Atomic(_Tp)* __a, _Tp __val) { + // [atomics.types.generic]p1 guarantees _Tp is trivially copyable. Because + // the default operator= in an object is not volatile, a byte-by-byte copy + // is required. + volatile char* to = reinterpret_cast<volatile char*>(&__a->__a_value); + volatile char* end = to + sizeof(_Tp); + char* from = reinterpret_cast<char*>(&__val); + while (to != end) { + *to++ = *from++; + } +} + +template <typename _Tp> +static inline void __c11_atomic_init(_Atomic(_Tp)* __a, _Tp __val) { + __a->__a_value = __val; +} + +static inline void __c11_atomic_thread_fence(memory_order __order) { + __atomic_thread_fence(__gcc_atomic::__to_gcc_order(__order)); +} + +static inline void __c11_atomic_signal_fence(memory_order __order) { + __atomic_signal_fence(__gcc_atomic::__to_gcc_order(__order)); +} + +static inline bool __c11_atomic_is_lock_free(size_t __size) { + return __atomic_is_lock_free(__size, 0); +} + +template <typename _Tp> +static inline void __c11_atomic_store(volatile _Atomic(_Tp)* __a, _Tp __val, + memory_order __order) { + return __atomic_store(&__a->__a_value, &__val, + __gcc_atomic::__to_gcc_order(__order)); +} + +template <typename _Tp> +static inline void __c11_atomic_store(_Atomic(_Tp)* __a, _Tp __val, + memory_order __order) { + return __atomic_store(&__a->__a_value, &__val, + __gcc_atomic::__to_gcc_order(__order)); +} + +template <typename _Tp> +static inline _Tp __c11_atomic_load(volatile _Atomic(_Tp)* __a, + memory_order __order) { + _Tp __ret; + __atomic_load(&__a->__a_value, &__ret, + __gcc_atomic::__to_gcc_order(__order)); + return __ret; +} + +template <typename _Tp> +static inline _Tp __c11_atomic_load(_Atomic(_Tp)* __a, memory_order __order) { + _Tp __ret; + __atomic_load(&__a->__a_value, &__ret, + __gcc_atomic::__to_gcc_order(__order)); + return __ret; +} + +template <typename _Tp> +static inline _Tp __c11_atomic_exchange(volatile _Atomic(_Tp)* __a, + _Tp __value, memory_order __order) { + _Tp __ret; + __atomic_exchange(&__a->__a_value, &__value, &__ret, + __gcc_atomic::__to_gcc_order(__order)); + return __ret; +} + +template <typename _Tp> +static inline _Tp __c11_atomic_exchange(_Atomic(_Tp)* __a, _Tp __value, + memory_order __order) { + _Tp __ret; + __atomic_exchange(&__a->__a_value, &__value, &__ret, + __gcc_atomic::__to_gcc_order(__order)); + return __ret; +} + +template <typename _Tp> +static inline bool __c11_atomic_compare_exchange_strong( + volatile _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, + memory_order __success, memory_order __failure) { + return __atomic_compare_exchange(&__a->__a_value, __expected, &__value, + false, + __gcc_atomic::__to_gcc_order(__success), + __gcc_atomic::__to_gcc_order(__failure)); +} + +template <typename _Tp> +static inline bool __c11_atomic_compare_exchange_strong( + _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, memory_order __success, + memory_order __failure) { + return __atomic_compare_exchange(&__a->__a_value, __expected, &__value, + false, + __gcc_atomic::__to_gcc_order(__success), + __gcc_atomic::__to_gcc_order(__failure)); +} + +template <typename _Tp> +static inline bool __c11_atomic_compare_exchange_weak( + volatile _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, + memory_order __success, memory_order __failure) { + return __atomic_compare_exchange(&__a->__a_value, __expected, &__value, + true, + __gcc_atomic::__to_gcc_order(__success), + __gcc_atomic::__to_gcc_order(__failure)); +} + +template <typename _Tp> +static inline bool __c11_atomic_compare_exchange_weak( + _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, memory_order __success, + memory_order __failure) { + return __atomic_compare_exchange(&__a->__a_value, __expected, &__value, + true, + __gcc_atomic::__to_gcc_order(__success), + __gcc_atomic::__to_gcc_order(__failure)); +} + +template <typename _Tp> +struct __skip_amt { enum {value = 1}; }; + +template <typename _Tp> +struct __skip_amt<_Tp*> { enum {value = sizeof(_Tp)}; }; + +// FIXME: Haven't figured out what the spec says about using arrays with +// atomic_fetch_add. Force a failure rather than creating bad behavior. +template <typename _Tp> +struct __skip_amt<_Tp[]> { }; +template <typename _Tp, int n> +struct __skip_amt<_Tp[n]> { }; + +template <typename _Tp, typename _Td> +static inline _Tp __c11_atomic_fetch_add(volatile _Atomic(_Tp)* __a, + _Td __delta, memory_order __order) { + return __atomic_fetch_add(&__a->__a_value, __delta * __skip_amt<_Tp>::value, + __gcc_atomic::__to_gcc_order(__order)); +} + +template <typename _Tp, typename _Td> +static inline _Tp __c11_atomic_fetch_add(_Atomic(_Tp)* __a, _Td __delta, + memory_order __order) { + return __atomic_fetch_add(&__a->__a_value, __delta * __skip_amt<_Tp>::value, + __gcc_atomic::__to_gcc_order(__order)); +} + +template <typename _Tp, typename _Td> +static inline _Tp __c11_atomic_fetch_sub(volatile _Atomic(_Tp)* __a, + _Td __delta, memory_order __order) { + return __atomic_fetch_sub(&__a->__a_value, __delta * __skip_amt<_Tp>::value, + __gcc_atomic::__to_gcc_order(__order)); +} + +template <typename _Tp, typename _Td> +static inline _Tp __c11_atomic_fetch_sub(_Atomic(_Tp)* __a, _Td __delta, + memory_order __order) { + return __atomic_fetch_sub(&__a->__a_value, __delta * __skip_amt<_Tp>::value, + __gcc_atomic::__to_gcc_order(__order)); +} + +template <typename _Tp> +static inline _Tp __c11_atomic_fetch_and(volatile _Atomic(_Tp)* __a, + _Tp __pattern, memory_order __order) { + return __atomic_fetch_and(&__a->__a_value, __pattern, + __gcc_atomic::__to_gcc_order(__order)); +} + +template <typename _Tp> +static inline _Tp __c11_atomic_fetch_and(_Atomic(_Tp)* __a, + _Tp __pattern, memory_order __order) { + return __atomic_fetch_and(&__a->__a_value, __pattern, + __gcc_atomic::__to_gcc_order(__order)); +} + +template <typename _Tp> +static inline _Tp __c11_atomic_fetch_or(volatile _Atomic(_Tp)* __a, + _Tp __pattern, memory_order __order) { + return __atomic_fetch_or(&__a->__a_value, __pattern, + __gcc_atomic::__to_gcc_order(__order)); +} + +template <typename _Tp> +static inline _Tp __c11_atomic_fetch_or(_Atomic(_Tp)* __a, _Tp __pattern, + memory_order __order) { + return __atomic_fetch_or(&__a->__a_value, __pattern, + __gcc_atomic::__to_gcc_order(__order)); +} + +template <typename _Tp> +static inline _Tp __c11_atomic_fetch_xor(volatile _Atomic(_Tp)* __a, + _Tp __pattern, memory_order __order) { + return __atomic_fetch_xor(&__a->__a_value, __pattern, + __gcc_atomic::__to_gcc_order(__order)); +} + +template <typename _Tp> +static inline _Tp __c11_atomic_fetch_xor(_Atomic(_Tp)* __a, _Tp __pattern, + memory_order __order) { + return __atomic_fetch_xor(&__a->__a_value, __pattern, + __gcc_atomic::__to_gcc_order(__order)); +} + +#endif // !__clang__ + template <class _Tp> inline _LIBCPP_INLINE_VISIBILITY _Tp diff --git a/9/sources/cxx-stl/llvm-libc++/libcxx/include/bitset b/9/sources/cxx-stl/llvm-libc++/libcxx/include/bitset index 4cc7dbd..8c278cc 100644 --- a/9/sources/cxx-stl/llvm-libc++/libcxx/include/bitset +++ b/9/sources/cxx-stl/llvm-libc++/libcxx/include/bitset @@ -249,9 +249,9 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT #ifndef _LIBCPP_HAS_NO_CONSTEXPR -#if __SIZE_WIDTH__ == 64 +#if __SIZEOF_SIZE_T__ == 8 : __first_{__v} -#elif __SIZE_WIDTH__ == 32 +#elif __SIZEOF_SIZE_T__ == 4 : __first_{__v, __v >> __bits_per_word} #else #error This constructor has not been ported to this platform diff --git a/9/sources/cxx-stl/llvm-libc++/libcxx/include/condition_variable b/9/sources/cxx-stl/llvm-libc++/libcxx/include/condition_variable index dc67266..603ee8f 100644 --- a/9/sources/cxx-stl/llvm-libc++/libcxx/include/condition_variable +++ b/9/sources/cxx-stl/llvm-libc++/libcxx/include/condition_variable @@ -115,6 +115,8 @@ public: #pragma GCC system_header #endif +#if !_LIBCPP_SINGLE_THREADED + _LIBCPP_BEGIN_NAMESPACE_STD class _LIBCPP_TYPE_VIS condition_variable_any @@ -253,4 +255,6 @@ void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk); _LIBCPP_END_NAMESPACE_STD +#endif // !_LIBCPP_SINGLE_THREADED + #endif // _LIBCPP_CONDITION_VARIABLE diff --git a/9/sources/cxx-stl/llvm-libc++/libcxx/include/cstddef b/9/sources/cxx-stl/llvm-libc++/libcxx/include/cstddef index 0030ec2..b4a2283 100644 --- a/9/sources/cxx-stl/llvm-libc++/libcxx/include/cstddef +++ b/9/sources/cxx-stl/llvm-libc++/libcxx/include/cstddef @@ -35,12 +35,6 @@ Types: #include <__config> -#ifdef __GLIBC__ -#define __need_NULL -#define __need_ptrdiff_t -#define __need_size_t -#endif // __GLIBC__ - #include <stddef.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -55,6 +49,11 @@ using ::size_t; #if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) // Re-use the compiler's <stddef.h> max_align_t where possible. using ::max_align_t; +#elif defined(__ANDROID__) && !__LP64__ +// If compiler doesn't have max_align_t (ie. clang), and it's on 32-bit Android, typedef max_align_t to +// "long long" instead of "long double" because 32-bit Android treats "long double" the same as "double" +// which is smaller than "long long" +typedef long long max_align_t; #else typedef long double max_align_t; #endif diff --git a/9/sources/cxx-stl/llvm-libc++/libcxx/include/future b/9/sources/cxx-stl/llvm-libc++/libcxx/include/future index de00f25..9a3af54 100644 --- a/9/sources/cxx-stl/llvm-libc++/libcxx/include/future +++ b/9/sources/cxx-stl/llvm-libc++/libcxx/include/future @@ -374,6 +374,8 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>; #pragma GCC system_header #endif +#if !_LIBCPP_SINGLE_THREADED + _LIBCPP_BEGIN_NAMESPACE_STD //enum class future_errc @@ -405,7 +407,7 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch) #ifndef _LIBCPP_HAS_NO_STRONG_ENUMS -#ifdef _LIBCXX_UNDERLYING_TYPE +#ifdef _LIBCPP_UNDERLYING_TYPE typedef underlying_type<launch>::type __launch_underlying_type; #else typedef int __launch_underlying_type; @@ -2612,4 +2614,6 @@ future<void>::share() _LIBCPP_END_NAMESPACE_STD +#endif // !_LIBCPP_SINGLE_THREADED + #endif // _LIBCPP_FUTURE diff --git a/9/sources/cxx-stl/llvm-libc++/libcxx/include/limits b/9/sources/cxx-stl/llvm-libc++/libcxx/include/limits index d917c57..2216966 100644 --- a/9/sources/cxx-stl/llvm-libc++/libcxx/include/limits +++ b/9/sources/cxx-stl/llvm-libc++/libcxx/include/limits @@ -768,7 +768,7 @@ template <class _Tp> template <class _Tp> _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::digits10; template <class _Tp> - const int numeric_limits<const volatile _Tp>::max_digits10; + _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_digits10; template <class _Tp> _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_signed; template <class _Tp> diff --git a/9/sources/cxx-stl/llvm-libc++/libcxx/include/locale b/9/sources/cxx-stl/llvm-libc++/libcxx/include/locale index 7a94613..60c6182 100644 --- a/9/sources/cxx-stl/llvm-libc++/libcxx/include/locale +++ b/9/sources/cxx-stl/llvm-libc++/libcxx/include/locale @@ -417,7 +417,7 @@ int __sscanf_l(const char *__s, locale_t __l, const char *__format, ...) { // and failbit is set in __err. // Else an iterator pointing to the matching keyword is found. If more than // one keyword matches, an iterator to the first matching keyword is returned. -// If on exit __b == __e, eofbit is set in __err. If __case_senstive is false, +// If on exit __b == __e, eofbit is set in __err. If __case_sensitive is false, // __ct is used to force to lower case before comparing characters. // Examples: // Keywords: "a", "abb" @@ -1180,11 +1180,11 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, break; } // Stage 3 - __a[sizeof(__a)-1] = 0; + __buf.resize(__a_end - __a); #ifdef _LIBCPP_LOCALE__L_EXTENSIONS - if (sscanf_l(__a, _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1) + if (sscanf_l(__buf.c_str(), _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1) #else - if (__sscanf_l(__a, __cloc(), "%p", &__v) != 1) + if (__sscanf_l(__buf.c_str(), __cloc(), "%p", &__v) != 1) #endif __err = ios_base::failbit; // EOF checked @@ -2038,7 +2038,7 @@ template <class _CharT, class _InputIterator> locale::id time_get<_CharT, _InputIterator>::id; -// time_get primatives +// time_get primitives template <class _CharT, class _InputIterator> void @@ -2259,7 +2259,7 @@ time_get<_CharT, _InputIterator>::__get_percent(iter_type& __b, iter_type __e, __err |= ios_base::eofbit; } -// time_get end primatives +// time_get end primitives template <class _CharT, class _InputIterator> _InputIterator diff --git a/9/sources/cxx-stl/llvm-libc++/libcxx/include/mutex b/9/sources/cxx-stl/llvm-libc++/libcxx/include/mutex index e0c02ad..b7a6709 100644 --- a/9/sources/cxx-stl/llvm-libc++/libcxx/include/mutex +++ b/9/sources/cxx-stl/llvm-libc++/libcxx/include/mutex @@ -187,6 +187,8 @@ template<class Callable, class ...Args> _LIBCPP_BEGIN_NAMESPACE_STD +#if !_LIBCPP_SINGLE_THREADED + class _LIBCPP_TYPE_VIS recursive_mutex { pthread_mutex_t __m_; @@ -425,6 +427,8 @@ lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3) #endif // _LIBCPP_HAS_NO_VARIADICS +#endif // !_LIBCPP_SINGLE_THREADED + struct _LIBCPP_TYPE_VIS once_flag; #ifndef _LIBCPP_HAS_NO_VARIADICS diff --git a/9/sources/cxx-stl/llvm-libc++/libcxx/include/regex b/9/sources/cxx-stl/llvm-libc++/libcxx/include/regex index 26ade48..7d922cb 100644 --- a/9/sources/cxx-stl/llvm-libc++/libcxx/include/regex +++ b/9/sources/cxx-stl/llvm-libc++/libcxx/include/regex @@ -964,7 +964,11 @@ public: typedef locale locale_type; typedef ctype_base::mask char_class_type; - static const char_class_type __regex_word = 0x80; + // Note that Android's whitespace bit, aka. _B (see locale_android.cpp for + // the details) was unfortunately defined as 0x80 which made the whitespace + // character be recognized as a word. + static const char_class_type __regex_word = 0x200; + private: locale __loc_; const ctype<char_type>* __ct_; @@ -4541,6 +4545,13 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first, __push_char(_CharT(__sum)); ++__first; break; + case '0': + if (__str) + *__str = _CharT(0); + else + __push_char(_CharT(0)); + ++__first; + break; default: if (*__first != '_' && !__traits_.isctype(*__first, ctype_base::alnum)) { diff --git a/9/sources/cxx-stl/llvm-libc++/libcxx/include/shared_mutex b/9/sources/cxx-stl/llvm-libc++/libcxx/include/shared_mutex index 7661054..fe16ee7 100644 --- a/9/sources/cxx-stl/llvm-libc++/libcxx/include/shared_mutex +++ b/9/sources/cxx-stl/llvm-libc++/libcxx/include/shared_mutex @@ -112,6 +112,8 @@ template <class Mutex> #pragma GCC system_header #endif +#if !_LIBCPP_SINGLE_THREADED + _LIBCPP_BEGIN_NAMESPACE_STD class _LIBCPP_TYPE_VIS shared_timed_mutex @@ -414,6 +416,8 @@ swap(shared_lock<_Mutex>& __x, shared_lock<_Mutex>& __y) noexcept _LIBCPP_END_NAMESPACE_STD +#endif // _LIBC_HAS_PTHREADS + #endif // _LIBCPP_STD_VER > 11 #endif // _LIBCPP_SHARED_MUTEX diff --git a/9/sources/cxx-stl/llvm-libc++/libcxx/include/stdexcept b/9/sources/cxx-stl/llvm-libc++/libcxx/include/stdexcept index ef5de59..5fc912a 100644 --- a/9/sources/cxx-stl/llvm-libc++/libcxx/include/stdexcept +++ b/9/sources/cxx-stl/llvm-libc++/libcxx/include/stdexcept @@ -50,6 +50,14 @@ public: #pragma GCC system_header #endif +#ifndef _LIBCPP___REFSTRING +_LIBCPP_BEGIN_NAMESPACE_STD +class _LIBCPP_HIDDEN __libcpp_refstring { + const char *__imp_; +}; +_LIBCPP_END_NAMESPACE_STD +#endif + namespace std // purposefully not using versioning namespace { @@ -57,7 +65,7 @@ class _LIBCPP_EXCEPTION_ABI logic_error : public exception { private: - void* __imp_; + _VSTD::__libcpp_refstring __imp_; public: explicit logic_error(const string&); explicit logic_error(const char*); @@ -74,7 +82,7 @@ class _LIBCPP_EXCEPTION_ABI runtime_error : public exception { private: - void* __imp_; + _VSTD::__libcpp_refstring __imp_; public: explicit runtime_error(const string&); explicit runtime_error(const char*); diff --git a/9/sources/cxx-stl/llvm-libc++/libcxx/include/string b/9/sources/cxx-stl/llvm-libc++/libcxx/include/string index 5c8d6e9..ba83e22 100644 --- a/9/sources/cxx-stl/llvm-libc++/libcxx/include/string +++ b/9/sources/cxx-stl/llvm-libc++/libcxx/include/string @@ -990,9 +990,81 @@ char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a) // helper fns for basic_string +// __find template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> -_SizeT _LIBCPP_INLINE_VISIBILITY __find_first_of(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__find(const _CharT *__p, _SizeT __sz, + _CharT __c, _SizeT __pos) _NOEXCEPT +{ + if (__pos >= __sz) + return __npos; + const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c); + if (__r == 0) + return __npos; + return static_cast<_SizeT>(__r - __p); +} + +template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__find(const _CharT *__p, _SizeT __sz, + const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT +{ + if (__pos > __sz || __sz - __pos < __n) + return __npos; + if (__n == 0) + return __pos; +// if (__n == 1) +// return _VSTD::__find<_CharT, _SizeT, _Traits, __npos>(__p, __sz, *__s, __pos); + const _CharT* __r = + _VSTD::search(__p + __pos, __p + __sz, __s, __s + __n, _Traits::eq); + if (__r == __p + __sz) + return __npos; + return static_cast<_SizeT>(__r - __p); +} + + +// __rfind + +template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__rfind(const _CharT *__p, _SizeT __sz, + _CharT __c, _SizeT __pos) _NOEXCEPT +{ + if (__sz < 1) + return __npos; + if (__pos < __sz) + ++__pos; + else + __pos = __sz; + for (const _CharT* __ps = __p + __pos; __ps != __p;) + { + if (_Traits::eq(*--__ps, __c)) + return static_cast<_SizeT>(__ps - __p); + } + return __npos; +} + +template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__rfind(const _CharT *__p, _SizeT __sz, + const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT +{ + __pos = _VSTD::min(__pos, __sz); + if (__n < __sz - __pos) + __pos += __n; + else + __pos = __sz; + const _CharT* __r = _VSTD::find_end(__p, __p + __pos, __s, __s + __n, _Traits::eq); + if (__n > 0 && __r == __p + __pos) + return __npos; + return static_cast<_SizeT>(__r - __p); +} + +// __find_first_of +template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__find_first_of(const _CharT *__p, _SizeT __sz, + const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT { if (__pos >= __sz || __n == 0) return __npos; @@ -1003,9 +1075,12 @@ _SizeT _LIBCPP_INLINE_VISIBILITY __find_first_of(const _CharT *__p, _SizeT __sz, return static_cast<_SizeT>(__r - __p); } + +// __find_last_of template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> -_SizeT _LIBCPP_INLINE_VISIBILITY __find_last_of(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__find_last_of(const _CharT *__p, _SizeT __sz, + const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT { if (__n != 0) { @@ -1024,9 +1099,11 @@ _SizeT _LIBCPP_INLINE_VISIBILITY __find_last_of(const _CharT *__p, _SizeT __sz, } +// __find_first_not_of template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> -_SizeT _LIBCPP_INLINE_VISIBILITY __find_first_not_of(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__find_first_not_of(const _CharT *__p, _SizeT __sz, + const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT { if (__pos < __sz) { @@ -1040,8 +1117,9 @@ _SizeT _LIBCPP_INLINE_VISIBILITY __find_first_not_of(const _CharT *__p, _SizeT _ template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> -_SizeT _LIBCPP_INLINE_VISIBILITY __find_first_not_of(const _CharT *__p, _SizeT __sz, - _CharT __c, _SizeT __pos) _NOEXCEPT +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__find_first_not_of(const _CharT *__p, _SizeT __sz, + _CharT __c, _SizeT __pos) _NOEXCEPT { if (__pos < __sz) { @@ -1054,9 +1132,11 @@ _SizeT _LIBCPP_INLINE_VISIBILITY __find_first_not_of(const _CharT *__p, _SizeT _ } +// __find_last_not_of template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> -_SizeT _LIBCPP_INLINE_VISIBILITY __find_last_not_of(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__find_last_not_of(const _CharT *__p, _SizeT __sz, + const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT { if (__pos < __sz) ++__pos; @@ -1070,8 +1150,9 @@ _SizeT _LIBCPP_INLINE_VISIBILITY __find_last_not_of(const _CharT *__p, _SizeT __ template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> -_SizeT _LIBCPP_INLINE_VISIBILITY __find_last_not_of(const _CharT *__p, _SizeT __sz, - _CharT __c, _SizeT __pos) _NOEXCEPT +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__find_last_not_of(const _CharT *__p, _SizeT __sz, + _CharT __c, _SizeT __pos) _NOEXCEPT { if (__pos < __sz) ++__pos; @@ -2311,7 +2392,7 @@ template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n) { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::assign recieved nullptr"); + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::assign received nullptr"); size_type __cap = capacity(); if (__cap >= __n) { @@ -2485,7 +2566,7 @@ template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s) { - _LIBCPP_ASSERT(__s != nullptr, "string::assign recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::assign received nullptr"); return assign(__s, traits_type::length(__s)); } @@ -2495,7 +2576,7 @@ template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __n) { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::append recieved nullptr"); + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::append received nullptr"); size_type __cap = capacity(); size_type __sz = size(); if (__cap - __sz >= __n) @@ -2632,7 +2713,7 @@ template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s) { - _LIBCPP_ASSERT(__s != nullptr, "string::append recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::append received nullptr"); return append(__s, traits_type::length(__s)); } @@ -2642,7 +2723,7 @@ template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s, size_type __n) { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::insert recieved nullptr"); + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::insert received nullptr"); size_type __sz = size(); if (__pos > __sz) this->__throw_out_of_range(); @@ -2794,7 +2875,7 @@ template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s) { - _LIBCPP_ASSERT(__s != nullptr, "string::insert recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::insert received nullptr"); return insert(__pos, __s, traits_type::length(__s)); } @@ -2845,7 +2926,7 @@ template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2) { - _LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::replace recieved nullptr"); + _LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::replace received nullptr"); size_type __sz = size(); if (__pos > __sz) this->__throw_out_of_range(); @@ -2977,7 +3058,7 @@ template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s) { - _LIBCPP_ASSERT(__s != nullptr, "string::replace recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::replace received nullptr"); return replace(__pos, __n1, __s, traits_type::length(__s)); } @@ -3345,18 +3426,9 @@ basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find(): recieved nullptr"); - size_type __sz = size(); - if (__pos > __sz || __sz - __pos < __n) - return npos; - if (__n == 0) - return __pos; - const value_type* __p = data(); - const value_type* __r = _VSTD::search(__p + __pos, __p + __sz, __s, __s + __n, - __traits_eq<traits_type>()); - if (__r == __p + __sz) - return npos; - return static_cast<size_type>(__r - __p); + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find(): received nullptr"); + return _VSTD::__find<value_type, size_type, traits_type, npos> + (data(), size(), __s, __pos, __n); } template<class _CharT, class _Traits, class _Allocator> @@ -3365,7 +3437,8 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str, size_type __pos) const _NOEXCEPT { - return find(__str.data(), __pos, __str.size()); + return _VSTD::__find<value_type, size_type, traits_type, npos> + (data(), size(), __str.data(), __pos, __str.size()); } template<class _CharT, class _Traits, class _Allocator> @@ -3374,8 +3447,9 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s, size_type __pos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::find(): recieved nullptr"); - return find(__s, __pos, traits_type::length(__s)); + _LIBCPP_ASSERT(__s != nullptr, "string::find(): received nullptr"); + return _VSTD::__find<value_type, size_type, traits_type, npos> + (data(), size(), __s, __pos, traits_type::length(__s)); } template<class _CharT, class _Traits, class _Allocator> @@ -3383,14 +3457,8 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find(value_type __c, size_type __pos) const _NOEXCEPT { - size_type __sz = size(); - if (__pos >= __sz) - return npos; - const value_type* __p = data(); - const value_type* __r = traits_type::find(__p + __pos, __sz - __pos, __c); - if (__r == 0) - return npos; - return static_cast<size_type>(__r - __p); + return _VSTD::__find<value_type, size_type, traits_type, npos> + (data(), size(), __c, __pos); } // rfind @@ -3401,19 +3469,9 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::rfind(): recieved nullptr"); - size_type __sz = size(); - __pos = _VSTD::min(__pos, __sz); - if (__n < __sz - __pos) - __pos += __n; - else - __pos = __sz; - const value_type* __p = data(); - const value_type* __r = _VSTD::find_end(__p, __p + __pos, __s, __s + __n, - __traits_eq<traits_type>()); - if (__n > 0 && __r == __p + __pos) - return npos; - return static_cast<size_type>(__r - __p); + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::rfind(): received nullptr"); + return _VSTD::__rfind<value_type, size_type, traits_type, npos> + (data(), size(), __s, __pos, __n); } template<class _CharT, class _Traits, class _Allocator> @@ -3422,7 +3480,8 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str, size_type __pos) const _NOEXCEPT { - return rfind(__str.data(), __pos, __str.size()); + return _VSTD::__rfind<value_type, size_type, traits_type, npos> + (data(), size(), __str.data(), __pos, __str.size()); } template<class _CharT, class _Traits, class _Allocator> @@ -3431,8 +3490,9 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s, size_type __pos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::rfind(): recieved nullptr"); - return rfind(__s, __pos, traits_type::length(__s)); + _LIBCPP_ASSERT(__s != nullptr, "string::rfind(): received nullptr"); + return _VSTD::__rfind<value_type, size_type, traits_type, npos> + (data(), size(), __s, __pos, traits_type::length(__s)); } template<class _CharT, class _Traits, class _Allocator> @@ -3440,21 +3500,8 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c, size_type __pos) const _NOEXCEPT { - size_type __sz = size(); - if (__sz) - { - if (__pos < __sz) - ++__pos; - else - __pos = __sz; - const value_type* __p = data(); - for (const value_type* __ps = __p + __pos; __ps != __p;) - { - if (traits_type::eq(*--__ps, __c)) - return static_cast<size_type>(__ps - __p); - } - } - return npos; + return _VSTD::__rfind<value_type, size_type, traits_type, npos> + (data(), size(), __c, __pos); } // find_first_of @@ -3465,7 +3512,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_of(): recieved nullptr"); + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_of(): received nullptr"); return _VSTD::__find_first_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, __n); } @@ -3486,7 +3533,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s, size_type __pos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::find_first_of(): recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::find_first_of(): received nullptr"); return _VSTD::__find_first_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, traits_type::length(__s)); } @@ -3508,7 +3555,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_of(): recieved nullptr"); + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_of(): received nullptr"); return _VSTD::__find_last_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, __n); } @@ -3529,7 +3576,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s, size_type __pos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::find_last_of(): recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::find_last_of(): received nullptr"); return _VSTD::__find_last_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, traits_type::length(__s)); } @@ -3551,7 +3598,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* _ size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_not_of(): recieved nullptr"); + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_not_of(): received nullptr"); return _VSTD::__find_first_not_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, __n); } @@ -3572,7 +3619,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s, size_type __pos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::find_first_not_of(): recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::find_first_not_of(): received nullptr"); return _VSTD::__find_first_not_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, traits_type::length(__s)); } @@ -3595,7 +3642,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __ size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_not_of(): recieved nullptr"); + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_not_of(): received nullptr"); return _VSTD::__find_last_not_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, __n); } @@ -3616,7 +3663,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s, size_type __pos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::find_last_not_of(): recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::find_last_not_of(): received nullptr"); return _VSTD::__find_last_not_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, traits_type::length(__s)); } @@ -3680,7 +3727,7 @@ template <class _CharT, class _Traits, class _Allocator> int basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::compare(): recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::compare(): received nullptr"); return compare(0, npos, __s, traits_type::length(__s)); } @@ -3690,7 +3737,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, const value_type* __s) const { - _LIBCPP_ASSERT(__s != nullptr, "string::compare(): recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::compare(): received nullptr"); return compare(__pos1, __n1, __s, traits_type::length(__s)); } @@ -3701,7 +3748,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, const value_type* __s, size_type __n2) const { - _LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::compare(): recieved nullptr"); + _LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::compare(): received nullptr"); size_type __sz = size(); if (__pos1 > __sz || __n2 == npos) this->__throw_out_of_range(); diff --git a/9/sources/cxx-stl/llvm-libc++/libcxx/include/thread b/9/sources/cxx-stl/llvm-libc++/libcxx/include/thread index 1f1e4a2..0202440 100644 --- a/9/sources/cxx-stl/llvm-libc++/libcxx/include/thread +++ b/9/sources/cxx-stl/llvm-libc++/libcxx/include/thread @@ -106,6 +106,8 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time); #define __STDCPP_THREADS__ __cplusplus +#if !_LIBCPP_SINGLE_THREADED + _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp> @@ -455,4 +457,6 @@ void yield() _NOEXCEPT {sched_yield();} _LIBCPP_END_NAMESPACE_STD +#endif // !_LIBCPP_SINGLE_THREADED + #endif // _LIBCPP_THREAD diff --git a/9/sources/cxx-stl/llvm-libc++/libcxx/include/type_traits b/9/sources/cxx-stl/llvm-libc++/libcxx/include/type_traits index b5f4b3e..c027035 100644 --- a/9/sources/cxx-stl/llvm-libc++/libcxx/include/type_traits +++ b/9/sources/cxx-stl/llvm-libc++/libcxx/include/type_traits @@ -382,7 +382,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&&> : public t // is_union -#if __has_feature(is_union) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(is_union) || defined(_LIBCPP_HAS_TYPE_TRAITS) template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_union : public integral_constant<bool, __is_union(_Tp)> {}; @@ -397,7 +397,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_union // is_class -#if __has_feature(is_class) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(is_class) || defined(_LIBCPP_HAS_TYPE_TRAITS) template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_class : public integral_constant<bool, __is_class(_Tp)> {}; @@ -444,8 +444,26 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_function // is_member_function_pointer -template <class _Tp> struct __libcpp_is_member_function_pointer : public false_type {}; -template <class _Tp, class _Up> struct __libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {}; +// template <class _Tp> struct __libcpp_is_member_function_pointer : public false_type {}; +// template <class _Tp, class _Up> struct __libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {}; +// + +template <class _MP, bool _IsMemberFuctionPtr, bool _IsMemberObjectPtr> +struct __member_pointer_traits_imp +{ // forward declaration; specializations later +}; + + +namespace __libcpp_is_member_function_pointer_imp { + template <typename _Tp> + char __test(typename std::__member_pointer_traits_imp<_Tp, true, false>::_FnType *); + + template <typename> + std::__two __test(...); +}; + +template <class _Tp> struct __libcpp_is_member_function_pointer + : public integral_constant<bool, sizeof(__libcpp_is_member_function_pointer_imp::__test<_Tp>(nullptr)) == 1> {}; template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_function_pointer : public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type> {}; @@ -466,7 +484,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_object_pointer // is_enum -#if __has_feature(is_enum) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(is_enum) || defined(_LIBCPP_HAS_TYPE_TRAITS) template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum : public integral_constant<bool, __is_enum(_Tp)> {}; @@ -779,7 +797,7 @@ template <class _Bp, class _Dp> struct _LIBCPP_TYPE_VIS_ONLY is_base_of : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {}; -#else // __has_feature(is_base_of) +#else // _LIBCPP_HAS_IS_BASE_OF namespace __is_base_of_imp { @@ -804,7 +822,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_base_of : public integral_constant<bool, is_class<_Bp>::value && sizeof(__is_base_of_imp::__test<_Bp, _Dp>(0)) == 2> {}; -#endif // __has_feature(is_base_of) +#endif // _LIBCPP_HAS_IS_BASE_OF // is_convertible @@ -818,14 +836,20 @@ template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible namespace __is_convertible_imp { -template <class _Tp> char __test(_Tp); -template <class _Tp> __two __test(...); +// Test taken directly from definition of is_convertible predicate in [meta.rel]p4. #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -template <class _Tp> _Tp&& __source(); +template <class _Tp> typename add_rvalue_reference<_Tp>::type __create(); #else -template <class _Tp> typename remove_reference<_Tp>::type& __source(); +template <class _Tp> typename remove_reference<_Tp>::type& __create(); #endif +template <class _Tp> char helper(_Tp); + +template <class _Tp, class _Tf> +typename enable_if<sizeof(helper<_Tp>(__create<_Tf>())) == 1, char>::type + __test(int); +template <class _Tp, class _Tf> __two __test(...); + template <class _Tp, bool _IsArray = is_array<_Tp>::value, bool _IsFunction = is_function<_Tp>::value, bool _IsVoid = is_void<_Tp>::value> @@ -854,9 +878,9 @@ template <class _T1, class _T2, struct __is_convertible : public integral_constant<bool, #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1 + sizeof(__is_convertible_imp::__test<_T2, _T1>(1)) == 1 #else - sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1 + sizeof(__is_convertible_imp::__test<_T2, _T1>(1)) == 1 && !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value && (!is_const<typename remove_reference<_T2>::type>::value || is_volatile<typename remove_reference<_T2>::type>::value) @@ -869,12 +893,12 @@ struct __is_convertible template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 0> : false_type {}; -template <class _T1> struct __is_convertible<_T1, const _T1&, 1, 0> : true_type {}; +template <class _T1> struct __is_convertible<_T1, const typename remove_const<_T1>::type&, 1, 0> : true_type {}; #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class _T1> struct __is_convertible<_T1, _T1&&, 1, 0> : true_type {}; -template <class _T1> struct __is_convertible<_T1, const _T1&&, 1, 0> : true_type {}; -template <class _T1> struct __is_convertible<_T1, volatile _T1&&, 1, 0> : true_type {}; -template <class _T1> struct __is_convertible<_T1, const volatile _T1&&, 1, 0> : true_type {}; +template <class _T1> struct __is_convertible<_T1, const typename remove_const<_T1>::type&&, 1, 0> : true_type {}; +template <class _T1> struct __is_convertible<_T1, volatile typename remove_volatile<_T1>::type&&, 1, 0> : true_type {}; +template <class _T1> struct __is_convertible<_T1, const volatile typename remove_cv<_T1>::type&&, 1, 0> : true_type {}; #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class _T1, class _T2> struct __is_convertible<_T1, _T2*, 1, 0> @@ -899,18 +923,22 @@ template <class _T1> struct __is_convertible<_T1, _T1*const, 2, 0> template <class _T1> struct __is_convertible<_T1, _T1*volatile, 2, 0> : public true_type {}; template <class _T1> struct __is_convertible<_T1, _T1*const volatile, 2, 0> : public true_type {}; +// Per N2255 on is_convertible, void -> !void is not convertible. template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 0> : public false_type {}; +// Per N2255 on is_convertible, * -> array is not converitble. template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {}; template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {}; template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {}; template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {}; +// Per N2255 on is_convertible, * -> function is not converitble. template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type {}; template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type {}; template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type {}; template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type {}; +// Per N2255 on is_convertible, only void -> void is convertible. template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type {}; template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type {}; template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type {}; @@ -927,7 +955,7 @@ template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible // is_empty -#if __has_feature(is_empty) +#if __has_feature(is_empty) || (_GNUC_VER >= 407) template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_empty @@ -978,7 +1006,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_polymorphic // has_virtual_destructor -#if __has_feature(has_virtual_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_virtual_destructor) || defined(_LIBCPP_HAS_TYPE_TRAITS) template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor : public integral_constant<bool, __has_virtual_destructor(_Tp)> {}; @@ -1654,11 +1682,6 @@ __decay_copy(const _Tp& __t) #endif -template <class _MP, bool _IsMemberFuctionPtr, bool _IsMemberObjectPtr> -struct __member_pointer_traits_imp -{ -}; - #ifndef _LIBCPP_HAS_NO_VARIADICS template <class _Rp, class _Class, class ..._Param> @@ -1666,6 +1689,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false> { typedef _Class _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> @@ -1673,6 +1697,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false { typedef _Class const _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> @@ -1680,6 +1705,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, fa { typedef _Class volatile _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> @@ -1687,6 +1713,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, tr { typedef _Class const volatile _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); }; #if __has_feature(cxx_reference_qualified_functions) @@ -1696,6 +1723,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false> { typedef _Class& _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> @@ -1703,6 +1731,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, fals { typedef _Class const& _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> @@ -1710,6 +1739,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, f { typedef _Class volatile& _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> @@ -1717,6 +1747,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, t { typedef _Class const volatile& _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> @@ -1724,6 +1755,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false> { typedef _Class&& _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> @@ -1731,6 +1763,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, fal { typedef _Class const&& _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> @@ -1738,6 +1771,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, { typedef _Class volatile&& _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> @@ -1745,6 +1779,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, { typedef _Class const volatile&& _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); }; #endif // __has_feature(cxx_reference_qualified_functions) @@ -1756,6 +1791,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false> { typedef _Class _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (); }; template <class _Rp, class _Class, class _P0> @@ -1763,6 +1799,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false> { typedef _Class _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_P0); }; template <class _Rp, class _Class, class _P0, class _P1> @@ -1770,6 +1807,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false> { typedef _Class _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_P0, _P1); }; template <class _Rp, class _Class, class _P0, class _P1, class _P2> @@ -1777,6 +1815,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false> { typedef _Class _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_P0, _P1, _P2); }; template <class _Rp, class _Class> @@ -1784,6 +1823,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false> { typedef _Class const _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (); }; template <class _Rp, class _Class, class _P0> @@ -1791,6 +1831,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false> { typedef _Class const _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_P0); }; template <class _Rp, class _Class, class _P0, class _P1> @@ -1798,6 +1839,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false> { typedef _Class const _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_P0, _P1); }; template <class _Rp, class _Class, class _P0, class _P1, class _P2> @@ -1805,6 +1847,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, f { typedef _Class const _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_P0, _P1, _P2); }; template <class _Rp, class _Class> @@ -1812,6 +1855,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false> { typedef _Class volatile _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (); }; template <class _Rp, class _Class, class _P0> @@ -1819,6 +1863,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false> { typedef _Class volatile _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_P0); }; template <class _Rp, class _Class, class _P0, class _P1> @@ -1826,6 +1871,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, fal { typedef _Class volatile _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_P0, _P1); }; template <class _Rp, class _Class, class _P0, class _P1, class _P2> @@ -1833,6 +1879,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true { typedef _Class volatile _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_P0, _P1, _P2); }; template <class _Rp, class _Class> @@ -1840,6 +1887,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false { typedef _Class const volatile _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (); }; template <class _Rp, class _Class, class _P0> @@ -1847,6 +1895,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, fa { typedef _Class const volatile _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_P0); }; template <class _Rp, class _Class, class _P0, class _P1> @@ -1854,6 +1903,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, tru { typedef _Class const volatile _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_P0, _P1); }; template <class _Rp, class _Class, class _P0, class _P1, class _P2> @@ -1861,6 +1911,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile { typedef _Class const volatile _ClassType; typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_P0, _P1, _P2); }; #endif // _LIBCPP_HAS_NO_VARIADICS @@ -1880,6 +1931,7 @@ struct __member_pointer_traits { // typedef ... _ClassType; // typedef ... _ReturnType; +// typedef ... _FnType; }; // result_of @@ -2392,7 +2444,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp> -#if __has_feature(has_trivial_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_trivial_constructor) || defined(_LIBCPP_HAS_TYPE_TRAITS) : integral_constant<bool, __has_trivial_constructor(_Tp)> #else : integral_constant<bool, is_scalar<_Tp>::value> @@ -2521,7 +2573,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_constructibl // is_trivially_assignable -#if __has_feature(is_trivially_constructible) +#if __has_feature(is_trivially_assignable) template <class _Tp, class _Arg> struct is_trivially_assignable @@ -2529,7 +2581,7 @@ struct is_trivially_assignable { }; -#else // !__has_feature(is_trivially_constructible) +#else // !__has_feature(is_trivially_assignable) template <class _Tp, class _Arg> struct is_trivially_assignable @@ -2555,7 +2607,7 @@ struct is_trivially_assignable<_Tp&, _Tp&&> #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#endif // !__has_feature(is_trivially_constructible) +#endif // !__has_feature(is_trivially_assignable) // is_trivially_copy_assignable @@ -2577,7 +2629,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_assignable // is_trivially_destructible -#if __has_feature(has_trivial_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_trivial_destructor) || defined(_LIBCPP_HAS_TYPE_TRAITS) template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible : public integral_constant<bool, __has_trivial_destructor(_Tp)> {}; @@ -2595,9 +2647,18 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible // is_nothrow_constructible +#if 0 +template <class _Tp, class... _Args> +struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible + : public integral_constant<bool, __is_nothrow_constructible(_Tp(_Args...))> +{ +}; + +#else + #ifndef _LIBCPP_HAS_NO_VARIADICS -#if __has_feature(cxx_noexcept) +#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) template <bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible; @@ -2635,7 +2696,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp> -#if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_constructor) || defined(_LIBCPP_HAS_TYPE_TRAITS) : integral_constant<bool, __has_nothrow_constructor(_Tp)> #else : integral_constant<bool, is_scalar<_Tp>::value> @@ -2649,7 +2710,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&&> #else struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp> #endif -#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_HAS_TYPE_TRAITS) : integral_constant<bool, __has_nothrow_copy(_Tp)> #else : integral_constant<bool, is_scalar<_Tp>::value> @@ -2659,7 +2720,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp> template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&> -#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_HAS_TYPE_TRAITS) : integral_constant<bool, __has_nothrow_copy(_Tp)> #else : integral_constant<bool, is_scalar<_Tp>::value> @@ -2669,7 +2730,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&> template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&> -#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_HAS_TYPE_TRAITS) : integral_constant<bool, __has_nothrow_copy(_Tp)> #else : integral_constant<bool, is_scalar<_Tp>::value> @@ -2691,7 +2752,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, __is_construct::__nat, __is_construct::__nat> -#if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_constructor) || defined(_LIBCPP_HAS_TYPE_TRAITS) : integral_constant<bool, __has_nothrow_constructor(_Tp)> #else : integral_constant<bool, is_scalar<_Tp>::value> @@ -2702,7 +2763,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, __is_construct::__nat template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp, __is_construct::__nat> -#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_HAS_TYPE_TRAITS) : integral_constant<bool, __has_nothrow_copy(_Tp)> #else : integral_constant<bool, is_scalar<_Tp>::value> @@ -2713,7 +2774,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp, template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&, __is_construct::__nat> -#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_HAS_TYPE_TRAITS) : integral_constant<bool, __has_nothrow_copy(_Tp)> #else : integral_constant<bool, is_scalar<_Tp>::value> @@ -2724,7 +2785,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&, template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&, __is_construct::__nat> -#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_HAS_TYPE_TRAITS) : integral_constant<bool, __has_nothrow_copy(_Tp)> #else : integral_constant<bool, is_scalar<_Tp>::value> @@ -2733,6 +2794,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&, }; #endif // _LIBCPP_HAS_NO_VARIADICS +#endif // __has_feature(is_nothrow_constructible) // is_nothrow_default_constructible @@ -2758,7 +2820,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_constructible // is_nothrow_assignable -#if __has_feature(cxx_noexcept) +#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) template <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable; @@ -2788,7 +2850,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp> -#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_assign) || defined(_LIBCPP_HAS_TYPE_TRAITS) : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; #else : integral_constant<bool, is_scalar<_Tp>::value> {}; @@ -2796,7 +2858,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp> template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp&> -#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_assign) || defined(_LIBCPP_HAS_TYPE_TRAITS) : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; #else : integral_constant<bool, is_scalar<_Tp>::value> {}; @@ -2804,7 +2866,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp&> template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, const _Tp&> -#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_assign) || defined(_LIBCPP_HAS_TYPE_TRAITS) : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; #else : integral_constant<bool, is_scalar<_Tp>::value> {}; @@ -2814,7 +2876,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, const _Tp&> template <class _Tp> struct is_nothrow_assignable<_Tp&, _Tp&&> -#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_assign) || defined(_LIBCPP_HAS_TYPE_TRAITS) : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; #else : integral_constant<bool, is_scalar<_Tp>::value> {}; @@ -2844,7 +2906,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_assignable // is_nothrow_destructible -#if __has_feature(cxx_noexcept) +#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) template <bool, class _Tp> struct __libcpp_is_nothrow_destructible; @@ -2901,7 +2963,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible // is_pod -#if __has_feature(is_pod) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(is_pod) || defined(_LIBCPP_HAS_TYPE_TRAITS) template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod : public integral_constant<bool, __is_pod(_Tp)> {}; @@ -2919,8 +2981,8 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod // is_literal_type; template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_literal_type -#if __has_feature(is_literal) - : public integral_constant<bool, __is_literal(_Tp)> +#ifdef _LIBCPP_IS_LITERAL + : public integral_constant<bool, _LIBCPP_IS_LITERAL(_Tp)> #else : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value || is_reference<typename remove_all_extents<_Tp>::type>::value> @@ -2930,7 +2992,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_literal_type // is_standard_layout; template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout -#if __has_feature(is_standard_layout) +#if __has_feature(is_standard_layout) || (_GNUC_VER >= 407) : public integral_constant<bool, __is_standard_layout(_Tp)> #else : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> @@ -2950,7 +3012,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable // is_trivial; template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivial -#if __has_feature(is_trivial) +#if __has_feature(is_trivial) || (_GNUC_VER >= 407) : public integral_constant<bool, __is_trivial(_Tp)> #else : integral_constant<bool, is_trivially_copyable<_Tp>::value && @@ -3280,7 +3342,7 @@ struct __is_swappable { }; -#if __has_feature(cxx_noexcept) +#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) template <bool, class _Tp> struct __is_nothrow_swappable_imp @@ -3311,19 +3373,19 @@ struct __is_nothrow_swappable #endif // __has_feature(cxx_noexcept) -#ifdef _LIBCXX_UNDERLYING_TYPE +#ifdef _LIBCPP_UNDERLYING_TYPE template <class _Tp> struct underlying_type { - typedef _LIBCXX_UNDERLYING_TYPE(_Tp) type; + typedef _LIBCPP_UNDERLYING_TYPE(_Tp) type; }; #if _LIBCPP_STD_VER > 11 template <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type; #endif -#else // _LIBCXX_UNDERLYING_TYPE +#else // _LIBCPP_UNDERLYING_TYPE template <class _Tp, bool _Support = false> struct underlying_type @@ -3333,7 +3395,7 @@ struct underlying_type "libc++ does not know how to use it."); }; -#endif // _LIBCXX_UNDERLYING_TYPE +#endif // _LIBCPP_UNDERLYING_TYPE #ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE diff --git a/9/sources/cxx-stl/llvm-libc++/libcxx/include/vector b/9/sources/cxx-stl/llvm-libc++/libcxx/include/vector index 6ac78d5..2cc23e5 100644 --- a/9/sources/cxx-stl/llvm-libc++/libcxx/include/vector +++ b/9/sources/cxx-stl/llvm-libc++/libcxx/include/vector @@ -483,6 +483,7 @@ class _LIBCPP_TYPE_VIS_ONLY vector { private: typedef __vector_base<_Tp, _Allocator> __base; + typedef allocator<_Tp> __default_allocator_type; public: typedef vector __self; typedef _Tp value_type; @@ -749,7 +750,9 @@ public: _LIBCPP_INLINE_VISIBILITY void clear() _NOEXCEPT { + size_type __old_size = size(); __base::clear(); + __annotate_shrink(__old_size); __invalidate_all_iterators(); } @@ -816,7 +819,9 @@ private: } __get_db()->unlock(); #endif + size_type __old_size = size(); __base::__destruct_at_end(__new_last); + __annotate_shrink(__old_size); } template <class _Up> void @@ -830,17 +835,52 @@ private: void __emplace_back_slow_path(_Args&&... __args); #endif + // The following functions are no-ops outside of AddressSanitizer mode. + // We call annotatations only for the default Allocator because other allocators + // may not meet the AddressSanitizer alignment constraints. + // See the documentation for __sanitizer_annotate_contiguous_container for more details. + void __annotate_contiguous_container + (const void *__beg, const void *__end, const void *__old_mid, const void *__new_mid) + { +#ifndef _LIBCPP_HAS_NO_ASAN + if (__beg && is_same<allocator_type, __default_allocator_type>::value) + __sanitizer_annotate_contiguous_container(__beg, __end, __old_mid, __new_mid); +#endif + } + + void __annotate_new(size_type __current_size) + { + __annotate_contiguous_container(data(), data() + capacity(), + data() + capacity(), data() + __current_size); + } + void __annotate_delete() + { + __annotate_contiguous_container(data(), data() + capacity(), + data() + size(), data() + capacity()); + } + void __annotate_increase(size_type __n) + { + __annotate_contiguous_container(data(), data() + capacity(), + data() + size(), data() + size() + __n); + } + void __annotate_shrink(size_type __old_size) + { + __annotate_contiguous_container(data(), data() + capacity(), + data() + __old_size, data() + size()); + } }; template <class _Tp, class _Allocator> void vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v) { + __annotate_delete(); __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, this->__end_, __v.__begin_); _VSTD::swap(this->__begin_, __v.__begin_); _VSTD::swap(this->__end_, __v.__end_); _VSTD::swap(this->__end_cap(), __v.__end_cap()); __v.__first_ = __v.__begin_; + __annotate_new(size()); __invalidate_all_iterators(); } @@ -848,6 +888,7 @@ template <class _Tp, class _Allocator> typename vector<_Tp, _Allocator>::pointer vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p) { + __annotate_delete(); pointer __r = __v.__begin_; __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, __p, __v.__begin_); __alloc_traits::__construct_forward(this->__alloc(), __p, this->__end_, __v.__end_); @@ -855,6 +896,7 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a _VSTD::swap(this->__end_, __v.__end_); _VSTD::swap(this->__end_cap(), __v.__end_cap()); __v.__first_ = __v.__begin_; + __annotate_new(size()); __invalidate_all_iterators(); return __r; } @@ -874,6 +916,7 @@ vector<_Tp, _Allocator>::allocate(size_type __n) this->__throw_length_error(); this->__begin_ = this->__end_ = __alloc_traits::allocate(this->__alloc(), __n); this->__end_cap() = this->__begin_ + __n; + __annotate_new(0); } template <class _Tp, class _Allocator> @@ -920,6 +963,7 @@ void vector<_Tp, _Allocator>::__construct_at_end(size_type __n) { allocator_type& __a = this->__alloc(); + __annotate_increase(__n); do { __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_)); @@ -940,6 +984,7 @@ void vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) { allocator_type& __a = this->__alloc(); + __annotate_increase(__n); do { __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x); @@ -960,6 +1005,7 @@ vector<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIt allocator_type& __a = this->__alloc(); for (; __first != __last; ++__first) { + __annotate_increase(1); __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first); ++this->__end_; } @@ -972,6 +1018,7 @@ vector<_Tp, _Allocator>::__move_construct_at_end(pointer __first, pointer __last allocator_type& __a = this->__alloc(); for (; __first != __last; ++__first) { + __annotate_increase(1); __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), _VSTD::move(*__first)); ++this->__end_; @@ -1535,6 +1582,7 @@ vector<_Tp, _Allocator>::push_back(const_reference __x) { if (this->__end_ != this->__end_cap()) { + __annotate_increase(1); __alloc_traits::construct(this->__alloc(), _VSTD::__to_raw_pointer(this->__end_), __x); ++this->__end_; @@ -1552,6 +1600,7 @@ vector<_Tp, _Allocator>::push_back(value_type&& __x) { if (this->__end_ < this->__end_cap()) { + __annotate_increase(1); __alloc_traits::construct(this->__alloc(), _VSTD::__to_raw_pointer(this->__end_), _VSTD::move(__x)); @@ -1584,6 +1633,7 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) { if (this->__end_ < this->__end_cap()) { + __annotate_increase(1); __alloc_traits::construct(this->__alloc(), _VSTD::__to_raw_pointer(this->__end_), _VSTD::forward<_Args>(__args)...); @@ -1666,6 +1716,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) pointer __p = this->__begin_ + (__position - begin()); if (this->__end_ < this->__end_cap()) { + __annotate_increase(1); if (__p == this->__end_) { __alloc_traits::construct(this->__alloc(), @@ -1705,6 +1756,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x) pointer __p = this->__begin_ + (__position - begin()); if (this->__end_ < this->__end_cap()) { + __annotate_increase(1); if (__p == this->__end_) { __alloc_traits::construct(this->__alloc(), @@ -1743,6 +1795,7 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) pointer __p = this->__begin_ + (__position - begin()); if (this->__end_ < this->__end_cap()) { + __annotate_increase(1); if (__p == this->__end_) { __alloc_traits::construct(this->__alloc(), @@ -1794,6 +1847,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_ } if (__n > 0) { + __annotate_increase(__n); __move_range(__p, __old_last, __p + __old_n); const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x); if (__p <= __xr && __xr < this->__end_) @@ -1904,6 +1958,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __fi } if (__n > 0) { + __annotate_increase(__n); __move_range(__p, __old_last, __p + __old_n); _VSTD::copy(__first, __m, __p); } diff --git a/9/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so b/9/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so Binary files differindex 418dc37..3c2afc9 100755 --- a/9/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so +++ b/9/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so diff --git a/9/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_static.a b/9/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_static.a Binary files differindex 9c0c311..1f11749 100644 --- a/9/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_static.a +++ b/9/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_static.a diff --git a/9/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so b/9/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so Binary files differindex 7f72557..7cb3d20 100755 --- a/9/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so +++ b/9/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so diff --git a/9/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_static.a b/9/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_static.a Binary files differindex 1425394..d1e0e36 100644 --- a/9/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_static.a +++ b/9/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_static.a diff --git a/9/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/thumb/libc++_shared.so b/9/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/thumb/libc++_shared.so Binary files differindex 61bf563..5f050b4 100755 --- a/9/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/thumb/libc++_shared.so +++ b/9/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/thumb/libc++_shared.so diff --git a/9/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/thumb/libc++_static.a b/9/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/thumb/libc++_static.a Binary files differindex 509b76a..a54bd32 100644 --- a/9/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/thumb/libc++_static.a +++ b/9/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/thumb/libc++_static.a diff --git a/9/sources/cxx-stl/llvm-libc++/libs/armeabi/libc++_shared.so b/9/sources/cxx-stl/llvm-libc++/libs/armeabi/libc++_shared.so Binary files differindex c98cf55..c21f2e1 100755 --- a/9/sources/cxx-stl/llvm-libc++/libs/armeabi/libc++_shared.so +++ b/9/sources/cxx-stl/llvm-libc++/libs/armeabi/libc++_shared.so diff --git a/9/sources/cxx-stl/llvm-libc++/libs/armeabi/libc++_static.a b/9/sources/cxx-stl/llvm-libc++/libs/armeabi/libc++_static.a Binary files differindex 8cb3175..b05c88e 100644 --- a/9/sources/cxx-stl/llvm-libc++/libs/armeabi/libc++_static.a +++ b/9/sources/cxx-stl/llvm-libc++/libs/armeabi/libc++_static.a diff --git a/9/sources/cxx-stl/llvm-libc++/libs/armeabi/thumb/libc++_shared.so b/9/sources/cxx-stl/llvm-libc++/libs/armeabi/thumb/libc++_shared.so Binary files differindex f8ce611..1157a7a 100755 --- a/9/sources/cxx-stl/llvm-libc++/libs/armeabi/thumb/libc++_shared.so +++ b/9/sources/cxx-stl/llvm-libc++/libs/armeabi/thumb/libc++_shared.so diff --git a/9/sources/cxx-stl/llvm-libc++/libs/armeabi/thumb/libc++_static.a b/9/sources/cxx-stl/llvm-libc++/libs/armeabi/thumb/libc++_static.a Binary files differindex 78f1a30..8c7f837 100644 --- a/9/sources/cxx-stl/llvm-libc++/libs/armeabi/thumb/libc++_static.a +++ b/9/sources/cxx-stl/llvm-libc++/libs/armeabi/thumb/libc++_static.a diff --git a/9/sources/cxx-stl/llvm-libc++/libs/mips/libc++_shared.so b/9/sources/cxx-stl/llvm-libc++/libs/mips/libc++_shared.so Binary files differindex a8d279c..353342b 100755 --- a/9/sources/cxx-stl/llvm-libc++/libs/mips/libc++_shared.so +++ b/9/sources/cxx-stl/llvm-libc++/libs/mips/libc++_shared.so diff --git a/9/sources/cxx-stl/llvm-libc++/libs/mips/libc++_static.a b/9/sources/cxx-stl/llvm-libc++/libs/mips/libc++_static.a Binary files differindex b629671..4d9f54e 100644 --- a/9/sources/cxx-stl/llvm-libc++/libs/mips/libc++_static.a +++ b/9/sources/cxx-stl/llvm-libc++/libs/mips/libc++_static.a diff --git a/9/sources/cxx-stl/llvm-libc++/libs/mips32r6/libc++_shared.so b/9/sources/cxx-stl/llvm-libc++/libs/mips32r6/libc++_shared.so Binary files differindex 32410ac..5f43b73 100755 --- a/9/sources/cxx-stl/llvm-libc++/libs/mips32r6/libc++_shared.so +++ b/9/sources/cxx-stl/llvm-libc++/libs/mips32r6/libc++_shared.so diff --git a/9/sources/cxx-stl/llvm-libc++/libs/mips32r6/libc++_static.a b/9/sources/cxx-stl/llvm-libc++/libs/mips32r6/libc++_static.a Binary files differindex becced3..68b0cd3 100644 --- a/9/sources/cxx-stl/llvm-libc++/libs/mips32r6/libc++_static.a +++ b/9/sources/cxx-stl/llvm-libc++/libs/mips32r6/libc++_static.a diff --git a/9/sources/cxx-stl/llvm-libc++/libs/mips64/libc++_shared.so b/9/sources/cxx-stl/llvm-libc++/libs/mips64/libc++_shared.so Binary files differindex 83c59d2..229dab2 100755 --- a/9/sources/cxx-stl/llvm-libc++/libs/mips64/libc++_shared.so +++ b/9/sources/cxx-stl/llvm-libc++/libs/mips64/libc++_shared.so diff --git a/9/sources/cxx-stl/llvm-libc++/libs/mips64/libc++_static.a b/9/sources/cxx-stl/llvm-libc++/libs/mips64/libc++_static.a Binary files differindex 524ed78..2e9e8fc 100644 --- a/9/sources/cxx-stl/llvm-libc++/libs/mips64/libc++_static.a +++ b/9/sources/cxx-stl/llvm-libc++/libs/mips64/libc++_static.a diff --git a/9/sources/cxx-stl/llvm-libc++/libs/x86/libc++_shared.so b/9/sources/cxx-stl/llvm-libc++/libs/x86/libc++_shared.so Binary files differindex 06b64dc..8051b2b 100755 --- a/9/sources/cxx-stl/llvm-libc++/libs/x86/libc++_shared.so +++ b/9/sources/cxx-stl/llvm-libc++/libs/x86/libc++_shared.so diff --git a/9/sources/cxx-stl/llvm-libc++/libs/x86/libc++_static.a b/9/sources/cxx-stl/llvm-libc++/libs/x86/libc++_static.a Binary files differindex f2346d4..531321c 100644 --- a/9/sources/cxx-stl/llvm-libc++/libs/x86/libc++_static.a +++ b/9/sources/cxx-stl/llvm-libc++/libs/x86/libc++_static.a diff --git a/9/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_shared.so b/9/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_shared.so Binary files differindex cf3e447..5e1454c 100755 --- a/9/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_shared.so +++ b/9/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_shared.so diff --git a/9/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_static.a b/9/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_static.a Binary files differindex f399af8..4799e66 100644 --- a/9/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_static.a +++ b/9/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_static.a |