From 7818280f5b1eac01230020b9554fb00d868e8b1f Mon Sep 17 00:00:00 2001 From: dim Date: Wed, 21 Nov 2012 18:38:56 +0000 Subject: [PATCH] MFC r241903: Import libc++ trunk r165949. Among other improvements and bug fixes, this has many visibility problems fixed, which should help with compiling certain ports that exercise C++11 mode (i.e. Firefox). Also, belatedly add the LICENSE.TXT and accompanying CREDITS.TXT files, which are referred to in all the source files. MFC r241907: Fix two -Wsystem-header warnings in libc++ that were exposed by the new ATF import. These have also been sent upstream. git-svn-id: svn://svn.freebsd.org/base/stable/9@243376 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- contrib/libc++/CREDITS.TXT | 76 ++++ contrib/libc++/LICENSE.TXT | 76 ++++ contrib/libc++/include/__bit_reference | 96 +++-- contrib/libc++/include/__config | 40 +- contrib/libc++/include/__hash_table | 109 +++-- contrib/libc++/include/__locale | 19 +- contrib/libc++/include/__mutex_base | 91 ++-- contrib/libc++/include/__tree | 4 +- contrib/libc++/include/__tuple | 9 + contrib/libc++/include/__undef_min_max | 4 +- contrib/libc++/include/algorithm | 113 +++-- contrib/libc++/include/array | 8 +- contrib/libc++/include/atomic | 2 +- contrib/libc++/include/bitset | 62 ++- contrib/libc++/include/chrono | 131 +++--- contrib/libc++/include/cmath | 390 +++++++++--------- contrib/libc++/include/complex | 48 ++- contrib/libc++/include/condition_variable | 16 +- contrib/libc++/include/cstddef | 22 +- contrib/libc++/include/cstdio | 12 + contrib/libc++/include/cstdlib | 14 +- contrib/libc++/include/deque | 6 +- contrib/libc++/include/exception | 16 +- contrib/libc++/include/forward_list | 8 +- contrib/libc++/include/fstream | 69 ++-- contrib/libc++/include/functional | 11 +- contrib/libc++/include/future | 268 ++++++------ contrib/libc++/include/ios | 80 ++-- contrib/libc++/include/iosfwd | 2 +- contrib/libc++/include/istream | 5 +- contrib/libc++/include/iterator | 93 ++++- contrib/libc++/include/list | 4 +- contrib/libc++/include/locale | 57 ++- contrib/libc++/include/map | 229 +++++----- contrib/libc++/include/memory | 195 ++++++++- contrib/libc++/include/mutex | 52 +-- contrib/libc++/include/new | 4 +- contrib/libc++/include/ostream | 2 +- contrib/libc++/include/queue | 4 +- contrib/libc++/include/random | 25 +- contrib/libc++/include/regex | 62 +-- contrib/libc++/include/stack | 4 +- contrib/libc++/include/streambuf | 2 +- contrib/libc++/include/string | 87 ++-- contrib/libc++/include/system_error | 8 +- contrib/libc++/include/thread | 98 +++-- contrib/libc++/include/tuple | 94 +++-- contrib/libc++/include/type_traits | 155 +++---- contrib/libc++/include/unordered_map | 269 ++++++------ contrib/libc++/include/utility | 14 +- contrib/libc++/include/valarray | 38 +- contrib/libc++/include/vector | 8 +- contrib/libc++/src/condition_variable.cpp | 20 +- contrib/libc++/src/debug.cpp | 20 + contrib/libc++/src/exception.cpp | 27 +- contrib/libc++/src/future.cpp | 2 +- contrib/libc++/src/ios.cpp | 2 +- contrib/libc++/src/iostream.cpp | 28 +- contrib/libc++/src/locale.cpp | 45 +- contrib/libc++/src/memory.cpp | 50 +++ contrib/libc++/src/mutex.cpp | 17 +- contrib/libc++/src/new.cpp | 11 +- contrib/libc++/src/random.cpp | 2 +- contrib/libc++/src/stdexcept.cpp | 15 +- .../libc++/src/support/win32/locale_win32.cpp | 94 ----- contrib/libc++/src/support/win32/support.cpp | 70 ---- contrib/libc++/src/thread.cpp | 33 +- contrib/libc++/src/typeinfo.cpp | 7 + 68 files changed, 2190 insertions(+), 1564 deletions(-) create mode 100644 contrib/libc++/CREDITS.TXT create mode 100644 contrib/libc++/LICENSE.TXT delete mode 100644 contrib/libc++/src/support/win32/locale_win32.cpp delete mode 100644 contrib/libc++/src/support/win32/support.cpp diff --git a/contrib/libc++/CREDITS.TXT b/contrib/libc++/CREDITS.TXT new file mode 100644 index 000000000..f2ca38f9c --- /dev/null +++ b/contrib/libc++/CREDITS.TXT @@ -0,0 +1,76 @@ +This file is a partial list of people who have contributed to the LLVM/libc++ +project. If you have contributed a patch or made some other contribution to +LLVM/libc++, please submit a patch to this file to add yourself, and it will be +done! + +The list is sorted by surname and formatted to allow easy grepping and +beautification by scripts. The fields are: name (N), email (E), web-address +(W), PGP key ID and fingerprint (P), description (D), and snail-mail address +(S). + +N: Howard Hinnant +E: hhinnant@apple.com +D: Architect and primary author of libc++ + +N: Marshall Clow +E: mclow.lists@gmail.com +E: marshall@idio.com +D: Minor patches and bug fixes. + +N: Bjorn Reese +E: breese@users.sourceforge.net +D: Initial regex prototype + +N: David Chisnall +E: theraven at theravensnest dot org +D: FreeBSD and Solaris ports, libcxxrt support, some atomics work. + +N: Ruben Van Boxem +E: vanboxem dot ruben at gmail dot com +D: Initial Windows patches. + +N: Arvid Picciani +E: aep at exys dot org +D: Minor patches and musl port. + +N: Craig Silverstein +E: csilvers@google.com +D: Implemented Cityhash as the string hash function on 64-bit machines + +N: Google Inc. +D: Copyright owner and contributor of the CityHash algorithm + +N: Jeffrey Yasskin +E: jyasskin@gmail.com +E: jyasskin@google.com +D: Linux fixes. + +N: Jonathan Sauer +D: Minor patches, mostly related to constexpr + +N: Richard Smith +D: Minor patches. + +N: Andrew Morrow +E: andrew.c.morrow@gmail.com +D: Minor patches and Linux fixes. + +N: Hyeon-bin Jeong +E: tuhertz@gmail.com +D: Minor patches and bug fixes. + +N: Michel Morin +E: mimomorin@gmail.com +D: Minor patches to is_convertible. + +N: Dimitry Andric +E: dimitry@andric.com +D: Visibility fixes, minor FreeBSD portability patches. + +N: Holger Arnold +E: holgerar@gmail.com +D: Minor fix. + +N: Argyrios Kyrtzidis +E: kyrtzidis@apple.com +D: Bug fixes. diff --git a/contrib/libc++/LICENSE.TXT b/contrib/libc++/LICENSE.TXT new file mode 100644 index 000000000..14645d080 --- /dev/null +++ b/contrib/libc++/LICENSE.TXT @@ -0,0 +1,76 @@ +============================================================================== +libc++ License +============================================================================== + +The libc++ library is dual licensed under both the University of Illinois +"BSD-Like" license and the MIT license. As a user of this code you may choose +to use it under either license. As a contributor, you agree to allow your code +to be used under both. + +Full text of the relevant licenses is included below. + +============================================================================== + +University of Illinois/NCSA +Open Source License + +Copyright (c) 2009-2012 by the contributors listed in CREDITS.TXT + +All rights reserved. + +Developed by: + + LLVM Team + + University of Illinois at Urbana-Champaign + + http://llvm.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal with +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimers in the + documentation and/or other materials provided with the distribution. + + * Neither the names of the LLVM Team, University of Illinois at + Urbana-Champaign, nor the names of its contributors may be used to + endorse or promote products derived from this Software without specific + prior written permission. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE +SOFTWARE. + +============================================================================== + +Copyright (c) 2009-2012 by the contributors listed in CREDITS.TXT + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/contrib/libc++/include/__bit_reference b/contrib/libc++/include/__bit_reference index 48538a24d..8180295bd 100644 --- a/contrib/libc++/include/__bit_reference +++ b/contrib/libc++/include/__bit_reference @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -template class __bit_iterator; +template class __bit_iterator; template class __bit_const_reference; template @@ -131,13 +131,14 @@ public: __bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT : __seg_(__x.__seg_), __mask_(__x.__mask_) {} - _LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator bool() const _NOEXCEPT {return static_cast(*__seg_ & __mask_);} _LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, true> operator&() const _NOEXCEPT {return __bit_iterator<_Cp, true>(__seg_, static_cast(__ctz(__mask_)));} private: _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR __bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT : __seg_(__s), __mask_(__m) {} @@ -146,11 +147,11 @@ private: // find -template -__bit_iterator<_Cp, false> -__find_bool_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) +template +__bit_iterator<_Cp, _IsConst> +__find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) { - typedef __bit_iterator<_Cp, false> _It; + typedef __bit_iterator<_Cp, _IsConst> _It; typedef typename _It::__storage_type __storage_type; static const unsigned __bits_per_word = _It::__bits_per_word; // do first partial word @@ -180,11 +181,11 @@ __find_bool_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n return _It(__first.__seg_, static_cast(__n)); } -template -__bit_iterator<_Cp, false> -__find_bool_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) +template +__bit_iterator<_Cp, _IsConst> +__find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) { - typedef __bit_iterator<_Cp, false> _It; + typedef __bit_iterator<_Cp, _IsConst> _It; typedef typename _It::__storage_type __storage_type; static const unsigned __bits_per_word = _It::__bits_per_word; // do first partial word @@ -193,7 +194,7 @@ __find_bool_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __ __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); __storage_type __dn = _VSTD::min(__clz_f, __n); __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); - __storage_type __b = ~(*__first.__seg_ & __m); + __storage_type __b = ~*__first.__seg_ & __m; if (__b) return _It(__first.__seg_, static_cast(_VSTD::__ctz(__b))); __n -= __dn; @@ -210,17 +211,17 @@ __find_bool_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __ if (__n > 0) { __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); - __storage_type __b = ~(*__first.__seg_ & __m); + __storage_type __b = ~*__first.__seg_ & __m; if (__b) return _It(__first.__seg_, static_cast(_VSTD::__ctz(__b))); } return _It(__first.__seg_, static_cast(__n)); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__bit_iterator<_Cp, false> -find(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, const _Tp& __value_) +__bit_iterator<_Cp, _IsConst> +find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_) { if (static_cast(__value_)) return __find_bool_true(__first, static_cast(__last - __first)); @@ -229,11 +230,11 @@ find(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, cons // count -template -typename __bit_iterator<_Cp, false>::difference_type -__count_bool_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) +template +typename __bit_iterator<_Cp, _IsConst>::difference_type +__count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) { - typedef __bit_iterator<_Cp, false> _It; + typedef __bit_iterator<_Cp, _IsConst> _It; typedef typename _It::__storage_type __storage_type; typedef typename _It::difference_type difference_type; static const unsigned __bits_per_word = _It::__bits_per_word; @@ -260,11 +261,11 @@ __count_bool_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __ return __r; } -template -typename __bit_iterator<_Cp, false>::difference_type -__count_bool_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) +template +typename __bit_iterator<_Cp, _IsConst>::difference_type +__count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) { - typedef __bit_iterator<_Cp, false> _It; + typedef __bit_iterator<_Cp, _IsConst> _It; typedef typename _It::__storage_type __storage_type; typedef typename _It::difference_type difference_type; static const unsigned __bits_per_word = _It::__bits_per_word; @@ -275,7 +276,7 @@ __count_bool_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type _ __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); __storage_type __dn = _VSTD::min(__clz_f, __n); __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); - __r = _VSTD::__pop_count(~(*__first.__seg_ & __m)); + __r = _VSTD::__pop_count(~*__first.__seg_ & __m); __n -= __dn; ++__first.__seg_; } @@ -286,15 +287,15 @@ __count_bool_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type _ if (__n > 0) { __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); - __r += _VSTD::__pop_count(~(*__first.__seg_ & __m)); + __r += _VSTD::__pop_count(~*__first.__seg_ & __m); } return __r; } -template +template inline _LIBCPP_INLINE_VISIBILITY -typename __bit_iterator<_Cp, false>::difference_type -count(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, const _Tp& __value_) +typename __bit_iterator<_Cp, _IsConst>::difference_type +count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_) { if (static_cast(__value_)) return __count_bool_true(__first, static_cast(__last - __first)); @@ -926,12 +927,12 @@ rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle, // equal -template +template bool -__equal_unaligned(__bit_iterator<_Cp, true> __first1, __bit_iterator<_Cp, true> __last1, - __bit_iterator<_Cp, true> __first2) +__equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, + __bit_iterator<_Cp, _IC2> __first2) { - typedef __bit_iterator<_Cp, true> _It; + typedef __bit_iterator<_Cp, _IC1> _It; typedef typename _It::difference_type difference_type; typedef typename _It::__storage_type __storage_type; static const unsigned __bits_per_word = _It::__bits_per_word; @@ -1008,12 +1009,12 @@ __equal_unaligned(__bit_iterator<_Cp, true> __first1, __bit_iterator<_Cp, true> return true; } -template +template bool -__equal_aligned(__bit_iterator<_Cp, true> __first1, __bit_iterator<_Cp, true> __last1, - __bit_iterator<_Cp, true> __first2) +__equal_aligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, + __bit_iterator<_Cp, _IC2> __first2) { - typedef __bit_iterator<_Cp, true> _It; + typedef __bit_iterator<_Cp, _IC1> _It; typedef typename _It::difference_type difference_type; typedef typename _It::__storage_type __storage_type; static const unsigned __bits_per_word = _It::__bits_per_word; @@ -1061,7 +1062,8 @@ equal(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __b return __equal_unaligned(__first1, __last1, __first2); } -template +template class __bit_iterator { public: @@ -1232,19 +1234,23 @@ private: template friend __bit_iterator<_Dp, false> rotate(__bit_iterator<_Dp, false>, __bit_iterator<_Dp, false>, __bit_iterator<_Dp, false>); - template friend bool __equal_aligned(__bit_iterator<_Dp, true>, - __bit_iterator<_Dp, true>, - __bit_iterator<_Dp, true>); - template friend bool __equal_unaligned(__bit_iterator<_Dp, true>, - __bit_iterator<_Dp, true>, - __bit_iterator<_Dp, true>); + template friend bool __equal_aligned(__bit_iterator<_Dp, _IC1>, + __bit_iterator<_Dp, _IC1>, + __bit_iterator<_Dp, _IC2>); + template friend bool __equal_unaligned(__bit_iterator<_Dp, _IC1>, + __bit_iterator<_Dp, _IC1>, + __bit_iterator<_Dp, _IC2>); template friend bool equal(__bit_iterator<_Dp, _IC1>, __bit_iterator<_Dp, _IC1>, __bit_iterator<_Dp, _IC2>); - template friend __bit_iterator<_Dp, false> __find_bool_true(__bit_iterator<_Dp, false>, + template friend __bit_iterator<_Dp, _IC> __find_bool_true(__bit_iterator<_Dp, _IC>, typename _Dp::size_type); - template friend __bit_iterator<_Dp, false> __find_bool_false(__bit_iterator<_Dp, false>, + template friend __bit_iterator<_Dp, _IC> __find_bool_false(__bit_iterator<_Dp, _IC>, typename _Dp::size_type); + template friend typename __bit_iterator<_Dp, _IC>::difference_type + __count_bool_true(__bit_iterator<_Dp, _IC>, typename _Dp::size_type); + template friend typename __bit_iterator<_Dp, _IC>::difference_type + __count_bool_false(__bit_iterator<_Dp, _IC>, typename _Dp::size_type); }; _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libc++/include/__config b/contrib/libc++/include/__config index 7cd01dc1b..75b2206f2 100644 --- a/contrib/libc++/include/__config +++ b/contrib/libc++/include/__config @@ -15,7 +15,11 @@ #pragma GCC system_header #endif -#define _LIBCPP_VERSION 1001 +#ifdef __GNUC__ +#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__) +#endif + +#define _LIBCPP_VERSION 1101 #define _LIBCPP_ABI_VERSION 1 @@ -53,7 +57,8 @@ # define _LIBCPP_LITTLE_ENDIAN 1 # define _LIBCPP_BIG_ENDIAN 0 // Compiler intrinsics (GCC or MSVC) -# if (defined(_MSC_VER) && _MSC_VER >= 1400) || (__GNUC__ >= 4 && __GNUC_MINOR__ > 3) +# if (defined(_MSC_VER) && _MSC_VER >= 1400) \ + || (defined(__GNUC__) && _GNUC_VER > 403) # define _LIBCP_HAS_IS_BASE_OF # endif #endif // _WIN32 @@ -145,8 +150,10 @@ #if defined(__clang__) #if __has_feature(cxx_alignas) +# define _ALIGNAS_TYPE(x) alignas(x) # define _ALIGNAS(x) alignas(x) #else +# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) # define _ALIGNAS(x) __attribute__((__aligned__(x))) #endif @@ -180,9 +187,9 @@ typedef __char32_t char32_t; #endif #if __has_feature(cxx_attributes) -# define _ATTRIBUTE(x) [[x]] +# define _LIBCPP_NORETURN [[noreturn]] #else -# define _ATTRIBUTE(x) __attribute__ ((x)) +# define _LIBCPP_NORETURN __attribute__ ((noreturn)) #endif #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS @@ -245,8 +252,9 @@ typedef __char32_t char32_t; #define _LIBCPP_HAS_NO_CONSTEXPR #endif -#if __FreeBSD__ +#if __FreeBSD__ && (__ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L) #define _LIBCPP_HAS_QUICK_EXIT +#define _LIBCPP_HAS_C11_FEATURES #endif #if (__has_feature(cxx_noexcept)) @@ -274,8 +282,9 @@ namespace std { #elif defined(__GNUC__) #define _ALIGNAS(x) __attribute__((__aligned__(x))) +#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) -#define _ATTRIBUTE(x) __attribute__((x)) +#define _LIBCPP_NORETURN __attribute__((noreturn)) #if !__EXCEPTIONS #define _LIBCPP_NO_EXCEPTIONS @@ -305,15 +314,15 @@ namespace std { #define _LIBCPP_HAS_NO_TRAILING_RETURN #define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS -#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3) +#if _GNUC_VER < 403 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif -#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3) +#if _GNUC_VER < 403 #define _LIBCPP_HAS_NO_STATIC_ASSERT #endif -#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4) +#if _GNUC_VER < 404 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE #define _LIBCPP_HAS_NO_DECLTYPE #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS @@ -321,9 +330,9 @@ namespace std { #define _LIBCPP_HAS_NO_UNICODE_CHARS #define _LIBCPP_HAS_NO_VARIADICS #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4) +#endif // _GNUC_VER < 404 -#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6) +#if _GNUC_VER < 406 #define _LIBCPP_HAS_NO_NULLPTR #endif @@ -347,7 +356,7 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); #define _LIBCPP_HAS_NO_UNICODE_CHARS #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS #define __alignof__ __alignof -#define _ATTRIBUTE __declspec +#define _LIBCPP_NORETURN __declspec(noreturn) #define _ALIGNAS(x) __declspec(align(x)) #define _LIBCPP_HAS_NO_VARIADICS @@ -389,6 +398,12 @@ template struct __static_assert_check {}; #define _LIBCPP_CONSTEXPR constexpr #endif +#ifdef __GNUC__ +#define _NOALIAS __attribute__((malloc)) +#else +#define _NOALIAS +#endif + #ifndef __has_feature #define __has_feature(__x) 0 #endif @@ -404,6 +419,7 @@ template struct __static_assert_check {}; #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \ _ __v_; \ _LIBCPP_ALWAYS_INLINE x(_ __v) : __v_(__v) {} \ + _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<_>(__v)) {} \ _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \ }; #else // _LIBCPP_HAS_NO_STRONG_ENUMS diff --git a/contrib/libc++/include/__hash_table b/contrib/libc++/include/__hash_table index fad4e0e6a..ba04b3e54 100644 --- a/contrib/libc++/include/__hash_table +++ b/contrib/libc++/include/__hash_table @@ -58,10 +58,31 @@ struct __hash_node value_type __value_; }; +inline _LIBCPP_INLINE_VISIBILITY +bool +__is_power2(size_t __bc) +{ + return __bc > 2 && !(__bc & (__bc - 1)); +} + +inline _LIBCPP_INLINE_VISIBILITY +size_t +__constrain_hash(size_t __h, size_t __bc) +{ + return !(__bc & (__bc - 1)) ? __h & (__bc - 1) : __h % __bc; +} + +inline _LIBCPP_INLINE_VISIBILITY +size_t +__next_pow2(size_t __n) +{ + return size_t(1) << (std::numeric_limits::digits - __clz(__n-1)); +} + template class __hash_table; -template class __hash_const_iterator; -template class __hash_map_iterator; -template class __hash_map_const_iterator; +template class _LIBCPP_VISIBLE __hash_const_iterator; +template class _LIBCPP_VISIBLE __hash_map_iterator; +template class _LIBCPP_VISIBLE __hash_map_const_iterator; template class _LIBCPP_VISIBLE unordered_map; @@ -240,7 +261,7 @@ public: __hash_local_iterator& operator++() { __node_ = __node_->__next_; - if (__node_ != nullptr && __node_->__hash_ % __bucket_count_ != __bucket_) + if (__node_ != nullptr && __constrain_hash(__node_->__hash_, __bucket_count_) != __bucket_) __node_ = nullptr; return *this; } @@ -330,7 +351,7 @@ public: __hash_const_local_iterator& operator++() { __node_ = __node_->__next_; - if (__node_ != nullptr && __node_->__hash_ % __bucket_count_ != __bucket_) + if (__node_ != nullptr && __constrain_hash(__node_->__hash_, __bucket_count_) != __bucket_) __node_ = nullptr; return *this; } @@ -637,7 +658,7 @@ public: template _LIBCPP_INLINE_VISIBILITY size_type bucket(const _Key& __k) const - {return hash_function()(__k) % bucket_count();} + {return __constrain_hash(hash_function()(__k), bucket_count());} template iterator find(const _Key& __x); @@ -871,7 +892,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u) { if (size() > 0) { - __bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] = + __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] = static_cast<__node_pointer>(_VSTD::addressof(__p1_.first())); __u.__p1_.first().__next_ = nullptr; __u.size() = 0; @@ -895,7 +916,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u, { __p1_.first().__next_ = __u.__p1_.first().__next_; __u.__p1_.first().__next_ = nullptr; - __bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] = + __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] = static_cast<__node_pointer>(_VSTD::addressof(__p1_.first())); size() = __u.size(); __u.size() = 0; @@ -992,7 +1013,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign( __p1_.first().__next_ = __u.__p1_.first().__next_; if (size() > 0) { - __bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] = + __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] = static_cast<__node_pointer>(_VSTD::addressof(__p1_.first())); __u.__p1_.first().__next_ = nullptr; __u.size() = 0; @@ -1190,12 +1211,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __ size_t __chash; if (__bc != 0) { - __chash = __nd->__hash_ % __bc; + __chash = __constrain_hash(__nd->__hash_, __bc); __ndptr = __bucket_list_[__chash]; if (__ndptr != nullptr) { for (__ndptr = __ndptr->__next_; __ndptr != nullptr && - __ndptr->__hash_ % __bc == __chash; + __constrain_hash(__ndptr->__hash_, __bc) == __chash; __ndptr = __ndptr->__next_) { if (key_eq()(__ndptr->__value_, __nd->__value_)) @@ -1206,10 +1227,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __ { if (size()+1 > __bc * max_load_factor() || __bc == 0) { - rehash(_VSTD::max(2 * __bc + 1, + rehash(_VSTD::max(2 * __bc + !__is_power2(__bc), size_type(ceil(float(size() + 1) / max_load_factor())))); __bc = bucket_count(); - __chash = __nd->__hash_ % __bc; + __chash = __constrain_hash(__nd->__hash_, __bc); } // insert_after __bucket_list_[__chash], or __first_node if bucket is null __node_pointer __pn = __bucket_list_[__chash]; @@ -1221,7 +1242,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __ // fix up __bucket_list_ __bucket_list_[__chash] = __pn; if (__nd->__next_ != nullptr) - __bucket_list_[__nd->__next_->__hash_ % __bc] = __nd; + __bucket_list_[__constrain_hash(__nd->__next_->__hash_, __bc)] = __nd; } else { @@ -1245,11 +1266,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c size_type __bc = bucket_count(); if (size()+1 > __bc * max_load_factor() || __bc == 0) { - rehash(_VSTD::max(2 * __bc + 1, + rehash(_VSTD::max(2 * __bc + !__is_power2(__bc), size_type(ceil(float(size() + 1) / max_load_factor())))); __bc = bucket_count(); } - size_t __chash = __cp->__hash_ % __bc; + size_t __chash = __constrain_hash(__cp->__hash_, __bc); __node_pointer __pn = __bucket_list_[__chash]; if (__pn == nullptr) { @@ -1259,12 +1280,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c // fix up __bucket_list_ __bucket_list_[__chash] = __pn; if (__cp->__next_ != nullptr) - __bucket_list_[__cp->__next_->__hash_ % __bc] = __cp; + __bucket_list_[__constrain_hash(__cp->__next_->__hash_, __bc)] = __cp; } else { for (bool __found = false; __pn->__next_ != nullptr && - __pn->__next_->__hash_ % __bc == __chash; + __constrain_hash(__pn->__next_->__hash_, __bc) == __chash; __pn = __pn->__next_) { // __found key_eq() action @@ -1285,7 +1306,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c __pn->__next_ = __cp; if (__cp->__next_ != nullptr) { - size_t __nhash = __cp->__next_->__hash_ % __bc; + size_t __nhash = __constrain_hash(__cp->__next_->__hash_, __bc); if (__nhash != __chash) __bucket_list_[__nhash] = __cp; } @@ -1306,11 +1327,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi( size_type __bc = bucket_count(); if (size()+1 > __bc * max_load_factor() || __bc == 0) { - rehash(_VSTD::max(2 * __bc + 1, + rehash(_VSTD::max(2 * __bc + !__is_power2(__bc), size_type(ceil(float(size() + 1) / max_load_factor())))); __bc = bucket_count(); } - size_t __chash = __cp->__hash_ % __bc; + size_t __chash = __constrain_hash(__cp->__hash_, __bc); __node_pointer __pp = __bucket_list_[__chash]; while (__pp->__next_ != __np) __pp = __pp->__next_; @@ -1333,12 +1354,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x) size_t __chash; if (__bc != 0) { - __chash = __hash % __bc; + __chash = __constrain_hash(__hash, __bc); __nd = __bucket_list_[__chash]; if (__nd != nullptr) { for (__nd = __nd->__next_; __nd != nullptr && - __nd->__hash_ % __bc == __chash; + __constrain_hash(__nd->__hash_, __bc) == __chash; __nd = __nd->__next_) { if (key_eq()(__nd->__value_, __x)) @@ -1350,10 +1371,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x) __node_holder __h = __construct_node(__x, __hash); if (size()+1 > __bc * max_load_factor() || __bc == 0) { - rehash(_VSTD::max(2 * __bc + 1, + rehash(_VSTD::max(2 * __bc + !__is_power2(__bc), size_type(ceil(float(size() + 1) / max_load_factor())))); __bc = bucket_count(); - __chash = __hash % __bc; + __chash = __constrain_hash(__hash, __bc); } // insert_after __bucket_list_[__chash], or __first_node if bucket is null __node_pointer __pn = __bucket_list_[__chash]; @@ -1365,7 +1386,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x) // fix up __bucket_list_ __bucket_list_[__chash] = __pn; if (__h->__next_ != nullptr) - __bucket_list_[__h->__next_->__hash_ % __bc] = __h.get(); + __bucket_list_[__constrain_hash(__h->__next_->__hash_, __bc)] = __h.get(); } else { @@ -1489,16 +1510,20 @@ template void __hash_table<_Tp, _Hash, _Equal, _Alloc>::rehash(size_type __n) { - __n = __next_prime(_VSTD::max(__n, size() > 0)); + if (__n == 1) + __n = 2; + else if (__n & (__n - 1)) + __n = __next_prime(__n); size_type __bc = bucket_count(); if (__n > __bc) __rehash(__n); - else + else if (__n < __bc) { __n = _VSTD::max ( __n, - __next_prime(size_t(ceil(float(size()) / max_load_factor()))) + __is_power2(__bc) ? __next_pow2(size_t(ceil(float(size()) / max_load_factor()))) : + __next_prime(size_t(ceil(float(size()) / max_load_factor()))) ); if (__n < __bc) __rehash(__n); @@ -1521,13 +1546,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __nbc) __node_pointer __cp = __pp->__next_; if (__cp != nullptr) { - size_type __chash = __cp->__hash_ % __nbc; + size_type __chash = __constrain_hash(__cp->__hash_, __nbc); __bucket_list_[__chash] = __pp; size_type __phash = __chash; for (__pp = __cp, __cp = __cp->__next_; __cp != nullptr; __cp = __pp->__next_) { - __chash = __cp->__hash_ % __nbc; + __chash = __constrain_hash(__cp->__hash_, __nbc); if (__chash == __phash) __pp = __cp; else @@ -1565,12 +1590,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) size_type __bc = bucket_count(); if (__bc != 0) { - size_t __chash = __hash % __bc; + size_t __chash = __constrain_hash(__hash, __bc); __node_pointer __nd = __bucket_list_[__chash]; if (__nd != nullptr) { for (__nd = __nd->__next_; __nd != nullptr && - __nd->__hash_ % __bc == __chash; + __constrain_hash(__nd->__hash_, __bc) == __chash; __nd = __nd->__next_) { if (key_eq()(__nd->__value_, __k)) @@ -1590,12 +1615,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const size_type __bc = bucket_count(); if (__bc != 0) { - size_t __chash = __hash % __bc; + size_t __chash = __constrain_hash(__hash, __bc); __node_const_pointer __nd = __bucket_list_[__chash]; if (__nd != nullptr) { for (__nd = __nd->__next_; __nd != nullptr && - __nd->__hash_ % __bc == __chash; + __constrain_hash(__nd->__hash_, __bc) == __chash; __nd = __nd->__next_) { if (key_eq()(__nd->__value_, __k)) @@ -1734,7 +1759,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT // current node __node_pointer __cn = const_cast<__node_pointer>(__p.__node_); size_type __bc = bucket_count(); - size_t __chash = __cn->__hash_ % __bc; + size_t __chash = __constrain_hash(__cn->__hash_, __bc); // find previous node __node_pointer __pn = __bucket_list_[__chash]; for (; __pn->__next_ != __cn; __pn = __pn->__next_) @@ -1742,15 +1767,15 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT // Fix up __bucket_list_ // if __pn is not in same bucket (before begin is not in same bucket) && // if __cn->__next_ is not in same bucket (nullptr is not in same bucket) - if (__pn == _VSTD::addressof(__p1_.first()) || __pn->__hash_ % __bc != __chash) + if (__pn == _VSTD::addressof(__p1_.first()) || __constrain_hash(__pn->__hash_, __bc) != __chash) { - if (__cn->__next_ == nullptr || __cn->__next_->__hash_ % __bc != __chash) + if (__cn->__next_ == nullptr || __constrain_hash(__cn->__next_->__hash_, __bc) != __chash) __bucket_list_[__chash] = nullptr; } // if __cn->__next_ is not in same bucket (nullptr is in same bucket) if (__cn->__next_ != nullptr) { - size_t __nhash = __cn->__next_->__hash_ % __bc; + size_t __nhash = __constrain_hash(__cn->__next_->__hash_, __bc); if (__nhash != __chash) __bucket_list_[__nhash] = __pn; } @@ -1881,10 +1906,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u) __p2_.swap(__u.__p2_); __p3_.swap(__u.__p3_); if (size() > 0) - __bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] = + __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] = static_cast<__node_pointer>(_VSTD::addressof(__p1_.first())); if (__u.size() > 0) - __u.__bucket_list_[__u.__p1_.first().__next_->__hash_ % __u.bucket_count()] = + __u.__bucket_list_[__constrain_hash(__u.__p1_.first().__next_->__hash_, __u.bucket_count())] = static_cast<__node_pointer>(_VSTD::addressof(__u.__p1_.first())); } @@ -1898,7 +1923,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::bucket_size(size_type __n) const if (__np != nullptr) { for (__np = __np->__next_; __np != nullptr && - __np->__hash_ % __bc == __n; + __constrain_hash(__np->__hash_, __bc) == __n; __np = __np->__next_, ++__r) ; } diff --git a/contrib/libc++/include/__locale b/contrib/libc++/include/__locale index b1e07113e..e6c357f9e 100644 --- a/contrib/libc++/include/__locale +++ b/contrib/libc++/include/__locale @@ -31,17 +31,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD -class locale; +class _LIBCPP_VISIBLE locale; -template bool has_facet(const locale&) _NOEXCEPT; -template const _Facet& use_facet(const locale&); +template +_LIBCPP_INLINE_VISIBILITY +bool +has_facet(const locale&) _NOEXCEPT; + +template +_LIBCPP_INLINE_VISIBILITY +const _Facet& +use_facet(const locale&); class _LIBCPP_VISIBLE locale { public: // types: - class facet; - class id; + class _LIBCPP_VISIBLE facet; + class _LIBCPP_VISIBLE id; typedef int category; static const category // values assigned here are for exposition only @@ -119,7 +126,7 @@ class _LIBCPP_VISIBLE locale::id static int32_t __next_id; public: - _LIBCPP_INLINE_VISIBILITY id() {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR id() :__id_(0) {} private: void __init(); void operator=(const id&); // = delete; diff --git a/contrib/libc++/include/__mutex_base b/contrib/libc++/include/__mutex_base index 5410272b4..538e89bed 100644 --- a/contrib/libc++/include/__mutex_base +++ b/contrib/libc++/include/__mutex_base @@ -38,7 +38,11 @@ class _LIBCPP_VISIBLE mutex public: _LIBCPP_INLINE_VISIBILITY - mutex() {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;} +#ifndef _LIBCPP_HAS_NO_CONSTEXPR + constexpr mutex() _NOEXCEPT : __m_(PTHREAD_MUTEX_INITIALIZER) {} +#else + mutex() _NOEXCEPT {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;} +#endif ~mutex(); private: @@ -47,8 +51,8 @@ private: public: void lock(); - bool try_lock(); - void unlock(); + bool try_lock() _NOEXCEPT; + void unlock() _NOEXCEPT; typedef pthread_mutex_t* native_handle_type; _LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;} @@ -58,17 +62,19 @@ struct _LIBCPP_VISIBLE defer_lock_t {}; struct _LIBCPP_VISIBLE try_to_lock_t {}; struct _LIBCPP_VISIBLE adopt_lock_t {}; -//constexpr -extern const -defer_lock_t defer_lock; +#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MUTEX) + +extern const defer_lock_t defer_lock; +extern const try_to_lock_t try_to_lock; +extern const adopt_lock_t adopt_lock; -//constexpr -extern const -try_to_lock_t try_to_lock; +#else -//constexpr -extern const -adopt_lock_t adopt_lock; +constexpr defer_lock_t defer_lock = defer_lock_t(); +constexpr try_to_lock_t try_to_lock = try_to_lock_t(); +constexpr adopt_lock_t adopt_lock = adopt_lock_t(); + +#endif template class _LIBCPP_VISIBLE lock_guard @@ -106,12 +112,12 @@ private: public: _LIBCPP_INLINE_VISIBILITY - unique_lock() : __m_(nullptr), __owns_(false) {} + unique_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {} _LIBCPP_INLINE_VISIBILITY explicit unique_lock(mutex_type& __m) : __m_(&__m), __owns_(true) {__m_->lock();} _LIBCPP_INLINE_VISIBILITY - unique_lock(mutex_type& __m, defer_lock_t) + unique_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT : __m_(&__m), __owns_(false) {} _LIBCPP_INLINE_VISIBILITY unique_lock(mutex_type& __m, try_to_lock_t) @@ -141,11 +147,11 @@ private: public: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - unique_lock(unique_lock&& __u) + unique_lock(unique_lock&& __u) _NOEXCEPT : __m_(__u.__m_), __owns_(__u.__owns_) {__u.__m_ = nullptr; __u.__owns_ = false;} _LIBCPP_INLINE_VISIBILITY - unique_lock& operator=(unique_lock&& __u) + unique_lock& operator=(unique_lock&& __u) _NOEXCEPT { if (__owns_) __m_->unlock(); @@ -190,13 +196,13 @@ public: void unlock(); _LIBCPP_INLINE_VISIBILITY - void swap(unique_lock& __u) + void swap(unique_lock& __u) _NOEXCEPT { _VSTD::swap(__m_, __u.__m_); _VSTD::swap(__owns_, __u.__owns_); } _LIBCPP_INLINE_VISIBILITY - mutex_type* release() + mutex_type* release() _NOEXCEPT { mutex_type* __m = __m_; __m_ = nullptr; @@ -205,12 +211,12 @@ public: } _LIBCPP_INLINE_VISIBILITY - bool owns_lock() const {return __owns_;} + bool owns_lock() const _NOEXCEPT {return __owns_;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_EXPLICIT - operator bool () const {return __owns_;} + operator bool () const _NOEXCEPT {return __owns_;} _LIBCPP_INLINE_VISIBILITY - mutex_type* mutex() const {return __m_;} + mutex_type* mutex() const _NOEXCEPT {return __m_;} }; template @@ -276,7 +282,8 @@ unique_lock<_Mutex>::unlock() template inline _LIBCPP_INLINE_VISIBILITY void -swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) {__x.swap(__y);} +swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) _NOEXCEPT + {__x.swap(__y);} struct _LIBCPP_VISIBLE cv_status { @@ -297,7 +304,11 @@ class _LIBCPP_VISIBLE condition_variable pthread_cond_t __cv_; public: _LIBCPP_INLINE_VISIBILITY +#ifndef _LIBCPP_HAS_NO_CONSTEXPR + constexpr condition_variable() : __cv_(PTHREAD_COND_INITIALIZER) {} +#else condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;} +#endif ~condition_variable(); private: @@ -305,18 +316,13 @@ private: condition_variable& operator=(const condition_variable&); // = delete; public: - void notify_one(); - void notify_all(); + void notify_one() _NOEXCEPT; + void notify_all() _NOEXCEPT; void wait(unique_lock& __lk); template void wait(unique_lock& __lk, _Predicate __pred); - template - cv_status - wait_until(unique_lock& __lk, - const chrono::time_point& __t); - template cv_status wait_until(unique_lock& __lk, @@ -371,28 +377,13 @@ condition_variable::wait(unique_lock& __lk, _Predicate __pred) wait(__lk); } -template -cv_status -condition_variable::wait_until(unique_lock& __lk, - const chrono::time_point& __t) -{ - using namespace chrono; - typedef time_point __nano_sys_tmpt; - __do_timed_wait(__lk, - __nano_sys_tmpt(__ceil(__t.time_since_epoch()))); - return system_clock::now() < __t ? cv_status::no_timeout : - cv_status::timeout; -} - template cv_status condition_variable::wait_until(unique_lock& __lk, const chrono::time_point<_Clock, _Duration>& __t) { using namespace chrono; - system_clock::time_point __s_now = system_clock::now(); - typename _Clock::time_point __c_now = _Clock::now(); - __do_timed_wait(__lk, __s_now + __ceil(__t - __c_now)); + wait_for(__lk, __t - _Clock::now()); return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout; } @@ -416,9 +407,17 @@ condition_variable::wait_for(unique_lock& __lk, const chrono::duration<_Rep, _Period>& __d) { using namespace chrono; + if (__d <= __d.zero()) + return cv_status::timeout; + typedef time_point > __sys_tpf; + typedef time_point __sys_tpi; + __sys_tpf _Max = __sys_tpi::max(); system_clock::time_point __s_now = system_clock::now(); steady_clock::time_point __c_now = steady_clock::now(); - __do_timed_wait(__lk, __s_now + __ceil(__d)); + if (_Max - __d > __s_now) + __do_timed_wait(__lk, __s_now + __ceil(__d)); + else + __do_timed_wait(__lk, __sys_tpi::max()); return steady_clock::now() - __c_now < __d ? cv_status::no_timeout : cv_status::timeout; } diff --git a/contrib/libc++/include/__tree b/contrib/libc++/include/__tree index f57c80c85..bd38b4f2b 100644 --- a/contrib/libc++/include/__tree +++ b/contrib/libc++/include/__tree @@ -614,8 +614,8 @@ public: #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) }; -template class __map_iterator; -template class __map_const_iterator; +template class _LIBCPP_VISIBLE __map_iterator; +template class _LIBCPP_VISIBLE __map_const_iterator; template class _LIBCPP_VISIBLE __tree_iterator diff --git a/contrib/libc++/include/__tuple b/contrib/libc++/include/__tuple index 82168048e..1fa90a008 100644 --- a/contrib/libc++/include/__tuple +++ b/contrib/libc++/include/__tuple @@ -79,38 +79,47 @@ template struct __tuple_like > : true_type template struct __tuple_like > : true_type {}; template +_LIBCPP_INLINE_VISIBILITY typename tuple_element<_Ip, tuple<_Tp...> >::type& get(tuple<_Tp...>&) _NOEXCEPT; template +_LIBCPP_INLINE_VISIBILITY const typename tuple_element<_Ip, tuple<_Tp...> >::type& get(const tuple<_Tp...>&) _NOEXCEPT; template +_LIBCPP_INLINE_VISIBILITY typename tuple_element<_Ip, tuple<_Tp...> >::type&& get(tuple<_Tp...>&&) _NOEXCEPT; template +_LIBCPP_INLINE_VISIBILITY typename tuple_element<_Ip, pair<_T1, _T2> >::type& get(pair<_T1, _T2>&) _NOEXCEPT; template +_LIBCPP_INLINE_VISIBILITY const typename tuple_element<_Ip, pair<_T1, _T2> >::type& get(const pair<_T1, _T2>&) _NOEXCEPT; template +_LIBCPP_INLINE_VISIBILITY typename tuple_element<_Ip, pair<_T1, _T2> >::type&& get(pair<_T1, _T2>&&) _NOEXCEPT; template +_LIBCPP_INLINE_VISIBILITY _Tp& get(array<_Tp, _Size>&) _NOEXCEPT; template +_LIBCPP_INLINE_VISIBILITY const _Tp& get(const array<_Tp, _Size>&) _NOEXCEPT; template +_LIBCPP_INLINE_VISIBILITY _Tp&& get(array<_Tp, _Size>&&) _NOEXCEPT; diff --git a/contrib/libc++/include/__undef_min_max b/contrib/libc++/include/__undef_min_max index 88bc53fea..b1e80d1b0 100644 --- a/contrib/libc++/include/__undef_min_max +++ b/contrib/libc++/include/__undef_min_max @@ -9,11 +9,11 @@ //===----------------------------------------------------------------------===// #ifdef min -#warning: macro min is incompatible with C++. #undef'ing min +#warning: macro min is incompatible with C++. #undefing min #undef min #endif #ifdef max -#warning: macro max is incompatible with C++. #undef'ing max +#warning: macro max is incompatible with C++. #undefing max #undef max #endif diff --git a/contrib/libc++/include/algorithm b/contrib/libc++/include/algorithm index d924a7de3..1ce14b46d 100644 --- a/contrib/libc++/include/algorithm +++ b/contrib/libc++/include/algorithm @@ -593,7 +593,7 @@ template #include #include #include -#include +#include #include <__undef_min_max> @@ -2103,12 +2103,31 @@ reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, _Out template _ForwardIterator -__rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, false_type) +__rotate_left(_ForwardIterator __first, _ForwardIterator __last) +{ + typedef typename iterator_traits<_ForwardIterator>::value_type value_type; + value_type __tmp = _VSTD::move(*__first); + _ForwardIterator __lm1 = _VSTD::move(_VSTD::next(__first), __last, __first); + *__lm1 = _VSTD::move(__tmp); + return __lm1; +} + +template +_BidirectionalIterator +__rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last) +{ + typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type; + _BidirectionalIterator __lm1 = _VSTD::prev(__last); + value_type __tmp = _VSTD::move(*__lm1); + _BidirectionalIterator __fp1 = _VSTD::move_backward(__first, __lm1, __last); + *__first = _VSTD::move(__tmp); + return __fp1; +} + +template +_ForwardIterator +__rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last) { - if (__first == __middle) - return __last; - if (__middle == __last) - return __first; _ForwardIterator __i = __middle; while (true) { @@ -2156,15 +2175,11 @@ __gcd(_Integral __x, _Integral __y) template _RandomAccessIterator -__rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, true_type) +__rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last) { typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; - if (__first == __middle) - return __last; - if (__middle == __last) - return __first; const difference_type __m1 = __middle - __first; const difference_type __m2 = __last - __middle; if (__m1 == __m2) @@ -2172,15 +2187,15 @@ __rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomA _VSTD::swap_ranges(__first, __middle, __middle); return __middle; } - const difference_type __g = __gcd(__m1, __m2); + const difference_type __g = _VSTD::__gcd(__m1, __m2); for (_RandomAccessIterator __p = __first + __g; __p != __first;) { - value_type __t(*--__p); + value_type __t(_VSTD::move(*--__p)); _RandomAccessIterator __p1 = __p; _RandomAccessIterator __p2 = __p1 + __m1; do { - *__p1 = *__p2; + *__p1 = _VSTD::move(*__p2); __p1 = __p2; const difference_type __d = __last - __p2; if (__m1 < __d) @@ -2188,30 +2203,72 @@ __rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomA else __p2 = __first + (__m1 - __d); } while (__p2 != __p); - *__p1 = __t; + *__p1 = _VSTD::move(__t); } return __first + __m2; } +template +inline _LIBCPP_INLINE_VISIBILITY +_ForwardIterator +__rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, + _VSTD::forward_iterator_tag) +{ + typedef typename _VSTD::iterator_traits<_ForwardIterator>::value_type value_type; + if (_VSTD::is_trivially_move_assignable::value) + { + if (_VSTD::next(__first) == __middle) + return _VSTD::__rotate_left(__first, __last); + } + return _VSTD::__rotate_forward(__first, __middle, __last); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +_BidirectionalIterator +__rotate(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, + _VSTD::bidirectional_iterator_tag) +{ + typedef typename _VSTD::iterator_traits<_BidirectionalIterator>::value_type value_type; + if (_VSTD::is_trivially_move_assignable::value) + { + if (_VSTD::next(__first) == __middle) + return _VSTD::__rotate_left(__first, __last); + if (_VSTD::next(__middle) == __last) + return _VSTD::__rotate_right(__first, __last); + } + return _VSTD::__rotate_forward(__first, __middle, __last); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +_RandomAccessIterator +__rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, + _VSTD::random_access_iterator_tag) +{ + typedef typename _VSTD::iterator_traits<_RandomAccessIterator>::value_type value_type; + if (_VSTD::is_trivially_move_assignable::value) + { + if (_VSTD::next(__first) == __middle) + return _VSTD::__rotate_left(__first, __last); + if (_VSTD::next(__middle) == __last) + return _VSTD::__rotate_right(__first, __last); + return _VSTD::__rotate_gcd(__first, __middle, __last); + } + return _VSTD::__rotate_forward(__first, __middle, __last); +} + template inline _LIBCPP_INLINE_VISIBILITY _ForwardIterator rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last) { + if (__first == __middle) + return __last; + if (__middle == __last) + return __first; return _VSTD::__rotate(__first, __middle, __last, - integral_constant - < - bool, - is_convertible - < - typename iterator_traits<_ForwardIterator>::iterator_category, - random_access_iterator_tag - >::value && - is_trivially_copy_assignable - < - typename iterator_traits<_ForwardIterator>::value_type - >::value - >()); + typename _VSTD::iterator_traits<_ForwardIterator>::iterator_category()); } // rotate_copy diff --git a/contrib/libc++/include/array b/contrib/libc++/include/array index c11f4bd74..029bfd00a 100644 --- a/contrib/libc++/include/array +++ b/contrib/libc++/include/array @@ -55,7 +55,7 @@ struct array // capacity: constexpr size_type size() const noexcept; constexpr size_type max_size() const noexcept; - bool empty() const noexcept; + constexpr bool empty() const noexcept; // element access: reference operator[](size_type n); @@ -173,11 +173,11 @@ struct _LIBCPP_VISIBLE array // capacity: _LIBCPP_INLINE_VISIBILITY - /*constexpr*/ size_type size() const _NOEXCEPT {return _Size;} + _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return _Size;} _LIBCPP_INLINE_VISIBILITY - /*constexpr*/ size_type max_size() const _NOEXCEPT {return _Size;} + _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;} _LIBCPP_INLINE_VISIBILITY - bool empty() const _NOEXCEPT {return _Size == 0;} + _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;} // element access: _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];} diff --git a/contrib/libc++/include/atomic b/contrib/libc++/include/atomic index 6a200eba5..6dffdb21f 100644 --- a/contrib/libc++/include/atomic +++ b/contrib/libc++/include/atomic @@ -555,7 +555,7 @@ kill_dependency(_Tp __y) _NOEXCEPT template ::value && !is_same<_Tp, bool>::value> struct __atomic_base // false { - _Atomic(_Tp) __a_; + mutable _Atomic(_Tp) __a_; _LIBCPP_INLINE_VISIBILITY bool is_lock_free() const volatile _NOEXCEPT diff --git a/contrib/libc++/include/bitset b/contrib/libc++/include/bitset index 6e12e5ccc..1167f5044 100644 --- a/contrib/libc++/include/bitset +++ b/contrib/libc++/include/bitset @@ -148,9 +148,9 @@ class __bitset public: typedef ptrdiff_t difference_type; typedef size_t size_type; + typedef size_type __storage_type; protected: typedef __bitset __self; - typedef size_type __storage_type; typedef __storage_type* __storage_pointer; typedef const __storage_type* __const_storage_pointer; static const unsigned __bits_per_word = static_cast(sizeof(__storage_type) * CHAR_BIT); @@ -159,7 +159,7 @@ protected: friend class __bit_const_reference<__bitset>; friend class __bit_iterator<__bitset, false>; friend class __bit_iterator<__bitset, true>; - friend class __bit_array<__bitset>; + friend struct __bit_array<__bitset>; __storage_type __first_[_N_words]; @@ -168,12 +168,12 @@ protected: typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, true> const_iterator; - __bitset() _NOEXCEPT; - explicit __bitset(unsigned long long __v) _NOEXCEPT; + _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; + explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT {return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} - _LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT {return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT {return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} @@ -194,8 +194,10 @@ protected: bool any() const _NOEXCEPT; size_t __hash_code() const _NOEXCEPT; private: +#ifdef _LIBCPP_HAS_NO_CONSTEXPR void __init(unsigned long long __v, false_type) _NOEXCEPT; void __init(unsigned long long __v, true_type) _NOEXCEPT; +#endif // _LIBCPP_HAS_NO_CONSTEXPR unsigned long to_ulong(false_type) const; unsigned long to_ulong(true_type) const; unsigned long long to_ullong(false_type) const; @@ -206,11 +208,19 @@ private: template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset() _NOEXCEPT +#ifndef _LIBCPP_HAS_NO_CONSTEXPR + : __first_{0} +#endif { +#ifdef _LIBCPP_HAS_NO_CONSTEXPR _VSTD::fill_n(__first_, _N_words, __storage_type(0)); +#endif } +#ifdef _LIBCPP_HAS_NO_CONSTEXPR + template void __bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT @@ -232,11 +242,19 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT _VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0)); } +#endif // _LIBCPP_HAS_NO_CONSTEXPR + template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT +#ifndef _LIBCPP_HAS_NO_CONSTEXPR + : __first_{__v} +#endif { +#ifdef _LIBCPP_HAS_NO_CONSTEXPR __init(__v, integral_constant()); +#endif } template @@ -406,9 +424,9 @@ class __bitset<1, _Size> public: typedef ptrdiff_t difference_type; typedef size_t size_type; + typedef size_type __storage_type; protected: typedef __bitset __self; - typedef size_type __storage_type; typedef __storage_type* __storage_pointer; typedef const __storage_type* __const_storage_pointer; static const unsigned __bits_per_word = static_cast(sizeof(__storage_type) * CHAR_BIT); @@ -417,7 +435,7 @@ protected: friend class __bit_const_reference<__bitset>; friend class __bit_iterator<__bitset, false>; friend class __bit_iterator<__bitset, true>; - friend class __bit_array<__bitset>; + friend struct __bit_array<__bitset>; __storage_type __first_; @@ -426,12 +444,12 @@ protected: typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, true> const_iterator; - __bitset() _NOEXCEPT; - explicit __bitset(unsigned long long __v) _NOEXCEPT; + _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; + explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT {return reference(&__first_, __storage_type(1) << __pos);} - _LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT {return const_reference(&__first_, __storage_type(1) << __pos);} _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT {return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} @@ -455,6 +473,7 @@ protected: template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR __bitset<1, _Size>::__bitset() _NOEXCEPT : __first_(0) { @@ -462,6 +481,7 @@ __bitset<1, _Size>::__bitset() _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR __bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT : __first_(static_cast<__storage_type>(__v)) { @@ -549,9 +569,9 @@ class __bitset<0, 0> public: typedef ptrdiff_t difference_type; typedef size_t size_type; + typedef size_type __storage_type; protected: typedef __bitset __self; - typedef size_type __storage_type; typedef __storage_type* __storage_pointer; typedef const __storage_type* __const_storage_pointer; static const unsigned __bits_per_word = static_cast(sizeof(__storage_type) * CHAR_BIT); @@ -567,12 +587,12 @@ protected: typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, true> const_iterator; - __bitset() _NOEXCEPT; - explicit __bitset(unsigned long long) _NOEXCEPT; + _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; + explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT {return reference(0, 1);} - _LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t) const _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT {return const_reference(0, 1);} _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT {return iterator(0, 0);} @@ -595,16 +615,18 @@ protected: }; inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR __bitset<0, 0>::__bitset() _NOEXCEPT { } inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR __bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT { } -template class bitset; +template class _LIBCPP_VISIBLE bitset; template struct hash >; template @@ -619,8 +641,9 @@ public: typedef typename base::const_reference const_reference; // 23.3.5.1 constructors: - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset() _NOEXCEPT {} - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset(unsigned long long __v) _NOEXCEPT : base(__v) {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + bitset(unsigned long long __v) _NOEXCEPT : base(__v) {} template explicit bitset(const _CharT* __str, typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos, @@ -647,7 +670,8 @@ public: bitset& flip(size_t __pos); // element access: - _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_t __p) const {return base::__make_ref(__p);} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + const_reference operator[](size_t __p) const {return base::__make_ref(__p);} _LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);} unsigned long to_ulong() const; unsigned long long to_ullong() const; @@ -663,7 +687,7 @@ public: basic_string, allocator > to_string(char __zero = '0', char __one = '1') const; size_t count() const _NOEXCEPT; - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY size_t size() const _NOEXCEPT {return _Size;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;} bool operator==(const bitset& __rhs) const _NOEXCEPT; bool operator!=(const bitset& __rhs) const _NOEXCEPT; bool test(size_t __pos) const; diff --git a/contrib/libc++/include/chrono b/contrib/libc++/include/chrono index 0571f9dff..508c1f377 100644 --- a/contrib/libc++/include/chrono +++ b/contrib/libc++/include/chrono @@ -20,6 +20,7 @@ namespace chrono { template +constexpr ToDuration duration_cast(const duration& fd); @@ -29,9 +30,9 @@ template struct duration_values { public: - static Rep zero(); - static Rep max(); - static Rep min(); + static constexpr Rep zero(); + static constexpr Rep max(); + static constexpr Rep min(); }; // duration @@ -46,9 +47,9 @@ public: typedef Rep rep; typedef Period period; - duration() = default; + constexpr duration() = default; template - explicit duration(const Rep2& r, + constexpr explicit duration(const Rep2& r, typename enable_if < is_convertible::value && @@ -58,7 +59,7 @@ public: // conversions template - duration(const duration& d, + constexpr duration(const duration& d, typename enable_if < treat_as_floating_point::value || @@ -67,12 +68,12 @@ public: // observer - rep count() const; + constexpr rep count() const; // arithmetic - duration operator+() const; - duration operator-() const; + constexpr duration operator+() const; + constexpr duration operator-() const; duration& operator++(); duration operator++(int); duration& operator--(); @@ -86,9 +87,9 @@ public: // special values - static duration zero(); - static duration min(); - static duration max(); + static constexpr duration zero(); + static constexpr duration min(); + static constexpr duration max(); }; typedef duration nanoseconds; @@ -145,36 +146,48 @@ namespace chrono { // duration arithmetic template + constexpr typename common_type, duration>::type operator+(const duration& lhs, const duration& rhs); template + constexpr typename common_type, duration>::type operator-(const duration& lhs, const duration& rhs); template + constexpr duration::type, Period> operator*(const duration& d, const Rep2& s); template + constexpr duration::type, Period> operator*(const Rep1& s, const duration& d); template + constexpr duration::type, Period> operator/(const duration& d, const Rep2& s); template + constexpr typename common_type::type operator/(const duration& lhs, const duration& rhs); // duration comparisons template + constexpr bool operator==(const duration& lhs, const duration& rhs); template + constexpr bool operator!=(const duration& lhs, const duration& rhs); template + constexpr bool operator< (const duration& lhs, const duration& rhs); template + constexpr bool operator<=(const duration& lhs, const duration& rhs); template + constexpr bool operator> (const duration& lhs, const duration& rhs); template + constexpr bool operator>=(const duration& lhs, const duration& rhs); // duration_cast @@ -306,7 +319,7 @@ struct __duration_cast; template struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const { return _ToDuration(static_cast(__fd.count())); @@ -316,7 +329,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true> template struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const { typedef typename common_type::type _Ct; @@ -328,7 +341,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false> template struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const { typedef typename common_type::type _Ct; @@ -340,7 +353,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true> template struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _ToDuration operator()(const _FromDuration& __fd) const { typedef typename common_type::type _Ct; @@ -352,6 +365,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false> template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR typename enable_if < __is_duration<_ToDuration>::value, @@ -369,9 +383,9 @@ template struct _LIBCPP_VISIBLE duration_values { public: - _LIBCPP_INLINE_VISIBILITY static _Rep zero() {return _Rep(0);} - _LIBCPP_INLINE_VISIBILITY static _Rep max() {return numeric_limits<_Rep>::max();} - _LIBCPP_INLINE_VISIBILITY static _Rep min() {return numeric_limits<_Rep>::lowest();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep zero() {return _Rep(0);} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep max() {return numeric_limits<_Rep>::max();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep min() {return numeric_limits<_Rep>::lowest();} }; // duration @@ -389,9 +403,9 @@ private: rep __rep_; public: - _LIBCPP_INLINE_VISIBILITY duration() {} // = default; + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration() {} // = default; template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR explicit duration(const _Rep2& __r, typename enable_if < @@ -403,7 +417,7 @@ public: // conversions template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration(const duration<_Rep2, _Period2>& __d, typename enable_if < @@ -415,12 +429,12 @@ public: // observer - _LIBCPP_INLINE_VISIBILITY rep count() const {return __rep_;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR rep count() const {return __rep_;} // arithmetic - _LIBCPP_INLINE_VISIBILITY duration operator+() const {return *this;} - _LIBCPP_INLINE_VISIBILITY duration operator-() const {return duration(-__rep_);} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator+() const {return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator-() const {return duration(-__rep_);} _LIBCPP_INLINE_VISIBILITY duration& operator++() {++__rep_; return *this;} _LIBCPP_INLINE_VISIBILITY duration operator++(int) {return duration(__rep_++);} _LIBCPP_INLINE_VISIBILITY duration& operator--() {--__rep_; return *this;} @@ -436,9 +450,9 @@ public: // special values - _LIBCPP_INLINE_VISIBILITY static duration zero() {return duration(duration_values::zero());} - _LIBCPP_INLINE_VISIBILITY static duration min() {return duration(duration_values::min());} - _LIBCPP_INLINE_VISIBILITY static duration max() {return duration(duration_values::max());} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration zero() {return duration(duration_values::zero());} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration min() {return duration(duration_values::min());} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration max() {return duration(duration_values::max());} }; typedef duration nanoseconds; @@ -453,7 +467,7 @@ typedef duration< long, ratio<3600> > hours; template struct __duration_eq { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) { typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct; @@ -464,13 +478,14 @@ struct __duration_eq template struct __duration_eq<_LhsDuration, _LhsDuration> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) {return __lhs.count() == __rhs.count();} }; template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR bool operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { @@ -481,6 +496,7 @@ operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR bool operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { @@ -492,7 +508,7 @@ operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period template struct __duration_lt { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) { typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct; @@ -503,13 +519,14 @@ struct __duration_lt template struct __duration_lt<_LhsDuration, _LhsDuration> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) {return __lhs.count() < __rhs.count();} }; template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR bool operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { @@ -520,6 +537,7 @@ operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR bool operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { @@ -530,6 +548,7 @@ operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR bool operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { @@ -540,6 +559,7 @@ operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR bool operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { @@ -550,30 +570,31 @@ operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR typename common_type, duration<_Rep2, _Period2> >::type operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { - typename common_type, duration<_Rep2, _Period2> >::type __r = __lhs; - __r += __rhs; - return __r; + typedef typename common_type, duration<_Rep2, _Period2> >::type _Cd; + return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count()); } // Duration - template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR typename common_type, duration<_Rep2, _Period2> >::type operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { - typename common_type, duration<_Rep2, _Period2> >::type __r = __lhs; - __r -= __rhs; - return __r; + typedef typename common_type, duration<_Rep2, _Period2> >::type _Cd; + return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count()); } // Duration * template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR typename enable_if < is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, @@ -582,13 +603,13 @@ typename enable_if operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { typedef typename common_type<_Rep1, _Rep2>::type _Cr; - duration<_Cr, _Period> __r = __d; - __r *= static_cast<_Cr>(__s); - return __r; + typedef duration<_Cr, _Period> _Cd; + return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s)); } template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR typename enable_if < is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value, @@ -627,17 +648,18 @@ struct __duration_divide_result, _Rep2, false> template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR typename __duration_divide_result, _Rep2>::type operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { typedef typename common_type<_Rep1, _Rep2>::type _Cr; - duration<_Cr, _Period> __r = __d; - __r /= static_cast<_Cr>(__s); - return __r; + typedef duration<_Cr, _Period> _Cd; + return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s)); } template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR typename common_type<_Rep1, _Rep2>::type operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { @@ -649,23 +671,24 @@ operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2 template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR typename __duration_divide_result, _Rep2>::type operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { typedef typename common_type<_Rep1, _Rep2>::type _Cr; - duration<_Cr, _Period> __r = __d; - __r %= static_cast<_Cr>(__s); - return __r; + typedef duration<_Cr, _Period> _Cd; + return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s)); } template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR typename common_type, duration<_Rep2, _Period2> >::type operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { - typename common_type, duration<_Rep2, _Period2> >::type __r = __lhs; - __r %= __rhs; - return __r; + typedef typename common_type<_Rep1, _Rep2>::type _Cr; + typedef typename common_type, duration<_Rep2, _Period2> >::type _Cd; + return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count())); } ////////////////////////////////////////////////////////// @@ -705,13 +728,13 @@ public: // arithmetic - _LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d;} - _LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d;} + _LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d; return *this;} + _LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;} // special values - _LIBCPP_INLINE_VISIBILITY static time_point min() {return time_point(duration::min());} - _LIBCPP_INLINE_VISIBILITY static time_point max() {return time_point(duration::max());} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point min() {return time_point(duration::min());} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point max() {return time_point(duration::max());} }; } // chrono diff --git a/contrib/libc++/include/cmath b/contrib/libc++/include/cmath index 76d7a821a..a70bbf2d8 100644 --- a/contrib/libc++/include/cmath +++ b/contrib/libc++/include/cmath @@ -316,7 +316,7 @@ long double truncl(long double x); template _LIBCPP_ALWAYS_INLINE bool -__libcpp_signbit(_A1 __x) +__libcpp_signbit(_A1 __x) _NOEXCEPT { return signbit(__x); } @@ -326,7 +326,7 @@ __libcpp_signbit(_A1 __x) template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, bool>::type -signbit(_A1 __x) +signbit(_A1 __x) _NOEXCEPT { return __libcpp_signbit(__x); } @@ -340,7 +340,7 @@ signbit(_A1 __x) template _LIBCPP_ALWAYS_INLINE int -__libcpp_fpclassify(_A1 __x) +__libcpp_fpclassify(_A1 __x) _NOEXCEPT { return fpclassify(__x); } @@ -350,7 +350,7 @@ __libcpp_fpclassify(_A1 __x) template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, int>::type -fpclassify(_A1 __x) +fpclassify(_A1 __x) _NOEXCEPT { return __libcpp_fpclassify(__x); } @@ -364,7 +364,7 @@ fpclassify(_A1 __x) template _LIBCPP_ALWAYS_INLINE bool -__libcpp_isfinite(_A1 __x) +__libcpp_isfinite(_A1 __x) _NOEXCEPT { return isfinite(__x); } @@ -374,7 +374,7 @@ __libcpp_isfinite(_A1 __x) template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, bool>::type -isfinite(_A1 __x) +isfinite(_A1 __x) _NOEXCEPT { return __libcpp_isfinite(__x); } @@ -388,7 +388,7 @@ isfinite(_A1 __x) template _LIBCPP_ALWAYS_INLINE bool -__libcpp_isinf(_A1 __x) +__libcpp_isinf(_A1 __x) _NOEXCEPT { return isinf(__x); } @@ -398,7 +398,7 @@ __libcpp_isinf(_A1 __x) template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, bool>::type -isinf(_A1 __x) +isinf(_A1 __x) _NOEXCEPT { return __libcpp_isinf(__x); } @@ -412,7 +412,7 @@ isinf(_A1 __x) template _LIBCPP_ALWAYS_INLINE bool -__libcpp_isnan(_A1 __x) +__libcpp_isnan(_A1 __x) _NOEXCEPT { return isnan(__x); } @@ -422,7 +422,7 @@ __libcpp_isnan(_A1 __x) template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, bool>::type -isnan(_A1 __x) +isnan(_A1 __x) _NOEXCEPT { return __libcpp_isnan(__x); } @@ -436,7 +436,7 @@ isnan(_A1 __x) template _LIBCPP_ALWAYS_INLINE bool -__libcpp_isnormal(_A1 __x) +__libcpp_isnormal(_A1 __x) _NOEXCEPT { return isnormal(__x); } @@ -446,7 +446,7 @@ __libcpp_isnormal(_A1 __x) template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, bool>::type -isnormal(_A1 __x) +isnormal(_A1 __x) _NOEXCEPT { return __libcpp_isnormal(__x); } @@ -460,7 +460,7 @@ isnormal(_A1 __x) template _LIBCPP_ALWAYS_INLINE bool -__libcpp_isgreater(_A1 __x, _A2 __y) +__libcpp_isgreater(_A1 __x, _A2 __y) _NOEXCEPT { return isgreater(__x, __y); } @@ -475,7 +475,7 @@ typename std::enable_if std::is_floating_point<_A2>::value, bool >::type -isgreater(_A1 __x, _A2 __y) +isgreater(_A1 __x, _A2 __y) _NOEXCEPT { return __libcpp_isgreater(__x, __y); } @@ -489,7 +489,7 @@ isgreater(_A1 __x, _A2 __y) template _LIBCPP_ALWAYS_INLINE bool -__libcpp_isgreaterequal(_A1 __x, _A2 __y) +__libcpp_isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT { return isgreaterequal(__x, __y); } @@ -504,7 +504,7 @@ typename std::enable_if std::is_floating_point<_A2>::value, bool >::type -isgreaterequal(_A1 __x, _A2 __y) +isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT { return __libcpp_isgreaterequal(__x, __y); } @@ -518,7 +518,7 @@ isgreaterequal(_A1 __x, _A2 __y) template _LIBCPP_ALWAYS_INLINE bool -__libcpp_isless(_A1 __x, _A2 __y) +__libcpp_isless(_A1 __x, _A2 __y) _NOEXCEPT { return isless(__x, __y); } @@ -533,7 +533,7 @@ typename std::enable_if std::is_floating_point<_A2>::value, bool >::type -isless(_A1 __x, _A2 __y) +isless(_A1 __x, _A2 __y) _NOEXCEPT { return __libcpp_isless(__x, __y); } @@ -547,7 +547,7 @@ isless(_A1 __x, _A2 __y) template _LIBCPP_ALWAYS_INLINE bool -__libcpp_islessequal(_A1 __x, _A2 __y) +__libcpp_islessequal(_A1 __x, _A2 __y) _NOEXCEPT { return islessequal(__x, __y); } @@ -562,7 +562,7 @@ typename std::enable_if std::is_floating_point<_A2>::value, bool >::type -islessequal(_A1 __x, _A2 __y) +islessequal(_A1 __x, _A2 __y) _NOEXCEPT { return __libcpp_islessequal(__x, __y); } @@ -576,7 +576,7 @@ islessequal(_A1 __x, _A2 __y) template _LIBCPP_ALWAYS_INLINE bool -__libcpp_islessgreater(_A1 __x, _A2 __y) +__libcpp_islessgreater(_A1 __x, _A2 __y) _NOEXCEPT { return islessgreater(__x, __y); } @@ -591,7 +591,7 @@ typename std::enable_if std::is_floating_point<_A2>::value, bool >::type -islessgreater(_A1 __x, _A2 __y) +islessgreater(_A1 __x, _A2 __y) _NOEXCEPT { return __libcpp_islessgreater(__x, __y); } @@ -605,7 +605,7 @@ islessgreater(_A1 __x, _A2 __y) template _LIBCPP_ALWAYS_INLINE bool -__libcpp_isunordered(_A1 __x, _A2 __y) +__libcpp_isunordered(_A1 __x, _A2 __y) _NOEXCEPT { return isunordered(__x, __y); } @@ -620,7 +620,7 @@ typename std::enable_if std::is_floating_point<_A2>::value, bool >::type -isunordered(_A1 __x, _A2 __y) +isunordered(_A1 __x, _A2 __y) _NOEXCEPT { return __libcpp_isunordered(__x, __y); } @@ -650,15 +650,15 @@ using ::double_t; inline _LIBCPP_INLINE_VISIBILITY float -abs(float __x) {return fabsf(__x);} +abs(float __x) _NOEXCEPT {return fabsf(__x);} inline _LIBCPP_INLINE_VISIBILITY double -abs(double __x) {return fabs(__x);} +abs(double __x) _NOEXCEPT {return fabs(__x);} inline _LIBCPP_INLINE_VISIBILITY long double -abs(long double __x) {return fabsl(__x);} +abs(long double __x) _NOEXCEPT {return fabsl(__x);} #ifndef __sun__ @@ -668,14 +668,14 @@ using ::acos; using ::acosf; #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float acos(float __x) {return acosf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __x) {return acosl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float acos(float __x) _NOEXCEPT {return acosf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __x) _NOEXCEPT {return acosl(__x);} #endif template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -acos(_A1 __x) {return acos((double)__x);} +acos(_A1 __x) _NOEXCEPT {return acos((double)__x);} // asin @@ -683,14 +683,14 @@ using ::asin; using ::asinf; #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float asin(float __x) {return asinf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __x) {return asinl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float asin(float __x) _NOEXCEPT {return asinf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __x) _NOEXCEPT {return asinl(__x);} #endif template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -asin(_A1 __x) {return asin((double)__x);} +asin(_A1 __x) _NOEXCEPT {return asin((double)__x);} // atan @@ -698,14 +698,14 @@ using ::atan; using ::atanf; #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float atan(float __x) {return atanf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __x) {return atanl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float atan(float __x) _NOEXCEPT {return atanf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __x) _NOEXCEPT {return atanl(__x);} #endif template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -atan(_A1 __x) {return atan((double)__x);} +atan(_A1 __x) _NOEXCEPT {return atan((double)__x);} // atan2 @@ -713,8 +713,8 @@ using ::atan2; using ::atan2f; #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float atan2(float __y, float __x) {return atan2f(__y, __x);} -inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __y, long double __x) {return atan2l(__y, __x);} +inline _LIBCPP_INLINE_VISIBILITY float atan2(float __y, float __x) _NOEXCEPT {return atan2f(__y, __x);} +inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __y, long double __x) _NOEXCEPT {return atan2l(__y, __x);} #endif template @@ -725,7 +725,7 @@ typename enable_if is_arithmetic<_A2>::value, typename __promote<_A1, _A2>::type >::type -atan2(_A1 __y, _A2 __x) +atan2(_A1 __y, _A2 __x) _NOEXCEPT { typedef typename __promote<_A1, _A2>::type __result_type; static_assert((!(is_same<_A1, __result_type>::value && @@ -739,14 +739,14 @@ using ::ceil; using ::ceilf; #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float ceil(float __x) {return ceilf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __x) {return ceill(__x);} +inline _LIBCPP_INLINE_VISIBILITY float ceil(float __x) _NOEXCEPT {return ceilf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __x) _NOEXCEPT {return ceill(__x);} #endif template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -ceil(_A1 __x) {return ceil((double)__x);} +ceil(_A1 __x) _NOEXCEPT {return ceil((double)__x);} // cos @@ -754,14 +754,14 @@ using ::cos; using ::cosf; #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float cos(float __x) {return cosf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __x) {return cosl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float cos(float __x) _NOEXCEPT {return cosf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __x) _NOEXCEPT {return cosl(__x);} #endif template inline _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -cos(_A1 __x) {return cos((double)__x);} +cos(_A1 __x) _NOEXCEPT {return cos((double)__x);} // cosh @@ -769,14 +769,14 @@ using ::cosh; using ::coshf; #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float cosh(float __x) {return coshf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __x) {return coshl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float cosh(float __x) _NOEXCEPT {return coshf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __x) _NOEXCEPT {return coshl(__x);} #endif template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -cosh(_A1 __x) {return cosh((double)__x);} +cosh(_A1 __x) _NOEXCEPT {return cosh((double)__x);} #endif // __sun__ // exp @@ -787,15 +787,15 @@ using ::expf; #ifndef __sun__ #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float exp(float __x) {return expf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) {return expl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float exp(float __x) _NOEXCEPT {return expf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) _NOEXCEPT {return expl(__x);} #endif template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -exp(_A1 __x) {return exp((double)__x);} +exp(_A1 __x) _NOEXCEPT {return exp((double)__x);} // fabs @@ -803,14 +803,14 @@ using ::fabs; using ::fabsf; #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float fabs(float __x) {return fabsf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __x) {return fabsl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float fabs(float __x) _NOEXCEPT {return fabsf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __x) _NOEXCEPT {return fabsl(__x);} #endif template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -fabs(_A1 __x) {return fabs((double)__x);} +fabs(_A1 __x) _NOEXCEPT {return fabs((double)__x);} // floor @@ -818,14 +818,14 @@ using ::floor; using ::floorf; #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float floor(float __x) {return floorf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __x) {return floorl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float floor(float __x) _NOEXCEPT {return floorf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __x) _NOEXCEPT {return floorl(__x);} #endif template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -floor(_A1 __x) {return floor((double)__x);} +floor(_A1 __x) _NOEXCEPT {return floor((double)__x);} // fmod @@ -835,8 +835,8 @@ using ::fmodf; #ifndef __sun__ #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float fmod(float __x, float __y) {return fmodf(__x, __y);} -inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __x, long double __y) {return fmodl(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY float fmod(float __x, float __y) _NOEXCEPT {return fmodf(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __x, long double __y) _NOEXCEPT {return fmodl(__x, __y);} #endif template @@ -847,7 +847,7 @@ typename enable_if is_arithmetic<_A2>::value, typename __promote<_A1, _A2>::type >::type -fmod(_A1 __x, _A2 __y) +fmod(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename __promote<_A1, _A2>::type __result_type; static_assert((!(is_same<_A1, __result_type>::value && @@ -862,14 +862,14 @@ using ::frexp; using ::frexpf; #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float frexp(float __x, int* __e) {return frexpf(__x, __e);} -inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __x, int* __e) {return frexpl(__x, __e);} +inline _LIBCPP_INLINE_VISIBILITY float frexp(float __x, int* __e) _NOEXCEPT {return frexpf(__x, __e);} +inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __x, int* __e) _NOEXCEPT {return frexpl(__x, __e);} #endif template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -frexp(_A1 __x, int* __e) {return frexp((double)__x, __e);} +frexp(_A1 __x, int* __e) _NOEXCEPT {return frexp((double)__x, __e);} // ldexp @@ -877,14 +877,14 @@ using ::ldexp; using ::ldexpf; #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __x, int __e) {return ldexpf(__x, __e);} -inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __x, int __e) {return ldexpl(__x, __e);} +inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __x, int __e) _NOEXCEPT {return ldexpf(__x, __e);} +inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __x, int __e) _NOEXCEPT {return ldexpl(__x, __e);} #endif template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -ldexp(_A1 __x, int __e) {return ldexp((double)__x, __e);} +ldexp(_A1 __x, int __e) _NOEXCEPT {return ldexp((double)__x, __e);} // log @@ -894,14 +894,14 @@ using ::logf; #ifndef __sun__ #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float log(float __x) {return logf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double log(long double __x) {return logl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float log(float __x) _NOEXCEPT {return logf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double log(long double __x) _NOEXCEPT {return logl(__x);} #endif template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -log(_A1 __x) {return log((double)__x);} +log(_A1 __x) _NOEXCEPT {return log((double)__x);} // log10 @@ -910,14 +910,14 @@ using ::log10; using ::log10f; #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float log10(float __x) {return log10f(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __x) {return log10l(__x);} +inline _LIBCPP_INLINE_VISIBILITY float log10(float __x) _NOEXCEPT {return log10f(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __x) _NOEXCEPT {return log10l(__x);} #endif template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -log10(_A1 __x) {return log10((double)__x);} +log10(_A1 __x) _NOEXCEPT {return log10((double)__x);} // modf @@ -925,8 +925,8 @@ using ::modf; using ::modff; #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float modf(float __x, float* __y) {return modff(__x, __y);} -inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __x, long double* __y) {return modfl(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY float modf(float __x, float* __y) _NOEXCEPT {return modff(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __x, long double* __y) _NOEXCEPT {return modfl(__x, __y);} #endif // pow @@ -938,8 +938,8 @@ using ::powf; #ifndef __sun__ #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float pow(float __x, float __y) {return powf(__x, __y);} -inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __y) {return powl(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY float pow(float __x, float __y) _NOEXCEPT {return powf(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __y) _NOEXCEPT {return powl(__x, __y);} #endif template @@ -950,7 +950,7 @@ typename enable_if is_arithmetic<_A2>::value, typename __promote<_A1, _A2>::type >::type -pow(_A1 __x, _A2 __y) +pow(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename __promote<_A1, _A2>::type __result_type; static_assert((!(is_same<_A1, __result_type>::value && @@ -965,14 +965,14 @@ using ::sin; using ::sinf; #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float sin(float __x) {return sinf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __x) {return sinl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float sin(float __x) _NOEXCEPT {return sinf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __x) _NOEXCEPT {return sinl(__x);} #endif template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -sin(_A1 __x) {return sin((double)__x);} +sin(_A1 __x) _NOEXCEPT {return sin((double)__x);} // sinh @@ -980,14 +980,14 @@ using ::sinh; using ::sinhf; #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float sinh(float __x) {return sinhf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __x) {return sinhl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float sinh(float __x) _NOEXCEPT {return sinhf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __x) _NOEXCEPT {return sinhl(__x);} #endif template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -sinh(_A1 __x) {return sinh((double)__x);} +sinh(_A1 __x) _NOEXCEPT {return sinh((double)__x);} // sqrt @@ -997,14 +997,14 @@ using ::sqrtf; #if !(defined(_MSC_VER) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __x) {return sqrtf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) {return sqrtl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __x) _NOEXCEPT {return sqrtf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) _NOEXCEPT {return sqrtl(__x);} #endif template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -sqrt(_A1 __x) {return sqrt((double)__x);} +sqrt(_A1 __x) _NOEXCEPT {return sqrt((double)__x);} // tan @@ -1013,14 +1013,14 @@ using ::tanf; #ifndef __sun__ #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float tan(float __x) {return tanf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __x) {return tanl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float tan(float __x) _NOEXCEPT {return tanf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __x) _NOEXCEPT {return tanl(__x);} #endif template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -tan(_A1 __x) {return tan((double)__x);} +tan(_A1 __x) _NOEXCEPT {return tan((double)__x);} // tanh @@ -1028,14 +1028,14 @@ using ::tanh; using ::tanhf; #ifndef _MSC_VER -inline _LIBCPP_INLINE_VISIBILITY float tanh(float __x) {return tanhf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __x) {return tanhl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float tanh(float __x) _NOEXCEPT {return tanhf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __x) _NOEXCEPT {return tanhl(__x);} #endif template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -tanh(_A1 __x) {return tanh((double)__x);} +tanh(_A1 __x) _NOEXCEPT {return tanh((double)__x);} // acosh @@ -1043,13 +1043,13 @@ tanh(_A1 __x) {return tanh((double)__x);} using ::acosh; using ::acoshf; -inline _LIBCPP_INLINE_VISIBILITY float acosh(float __x) {return acoshf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __x) {return acoshl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float acosh(float __x) _NOEXCEPT {return acoshf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __x) _NOEXCEPT {return acoshl(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -acosh(_A1 __x) {return acosh((double)__x);} +acosh(_A1 __x) _NOEXCEPT {return acosh((double)__x);} #endif // asinh @@ -1058,13 +1058,13 @@ acosh(_A1 __x) {return acosh((double)__x);} using ::asinh; using ::asinhf; -inline _LIBCPP_INLINE_VISIBILITY float asinh(float __x) {return asinhf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __x) {return asinhl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float asinh(float __x) _NOEXCEPT {return asinhf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __x) _NOEXCEPT {return asinhl(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -asinh(_A1 __x) {return asinh((double)__x);} +asinh(_A1 __x) _NOEXCEPT {return asinh((double)__x);} #endif // atanh @@ -1073,13 +1073,13 @@ asinh(_A1 __x) {return asinh((double)__x);} using ::atanh; using ::atanhf; -inline _LIBCPP_INLINE_VISIBILITY float atanh(float __x) {return atanhf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __x) {return atanhl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float atanh(float __x) _NOEXCEPT {return atanhf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __x) _NOEXCEPT {return atanhl(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -atanh(_A1 __x) {return atanh((double)__x);} +atanh(_A1 __x) _NOEXCEPT {return atanh((double)__x);} #endif // cbrt @@ -1088,13 +1088,13 @@ atanh(_A1 __x) {return atanh((double)__x);} using ::cbrt; using ::cbrtf; -inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __x) {return cbrtf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __x) {return cbrtl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __x) _NOEXCEPT {return cbrtf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __x) _NOEXCEPT {return cbrtl(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -cbrt(_A1 __x) {return cbrt((double)__x);} +cbrt(_A1 __x) _NOEXCEPT {return cbrt((double)__x);} #endif // copysign @@ -1102,8 +1102,8 @@ cbrt(_A1 __x) {return cbrt((double)__x);} using ::copysign; using ::copysignf; -inline _LIBCPP_INLINE_VISIBILITY float copysign(float __x, float __y) {return copysignf(__x, __y);} -inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __x, long double __y) {return copysignl(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY float copysign(float __x, float __y) _NOEXCEPT {return copysignf(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __x, long double __y) _NOEXCEPT {return copysignl(__x, __y);} template inline _LIBCPP_INLINE_VISIBILITY @@ -1113,7 +1113,7 @@ typename enable_if is_arithmetic<_A2>::value, typename __promote<_A1, _A2>::type >::type -copysign(_A1 __x, _A2 __y) +copysign(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename __promote<_A1, _A2>::type __result_type; static_assert((!(is_same<_A1, __result_type>::value && @@ -1128,60 +1128,60 @@ copysign(_A1 __x, _A2 __y) using ::erf; using ::erff; -inline _LIBCPP_INLINE_VISIBILITY float erf(float __x) {return erff(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __x) {return erfl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float erf(float __x) _NOEXCEPT {return erff(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __x) _NOEXCEPT {return erfl(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -erf(_A1 __x) {return erf((double)__x);} +erf(_A1 __x) _NOEXCEPT {return erf((double)__x);} // erfc using ::erfc; using ::erfcf; -inline _LIBCPP_INLINE_VISIBILITY float erfc(float __x) {return erfcf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __x) {return erfcl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float erfc(float __x) _NOEXCEPT {return erfcf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __x) _NOEXCEPT {return erfcl(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -erfc(_A1 __x) {return erfc((double)__x);} +erfc(_A1 __x) _NOEXCEPT {return erfc((double)__x);} // exp2 using ::exp2; using ::exp2f; -inline _LIBCPP_INLINE_VISIBILITY float exp2(float __x) {return exp2f(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __x) {return exp2l(__x);} +inline _LIBCPP_INLINE_VISIBILITY float exp2(float __x) _NOEXCEPT {return exp2f(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __x) _NOEXCEPT {return exp2l(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -exp2(_A1 __x) {return exp2((double)__x);} +exp2(_A1 __x) _NOEXCEPT {return exp2((double)__x);} // expm1 using ::expm1; using ::expm1f; -inline _LIBCPP_INLINE_VISIBILITY float expm1(float __x) {return expm1f(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __x) {return expm1l(__x);} +inline _LIBCPP_INLINE_VISIBILITY float expm1(float __x) _NOEXCEPT {return expm1f(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __x) _NOEXCEPT {return expm1l(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -expm1(_A1 __x) {return expm1((double)__x);} +expm1(_A1 __x) _NOEXCEPT {return expm1((double)__x);} // fdim using ::fdim; using ::fdimf; -inline _LIBCPP_INLINE_VISIBILITY float fdim(float __x, float __y) {return fdimf(__x, __y);} -inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __x, long double __y) {return fdiml(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY float fdim(float __x, float __y) _NOEXCEPT {return fdimf(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __x, long double __y) _NOEXCEPT {return fdiml(__x, __y);} template inline _LIBCPP_INLINE_VISIBILITY @@ -1191,7 +1191,7 @@ typename enable_if is_arithmetic<_A2>::value, typename __promote<_A1, _A2>::type >::type -fdim(_A1 __x, _A2 __y) +fdim(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename __promote<_A1, _A2>::type __result_type; static_assert((!(is_same<_A1, __result_type>::value && @@ -1201,13 +1201,13 @@ fdim(_A1 __x, _A2 __y) // fma -inline _LIBCPP_INLINE_VISIBILITY float fmaf(float __x, float __y, float __z) {return (float)((double)__x*__y + __z);} +inline _LIBCPP_INLINE_VISIBILITY float fmaf(float __x, float __y, float __z) _NOEXCEPT {return (float)((double)__x*__y + __z);} #define FP_FAST_FMAF using ::fma; -inline _LIBCPP_INLINE_VISIBILITY float fma(float __x, float __y, float __z) {return fmaf(__x, __y, __z);} -inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __x, long double __y, long double __z) {return fmal(__x, __y, __z);} +inline _LIBCPP_INLINE_VISIBILITY float fma(float __x, float __y, float __z) _NOEXCEPT {return fmaf(__x, __y, __z);} +inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __x, long double __y, long double __z) _NOEXCEPT {return fmal(__x, __y, __z);} template inline _LIBCPP_INLINE_VISIBILITY @@ -1218,7 +1218,7 @@ typename enable_if is_arithmetic<_A3>::value, typename __promote<_A1, _A2, _A3>::type >::type -fma(_A1 __x, _A2 __y, _A3 __z) +fma(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT { typedef typename __promote<_A1, _A2, _A3>::type __result_type; static_assert((!(is_same<_A1, __result_type>::value && @@ -1232,8 +1232,8 @@ fma(_A1 __x, _A2 __y, _A3 __z) using ::fmax; using ::fmaxf; -inline _LIBCPP_INLINE_VISIBILITY float fmax(float __x, float __y) {return fmaxf(__x, __y);} -inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __x, long double __y) {return fmaxl(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY float fmax(float __x, float __y) _NOEXCEPT {return fmaxf(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __x, long double __y) _NOEXCEPT {return fmaxl(__x, __y);} template inline _LIBCPP_INLINE_VISIBILITY @@ -1243,7 +1243,7 @@ typename enable_if is_arithmetic<_A2>::value, typename __promote<_A1, _A2>::type >::type -fmax(_A1 __x, _A2 __y) +fmax(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename __promote<_A1, _A2>::type __result_type; static_assert((!(is_same<_A1, __result_type>::value && @@ -1256,8 +1256,8 @@ fmax(_A1 __x, _A2 __y) using ::fmin; using ::fminf; -inline _LIBCPP_INLINE_VISIBILITY float fmin(float __x, float __y) {return fminf(__x, __y);} -inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __x, long double __y) {return fminl(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY float fmin(float __x, float __y) _NOEXCEPT {return fminf(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __x, long double __y) _NOEXCEPT {return fminl(__x, __y);} template inline _LIBCPP_INLINE_VISIBILITY @@ -1267,7 +1267,7 @@ typename enable_if is_arithmetic<_A2>::value, typename __promote<_A1, _A2>::type >::type -fmin(_A1 __x, _A2 __y) +fmin(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename __promote<_A1, _A2>::type __result_type; static_assert((!(is_same<_A1, __result_type>::value && @@ -1280,8 +1280,8 @@ fmin(_A1 __x, _A2 __y) using ::hypot; using ::hypotf; -inline _LIBCPP_INLINE_VISIBILITY float hypot(float __x, float __y) {return hypotf(__x, __y);} -inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __x, long double __y) {return hypotl(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY float hypot(float __x, float __y) _NOEXCEPT {return hypotf(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __x, long double __y) _NOEXCEPT {return hypotl(__x, __y);} template inline _LIBCPP_INLINE_VISIBILITY @@ -1291,7 +1291,7 @@ typename enable_if is_arithmetic<_A2>::value, typename __promote<_A1, _A2>::type >::type -hypot(_A1 __x, _A2 __y) +hypot(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename __promote<_A1, _A2>::type __result_type; static_assert((!(is_same<_A1, __result_type>::value && @@ -1304,27 +1304,27 @@ hypot(_A1 __x, _A2 __y) using ::ilogb; using ::ilogbf; -inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __x) {return ilogbf(__x);} -inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __x) {return ilogbl(__x);} +inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __x) _NOEXCEPT {return ilogbf(__x);} +inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __x) _NOEXCEPT {return ilogbl(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, int>::type -ilogb(_A1 __x) {return ilogb((double)__x);} +ilogb(_A1 __x) _NOEXCEPT {return ilogb((double)__x);} // lgamma using ::lgamma; using ::lgammaf; -inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __x) {return lgammaf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __x) {return lgammal(__x);} +inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __x) _NOEXCEPT {return lgammaf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __x) _NOEXCEPT {return lgammal(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -lgamma(_A1 __x) {return lgamma((double)__x);} +lgamma(_A1 __x) _NOEXCEPT {return lgamma((double)__x);} // llrint @@ -1332,91 +1332,91 @@ lgamma(_A1 __x) {return lgamma((double)__x);} using ::llrint; using ::llrintf; -inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __x) {return llrintf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __x) {return llrintl(__x);} +inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __x) _NOEXCEPT {return llrintf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __x) _NOEXCEPT {return llrintl(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, long long>::type -llrint(_A1 __x) {return llrint((double)__x);} +llrint(_A1 __x) _NOEXCEPT {return llrint((double)__x);} // llround using ::llround; using ::llroundf; -inline _LIBCPP_INLINE_VISIBILITY long long llround(float __x) {return llroundf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __x) {return llroundl(__x);} +inline _LIBCPP_INLINE_VISIBILITY long long llround(float __x) _NOEXCEPT {return llroundf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __x) _NOEXCEPT {return llroundl(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, long long>::type -llround(_A1 __x) {return llround((double)__x);} +llround(_A1 __x) _NOEXCEPT {return llround((double)__x);} // log1p using ::log1p; using ::log1pf; -inline _LIBCPP_INLINE_VISIBILITY float log1p(float __x) {return log1pf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __x) {return log1pl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float log1p(float __x) _NOEXCEPT {return log1pf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __x) _NOEXCEPT {return log1pl(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -log1p(_A1 __x) {return log1p((double)__x);} +log1p(_A1 __x) _NOEXCEPT {return log1p((double)__x);} // log2 using ::log2; using ::log2f; -inline _LIBCPP_INLINE_VISIBILITY float log2(float __x) {return log2f(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __x) {return log2l(__x);} +inline _LIBCPP_INLINE_VISIBILITY float log2(float __x) _NOEXCEPT {return log2f(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __x) _NOEXCEPT {return log2l(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -log2(_A1 __x) {return log2((double)__x);} +log2(_A1 __x) _NOEXCEPT {return log2((double)__x);} // logb using ::logb; using ::logbf; -inline _LIBCPP_INLINE_VISIBILITY float logb(float __x) {return logbf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __x) {return logbl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float logb(float __x) _NOEXCEPT {return logbf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __x) _NOEXCEPT {return logbl(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -logb(_A1 __x) {return logb((double)__x);} +logb(_A1 __x) _NOEXCEPT {return logb((double)__x);} // lrint using ::lrint; using ::lrintf; -inline _LIBCPP_INLINE_VISIBILITY long lrint(float __x) {return lrintf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __x) {return lrintl(__x);} +inline _LIBCPP_INLINE_VISIBILITY long lrint(float __x) _NOEXCEPT {return lrintf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __x) _NOEXCEPT {return lrintl(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, long>::type -lrint(_A1 __x) {return lrint((double)__x);} +lrint(_A1 __x) _NOEXCEPT {return lrint((double)__x);} // lround using ::lround; using ::lroundf; -inline _LIBCPP_INLINE_VISIBILITY long lround(float __x) {return lroundf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long lround(long double __x) {return lroundl(__x);} +inline _LIBCPP_INLINE_VISIBILITY long lround(float __x) _NOEXCEPT {return lroundf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long lround(long double __x) _NOEXCEPT {return lroundl(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, long>::type -lround(_A1 __x) {return lround((double)__x);} +lround(_A1 __x) _NOEXCEPT {return lround((double)__x);} // nan #endif // _MSC_VER @@ -1431,21 +1431,21 @@ using ::nanf; using ::nearbyint; using ::nearbyintf; -inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __x) {return nearbyintf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __x) {return nearbyintl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __x) _NOEXCEPT {return nearbyintf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __x) _NOEXCEPT {return nearbyintl(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -nearbyint(_A1 __x) {return nearbyint((double)__x);} +nearbyint(_A1 __x) _NOEXCEPT {return nearbyint((double)__x);} // nextafter using ::nextafter; using ::nextafterf; -inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __x, float __y) {return nextafterf(__x, __y);} -inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __x, long double __y) {return nextafterl(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __x, float __y) _NOEXCEPT {return nextafterf(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __x, long double __y) _NOEXCEPT {return nextafterl(__x, __y);} template inline _LIBCPP_INLINE_VISIBILITY @@ -1455,7 +1455,7 @@ typename enable_if is_arithmetic<_A2>::value, typename __promote<_A1, _A2>::type >::type -nextafter(_A1 __x, _A2 __y) +nextafter(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename __promote<_A1, _A2>::type __result_type; static_assert((!(is_same<_A1, __result_type>::value && @@ -1468,21 +1468,21 @@ nextafter(_A1 __x, _A2 __y) using ::nexttoward; using ::nexttowardf; -inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __x, long double __y) {return nexttowardf(__x, __y);} -inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __x, long double __y) {return nexttowardl(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __x, long double __y) _NOEXCEPT {return nexttowardf(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __x, long double __y) _NOEXCEPT {return nexttowardl(__x, __y);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -nexttoward(_A1 __x, long double __y) {return nexttoward((double)__x, __y);} +nexttoward(_A1 __x, long double __y) _NOEXCEPT {return nexttoward((double)__x, __y);} // remainder using ::remainder; using ::remainderf; -inline _LIBCPP_INLINE_VISIBILITY float remainder(float __x, float __y) {return remainderf(__x, __y);} -inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __x, long double __y) {return remainderl(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY float remainder(float __x, float __y) _NOEXCEPT {return remainderf(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __x, long double __y) _NOEXCEPT {return remainderl(__x, __y);} template inline _LIBCPP_INLINE_VISIBILITY @@ -1492,7 +1492,7 @@ typename enable_if is_arithmetic<_A2>::value, typename __promote<_A1, _A2>::type >::type -remainder(_A1 __x, _A2 __y) +remainder(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename __promote<_A1, _A2>::type __result_type; static_assert((!(is_same<_A1, __result_type>::value && @@ -1505,8 +1505,8 @@ remainder(_A1 __x, _A2 __y) using ::remquo; using ::remquof; -inline _LIBCPP_INLINE_VISIBILITY float remquo(float __x, float __y, int* __z) {return remquof(__x, __y, __z);} -inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __x, long double __y, int* __z) {return remquol(__x, __y, __z);} +inline _LIBCPP_INLINE_VISIBILITY float remquo(float __x, float __y, int* __z) _NOEXCEPT {return remquof(__x, __y, __z);} +inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __x, long double __y, int* __z) _NOEXCEPT {return remquol(__x, __y, __z);} template inline _LIBCPP_INLINE_VISIBILITY @@ -1516,7 +1516,7 @@ typename enable_if is_arithmetic<_A2>::value, typename __promote<_A1, _A2>::type >::type -remquo(_A1 __x, _A2 __y, int* __z) +remquo(_A1 __x, _A2 __y, int* __z) _NOEXCEPT { typedef typename __promote<_A1, _A2>::type __result_type; static_assert((!(is_same<_A1, __result_type>::value && @@ -1529,78 +1529,78 @@ remquo(_A1 __x, _A2 __y, int* __z) using ::rint; using ::rintf; -inline _LIBCPP_INLINE_VISIBILITY float rint(float __x) {return rintf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __x) {return rintl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float rint(float __x) _NOEXCEPT {return rintf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __x) _NOEXCEPT {return rintl(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -rint(_A1 __x) {return rint((double)__x);} +rint(_A1 __x) _NOEXCEPT {return rint((double)__x);} // round using ::round; using ::roundf; -inline _LIBCPP_INLINE_VISIBILITY float round(float __x) {return roundf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double round(long double __x) {return roundl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float round(float __x) _NOEXCEPT {return roundf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double round(long double __x) _NOEXCEPT {return roundl(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -round(_A1 __x) {return round((double)__x);} +round(_A1 __x) _NOEXCEPT {return round((double)__x);} // scalbln using ::scalbln; using ::scalblnf; -inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __x, long __y) {return scalblnf(__x, __y);} -inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __x, long __y) {return scalblnl(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __x, long __y) _NOEXCEPT {return scalblnf(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __x, long __y) _NOEXCEPT {return scalblnl(__x, __y);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -scalbln(_A1 __x, long __y) {return scalbln((double)__x, __y);} +scalbln(_A1 __x, long __y) _NOEXCEPT {return scalbln((double)__x, __y);} // scalbn using ::scalbn; using ::scalbnf; -inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __x, int __y) {return scalbnf(__x, __y);} -inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __x, int __y) {return scalbnl(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __x, int __y) _NOEXCEPT {return scalbnf(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __x, int __y) _NOEXCEPT {return scalbnl(__x, __y);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -scalbn(_A1 __x, int __y) {return scalbn((double)__x, __y);} +scalbn(_A1 __x, int __y) _NOEXCEPT {return scalbn((double)__x, __y);} // tgamma using ::tgamma; using ::tgammaf; -inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __x) {return tgammaf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __x) {return tgammal(__x);} +inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __x) _NOEXCEPT {return tgammaf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __x) _NOEXCEPT {return tgammal(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -tgamma(_A1 __x) {return tgamma((double)__x);} +tgamma(_A1 __x) _NOEXCEPT {return tgamma((double)__x);} // trunc using ::trunc; using ::truncf; -inline _LIBCPP_INLINE_VISIBILITY float trunc(float __x) {return truncf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __x) {return truncl(__x);} +inline _LIBCPP_INLINE_VISIBILITY float trunc(float __x) _NOEXCEPT {return truncf(__x);} +inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __x) _NOEXCEPT {return truncl(__x);} template inline _LIBCPP_INLINE_VISIBILITY typename enable_if::value, double>::type -trunc(_A1 __x) {return trunc((double)__x);} +trunc(_A1 __x) _NOEXCEPT {return trunc((double)__x);} #endif // !_MSC_VER diff --git a/contrib/libc++/include/complex b/contrib/libc++/include/complex index 3b660a35a..6f8815298 100644 --- a/contrib/libc++/include/complex +++ b/contrib/libc++/include/complex @@ -330,13 +330,13 @@ class _LIBCPP_VISIBLE complex public: typedef float value_type; - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(float __re = 0.0f, float __im = 0.0f) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f) : __re_(__re), __im_(__im) {} - explicit /*constexpr*/ complex(const complex& __c); - explicit /*constexpr*/ complex(const complex& __c); + explicit _LIBCPP_CONSTEXPR complex(const complex& __c); + explicit _LIBCPP_CONSTEXPR complex(const complex& __c); - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY float real() const {return __re_;} - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY float imag() const {return __im_;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float real() const {return __re_;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float imag() const {return __im_;} _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} @@ -386,13 +386,13 @@ class _LIBCPP_VISIBLE complex public: typedef double value_type; - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(double __re = 0.0, double __im = 0.0) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0) : __re_(__re), __im_(__im) {} - /*constexpr*/ complex(const complex& __c); - explicit /*constexpr*/ complex(const complex& __c); + _LIBCPP_CONSTEXPR complex(const complex& __c); + explicit _LIBCPP_CONSTEXPR complex(const complex& __c); - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY double real() const {return __re_;} - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY double imag() const {return __im_;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double real() const {return __re_;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double imag() const {return __im_;} _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} @@ -442,13 +442,13 @@ class _LIBCPP_VISIBLE complex public: typedef long double value_type; - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(long double __re = 0.0L, long double __im = 0.0L) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L) : __re_(__re), __im_(__im) {} - /*constexpr*/ complex(const complex& __c); - /*constexpr*/ complex(const complex& __c); + _LIBCPP_CONSTEXPR complex(const complex& __c); + _LIBCPP_CONSTEXPR complex(const complex& __c); - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double real() const {return __re_;} - /*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double imag() const {return __im_;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double real() const {return __re_;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double imag() const {return __im_;} _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} @@ -490,33 +490,33 @@ public: } }; -//constexpr inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR complex::complex(const complex& __c) : __re_(__c.real()), __im_(__c.imag()) {} -//constexpr inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR complex::complex(const complex& __c) : __re_(__c.real()), __im_(__c.imag()) {} -//constexpr inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR complex::complex(const complex& __c) : __re_(__c.real()), __im_(__c.imag()) {} -//constexpr inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR complex::complex(const complex& __c) : __re_(__c.real()), __im_(__c.imag()) {} -//constexpr inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR complex::complex(const complex& __c) : __re_(__c.real()), __im_(__c.imag()) {} -//constexpr inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR complex::complex(const complex& __c) : __re_(__c.real()), __im_(__c.imag()) {} @@ -1351,7 +1351,11 @@ tanh(const complex<_Tp>& __x) _Tp __2r(_Tp(2) * __x.real()); _Tp __2i(_Tp(2) * __x.imag()); _Tp __d(cosh(__2r) + cos(__2i)); - return complex<_Tp>(sinh(__2r)/__d, sin(__2i)/__d); + _Tp __2rsh(sinh(__2r)); + if (isinf(__2rsh) && isinf(__d)) + return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1), + __2i > _Tp(0) ? _Tp(0) : _Tp(-0.)); + return complex<_Tp>(__2rsh/__d, sin(__2i)/__d); } // asin diff --git a/contrib/libc++/include/condition_variable b/contrib/libc++/include/condition_variable index b4da556f6..7d0b069a7 100644 --- a/contrib/libc++/include/condition_variable +++ b/contrib/libc++/include/condition_variable @@ -28,8 +28,8 @@ public: condition_variable(const condition_variable&) = delete; condition_variable& operator=(const condition_variable&) = delete; - void notify_one(); - void notify_all(); + void notify_one() noexcept; + void notify_all() noexcept; void wait(unique_lock& lock); template @@ -72,8 +72,8 @@ public: condition_variable_any(const condition_variable_any&) = delete; condition_variable_any& operator=(const condition_variable_any&) = delete; - void notify_one(); - void notify_all(); + void notify_one() noexcept; + void notify_all() noexcept; template void wait(Lock& lock); @@ -124,8 +124,8 @@ class _LIBCPP_VISIBLE condition_variable_any public: condition_variable_any(); - void notify_one(); - void notify_all(); + void notify_one() _NOEXCEPT; + void notify_all() _NOEXCEPT; template void wait(_Lock& __lock); @@ -161,7 +161,7 @@ condition_variable_any::condition_variable_any() inline _LIBCPP_INLINE_VISIBILITY void -condition_variable_any::notify_one() +condition_variable_any::notify_one() _NOEXCEPT { {lock_guard _(*__mut_);} __cv_.notify_one(); @@ -169,7 +169,7 @@ condition_variable_any::notify_one() inline _LIBCPP_INLINE_VISIBILITY void -condition_variable_any::notify_all() +condition_variable_any::notify_all() _NOEXCEPT { {lock_guard _(*__mut_);} __cv_.notify_all(); diff --git a/contrib/libc++/include/cstddef b/contrib/libc++/include/cstddef index 4a6b16e18..4b01be26a 100644 --- a/contrib/libc++/include/cstddef +++ b/contrib/libc++/include/cstddef @@ -62,28 +62,28 @@ struct _LIBCPP_VISIBLE nullptr_t struct __nat {int __for_bool_;}; - _LIBCPP_ALWAYS_INLINE nullptr_t() {} - _LIBCPP_ALWAYS_INLINE nullptr_t(int __nat::*) {} + _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : _(0) {} + _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : _(0) {} - _LIBCPP_ALWAYS_INLINE operator int __nat::*() const {return 0;} + _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;} template - _LIBCPP_ALWAYS_INLINE + _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator _Tp* () const {return 0;} template _LIBCPP_ALWAYS_INLINE operator _Tp _Up::* () const {return 0;} - friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, nullptr_t) {return true;} - friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, nullptr_t) {return false;} - friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, nullptr_t) {return false;} - friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, nullptr_t) {return true;} - friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, nullptr_t) {return false;} - friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, nullptr_t) {return true;} + friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;} + friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;} + friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;} + friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;} + friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;} + friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;} }; -inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);} +inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);} #define nullptr _VSTD::__get_nullptr_t() diff --git a/contrib/libc++/include/cstdio b/contrib/libc++/include/cstdio index 2a6ec762d..718d2f715 100644 --- a/contrib/libc++/include/cstdio +++ b/contrib/libc++/include/cstdio @@ -103,6 +103,18 @@ void perror(const char* s); #pragma GCC system_header #endif +#ifdef getc +inline _LIBCPP_INLINE_VISIBILITY int __libcpp_getc(FILE* __stream) {return getc(__stream);} +#undef getc +inline _LIBCPP_INLINE_VISIBILITY int getc(FILE* __stream) {return __libcpp_getc(__stream);} +#endif // getc + +#ifdef putc +inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream) {return putc(__c, __stream);} +#undef putc +inline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);} +#endif // putc + _LIBCPP_BEGIN_NAMESPACE_STD using ::FILE; diff --git a/contrib/libc++/include/cstdlib b/contrib/libc++/include/cstdlib index a5c78e982..7f6c6c82f 100644 --- a/contrib/libc++/include/cstdlib +++ b/contrib/libc++/include/cstdlib @@ -74,6 +74,9 @@ int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n); int wctomb(char* s, wchar_t wchar); size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n); size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n); +int at_quick_exit(void (*func)(void)) // C++11 +void quick_exit(int status); // C++11 +void *aligned_alloc(size_t alignment, size_t size); // C11 } // std @@ -135,14 +138,17 @@ using ::wcstombs; using ::at_quick_exit; using ::quick_exit; #endif +#ifdef _LIBCPP_HAS_C11_FEATURES +using ::aligned_alloc; +#endif // MSVC already has the correct prototype in #ifdef __cplusplus #if !defined(_MSC_VER) && !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) {return labs(__x);} -inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) {return llabs(__x);} +inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);} +inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);} -inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) {return ldiv(__x, __y);} -inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) {return lldiv(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);} +inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);} #endif // _MSC_VER _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libc++/include/deque b/contrib/libc++/include/deque index e65acfc80..b86d77f9f 100644 --- a/contrib/libc++/include/deque +++ b/contrib/libc++/include/deque @@ -1966,6 +1966,7 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args) } else { + value_type __tmp(_VSTD::forward<_Args>(__args)...); iterator __b = __base::begin(); iterator __bm1 = _VSTD::prev(__b); __alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b)); @@ -1973,7 +1974,7 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args) ++__base::size(); if (__pos > 1) __b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b); - *__b = value_type(_VSTD::forward<_Args>(__args)...); + *__b = _VSTD::move(__tmp); } } else @@ -1989,13 +1990,14 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args) } else { + value_type __tmp(_VSTD::forward<_Args>(__args)...); iterator __e = __base::end(); iterator __em1 = _VSTD::prev(__e); __alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1)); ++__base::size(); if (__de > 1) __e = _VSTD::move_backward(__e - __de, __em1, __e); - *--__e = value_type(_VSTD::forward<_Args>(__args)...); + *--__e = _VSTD::move(__tmp); } } return __base::begin() + __pos; diff --git a/contrib/libc++/include/exception b/contrib/libc++/include/exception index f7c3b70b0..5b75fb04b 100644 --- a/contrib/libc++/include/exception +++ b/contrib/libc++/include/exception @@ -107,19 +107,19 @@ public: typedef void (*unexpected_handler)(); _LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT; _LIBCPP_VISIBLE unexpected_handler get_unexpected() _NOEXCEPT; -_ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void unexpected(); +_LIBCPP_NORETURN _LIBCPP_VISIBLE void unexpected(); typedef void (*terminate_handler)(); _LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) _NOEXCEPT; _LIBCPP_VISIBLE terminate_handler get_terminate() _NOEXCEPT; -_ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void terminate() _NOEXCEPT; +_LIBCPP_NORETURN _LIBCPP_VISIBLE void terminate() _NOEXCEPT; _LIBCPP_VISIBLE bool uncaught_exception() _NOEXCEPT; -class exception_ptr; +class _LIBCPP_VISIBLE exception_ptr; exception_ptr current_exception() _NOEXCEPT; -_ATTRIBUTE(noreturn) void rethrow_exception(exception_ptr); +_LIBCPP_NORETURN void rethrow_exception(exception_ptr); class _LIBCPP_VISIBLE exception_ptr { @@ -143,7 +143,7 @@ public: {return !(__x == __y);} friend exception_ptr current_exception() _NOEXCEPT; - _ATTRIBUTE(noreturn) friend void rethrow_exception(exception_ptr); + _LIBCPP_NORETURN friend void rethrow_exception(exception_ptr); }; template @@ -174,7 +174,7 @@ public: virtual ~nested_exception() _NOEXCEPT; // access functions - _ATTRIBUTE(noreturn) void rethrow_nested() const; + _LIBCPP_NORETURN void rethrow_nested() const; _LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;} }; @@ -187,7 +187,7 @@ struct __nested }; template -_ATTRIBUTE(noreturn) +_LIBCPP_NORETURN void #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES throw_with_nested(_Tp&& __t, typename enable_if< @@ -206,7 +206,7 @@ throw_with_nested (_Tp& __t, typename enable_if< } template -_ATTRIBUTE(noreturn) +_LIBCPP_NORETURN void #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES throw_with_nested(_Tp&& __t, typename enable_if< diff --git a/contrib/libc++/include/forward_list b/contrib/libc++/include/forward_list index 19f748478..404c6eb1c 100644 --- a/contrib/libc++/include/forward_list +++ b/contrib/libc++/include/forward_list @@ -212,8 +212,8 @@ struct __forward_list_node value_type __value_; }; -template class forward_list; -template class __forward_list_const_iterator; +template class _LIBCPP_VISIBLE forward_list; +template class _LIBCPP_VISIBLE __forward_list_const_iterator; template class _LIBCPP_VISIBLE __forward_list_iterator @@ -225,8 +225,8 @@ class _LIBCPP_VISIBLE __forward_list_iterator _LIBCPP_INLINE_VISIBILITY explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {} - template friend class forward_list; - template friend class __forward_list_const_iterator; + template friend class _LIBCPP_VISIBLE forward_list; + template friend class _LIBCPP_VISIBLE __forward_list_const_iterator; public: typedef forward_iterator_tag iterator_category; diff --git a/contrib/libc++/include/fstream b/contrib/libc++/include/fstream index 8e1b1fb69..1b8e7a0a5 100644 --- a/contrib/libc++/include/fstream +++ b/contrib/libc++/include/fstream @@ -234,6 +234,7 @@ private: FILE* __file_; const codecvt* __cv_; state_type __st_; + state_type __st_last_; ios_base::openmode __om_; ios_base::openmode __cm_; bool __owns_eb_; @@ -253,14 +254,20 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf() __intbuf_(0), __ibs_(0), __file_(0), - __cv_(&use_facet >(this->getloc())), + __cv_(nullptr), __st_(), + __st_last_(), __om_(0), __cm_(0), __owns_eb_(false), __owns_ib_(false), - __always_noconv_(__cv_->always_noconv()) + __always_noconv_(false) { + if (has_facet >(this->getloc())) + { + __cv_ = &use_facet >(this->getloc()); + __always_noconv_ = __cv_->always_noconv(); + } setbuf(0, 4096); } @@ -288,6 +295,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs) __file_ = __rhs.__file_; __cv_ = __rhs.__cv_; __st_ = __rhs.__st_; + __st_last_ = __rhs.__st_last_; __om_ = __rhs.__om_; __cm_ = __rhs.__cm_; __owns_eb_ = __rhs.__owns_eb_; @@ -320,6 +328,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs) __rhs.__ibs_ = 0; __rhs.__file_ = 0; __rhs.__st_ = state_type(); + __rhs.__st_last_ = state_type(); __rhs.__om_ = 0; __rhs.__cm_ = 0; __rhs.__owns_eb_ = false; @@ -335,6 +344,7 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs) { close(); swap(__rhs); + return *this; } #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -397,6 +407,7 @@ basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs) _VSTD::swap(__file_, __rhs.__file_); _VSTD::swap(__cv_, __rhs.__cv_); _VSTD::swap(__st_, __rhs.__st_); + _VSTD::swap(__st_last_, __rhs.__st_last_); _VSTD::swap(__om_, __rhs.__om_); _VSTD::swap(__cm_, __rhs.__cm_); _VSTD::swap(__owns_eb_, __rhs.__owns_eb_); @@ -591,18 +602,22 @@ basic_filebuf<_CharT, _Traits>::underflow() memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_); __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_); - size_t __nmemb = _VSTD::min(static_cast(this->egptr() - this->eback() - __unget_sz), + size_t __nmemb = _VSTD::min(static_cast(__ibs_ - __unget_sz), static_cast(__extbufend_ - __extbufnext_)); codecvt_base::result __r; - state_type __svs = __st_; + __st_last_ = __st_; size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_); if (__nr != 0) { +#ifndef _LIBCPP_NO_EXCEPTIONS + if (!__cv_) + throw bad_cast(); +#endif __extbufend_ = __extbufnext_ + __nr; char_type* __inext; __r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_, this->eback() + __unget_sz, - this->egptr(), __inext); + this->eback() + __ibs_, __inext); if (__r == codecvt_base::noconv) { this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_); @@ -676,6 +691,10 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c) codecvt_base::result __r; do { +#ifndef _LIBCPP_NO_EXCEPTIONS + if (!__cv_) + throw bad_cast(); +#endif const char_type* __e; __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e, __extbuf_, __extbuf_ + __ebs_, __extbe); @@ -765,6 +784,10 @@ typename basic_filebuf<_CharT, _Traits>::pos_type basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode) { +#ifndef _LIBCPP_NO_EXCEPTIONS + if (!__cv_) + throw bad_cast(); +#endif int __width = __cv_->encoding(); if (__file_ == 0 || (__width <= 0 && __off != 0) || sync()) return pos_type(off_type(-1)); @@ -799,6 +822,7 @@ basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode) return pos_type(off_type(-1)); if (fseeko(__file_, __sp, SEEK_SET)) return pos_type(off_type(-1)); + __st_ = __sp.state(); return __sp; } @@ -808,6 +832,10 @@ basic_filebuf<_CharT, _Traits>::sync() { if (__file_ == 0) return 0; +#ifndef _LIBCPP_NO_EXCEPTIONS + if (!__cv_) + throw bad_cast(); +#endif if (__cm_ & ios_base::out) { if (this->pptr() != this->pbase()) @@ -830,6 +858,8 @@ basic_filebuf<_CharT, _Traits>::sync() else if (__cm_ & ios_base::in) { off_type __c; + state_type __state = __st_last_; + bool __update_st = false; if (__always_noconv_) __c = this->egptr() - this->gptr(); else @@ -842,32 +872,19 @@ basic_filebuf<_CharT, _Traits>::sync() { if (this->gptr() != this->egptr()) { - reverse(this->gptr(), this->egptr()); - codecvt_base::result __r; - const char_type* __e = this->gptr(); - char* __extbe; - do - { - __r = __cv_->out(__st_, __e, this->egptr(), __e, - __extbuf_, __extbuf_ + __ebs_, __extbe); - switch (__r) - { - case codecvt_base::noconv: - __c += this->egptr() - this->gptr(); - break; - case codecvt_base::ok: - case codecvt_base::partial: - __c += __extbe - __extbuf_; - break; - default: - return -1; - } - } while (__r == codecvt_base::partial); + const int __off = __cv_->length(__state, __extbuf_, + __extbufnext_, + this->gptr() - this->eback()); + __c += __extbufnext_ - __extbuf_ - __off; + __update_st = true; } } } if (fseeko(__file_, -__c, SEEK_CUR)) return -1; + if (__update_st) + __st_ = __state; + __extbufnext_ = __extbufend_ = __extbuf_; this->setg(0, 0, 0); __cm_ = 0; } diff --git a/contrib/libc++/include/functional b/contrib/libc++/include/functional index 884a57773..ec5c5e593 100644 --- a/contrib/libc++/include/functional +++ b/contrib/libc++/include/functional @@ -1113,7 +1113,8 @@ class _LIBCPP_VISIBLE function<_Rp(_ArgTypes...)> _LIBCPP_INLINE_VISIBILITY static bool __not_null(const function<_Rp(_Ap...)>& __p) {return __p;} - template ::value> + template ::value && + __invokable<_Fp&, _ArgTypes...>::value> struct __callable; template struct __callable<_Fp, true> @@ -1350,6 +1351,7 @@ function<_Rp(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT __f_ = __f.__f_; __f.__f_ = 0; } + return *this; } template @@ -1361,6 +1363,7 @@ function<_Rp(_ArgTypes...)>::operator=(nullptr_t) _NOEXCEPT else if (__f_) __f_->destroy_deallocate(); __f_ = 0; + return *this; } template @@ -1707,7 +1710,11 @@ public: #endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS - template + template ::value + >::type> _LIBCPP_INLINE_VISIBILITY explicit __bind(_Gp&& __f, _BA&& ...__bound_args) : __f_(_VSTD::forward<_Gp>(__f)), diff --git a/contrib/libc++/include/future b/contrib/libc++/include/future index aae707e1e..39475bd95 100644 --- a/contrib/libc++/include/future +++ b/contrib/libc++/include/future @@ -40,10 +40,10 @@ enum class future_status }; template <> struct is_error_code_enum : public true_type { }; -error_code make_error_code(future_errc e); -error_condition make_error_condition(future_errc e); +error_code make_error_code(future_errc e) noexcept; +error_condition make_error_condition(future_errc e) noexcept; -const error_category& future_category(); +const error_category& future_category() noexcept; class future_error : public logic_error @@ -51,8 +51,8 @@ class future_error public: future_error(error_code ec); // exposition only - const error_code& code() const throw(); - const char* what() const throw(); + const error_code& code() const noexcept; + const char* what() const noexcept; }; template @@ -62,14 +62,14 @@ public: promise(); template promise(allocator_arg_t, const Allocator& a); - promise(promise&& rhs); + promise(promise&& rhs) noexcept; promise(const promise& rhs) = delete; ~promise(); // assignment - promise& operator=(promise&& rhs); + promise& operator=(promise&& rhs) noexcept; promise& operator=(const promise& rhs) = delete; - void swap(promise& other); + void swap(promise& other) noexcept; // retrieving the result future get_future(); @@ -92,14 +92,14 @@ public: promise(); template promise(allocator_arg_t, const Allocator& a); - promise(promise&& rhs); + promise(promise&& rhs) noexcept; promise(const promise& rhs) = delete; ~promise(); // assignment - promise& operator=(promise&& rhs); + promise& operator=(promise&& rhs) noexcept; promise& operator=(const promise& rhs) = delete; - void swap(promise& other); + void swap(promise& other) noexcept; // retrieving the result future get_future(); @@ -120,14 +120,14 @@ public: promise(); template promise(allocator_arg_t, const Allocator& a); - promise(promise&& rhs); + promise(promise&& rhs) noexcept; promise(const promise& rhs) = delete; ~promise(); // assignment - promise& operator=(promise&& rhs); + promise& operator=(promise&& rhs) noexcept; promise& operator=(const promise& rhs) = delete; - void swap(promise& other); + void swap(promise& other) noexcept; // retrieving the result future get_future(); @@ -141,7 +141,7 @@ public: void set_exception_at_thread_exit(exception_ptr p); }; -template void swap(promise& x, promise& y); +template void swap(promise& x, promise& y) noexcept; template struct uses_allocator, Alloc> : public true_type {}; @@ -150,19 +150,19 @@ template class future { public: - future(); - future(future&&); + future() noexcept; + future(future&&) noexcept; future(const future& rhs) = delete; ~future(); future& operator=(const future& rhs) = delete; - future& operator=(future&&); - shared_future share() &&; + future& operator=(future&&) noexcept; + shared_future share(); // retrieving the value R get(); // functions to check state - bool valid() const; + bool valid() const noexcept; void wait() const; template @@ -177,19 +177,19 @@ template class future { public: - future(); - future(future&&); + future() noexcept; + future(future&&) noexcept; future(const future& rhs) = delete; ~future(); future& operator=(const future& rhs) = delete; - future& operator=(future&&); - shared_future share() &&; + future& operator=(future&&) noexcept; + shared_future share(); // retrieving the value R& get(); // functions to check state - bool valid() const; + bool valid() const noexcept; void wait() const; template @@ -204,19 +204,19 @@ template <> class future { public: - future(); - future(future&&); + future() noexcept; + future(future&&) noexcept; future(const future& rhs) = delete; ~future(); future& operator=(const future& rhs) = delete; - future& operator=(future&&); - shared_future share() &&; + future& operator=(future&&) noexcept; + shared_future share(); // retrieving the value void get(); // functions to check state - bool valid() const; + bool valid() const noexcept; void wait() const; template @@ -231,19 +231,19 @@ template class shared_future { public: - shared_future(); + shared_future() noexcept; shared_future(const shared_future& rhs); - shared_future(future&&); - shared_future(shared_future&& rhs); + shared_future(future&&) noexcept; + shared_future(shared_future&& rhs) noexcept; ~shared_future(); shared_future& operator=(const shared_future& rhs); - shared_future& operator=(shared_future&& rhs); + shared_future& operator=(shared_future&& rhs) noexcept; // retrieving the value const R& get() const; // functions to check state - bool valid() const; + bool valid() const noexcept; void wait() const; template @@ -258,19 +258,19 @@ template class shared_future { public: - shared_future(); + shared_future() noexcept; shared_future(const shared_future& rhs); - shared_future(future&&); - shared_future(shared_future&& rhs); + shared_future(future&&) noexcept; + shared_future(shared_future&& rhs) noexcept; ~shared_future(); shared_future& operator=(const shared_future& rhs); - shared_future& operator=(shared_future&& rhs); + shared_future& operator=(shared_future&& rhs) noexcept; // retrieving the value R& get() const; // functions to check state - bool valid() const; + bool valid() const noexcept; void wait() const; template @@ -285,19 +285,19 @@ template <> class shared_future { public: - shared_future(); + shared_future() noexcept; shared_future(const shared_future& rhs); - shared_future(future&&); - shared_future(shared_future&& rhs); + shared_future(future&&) noexcept; + shared_future(shared_future&& rhs) noexcept; ~shared_future(); shared_future& operator=(const shared_future& rhs); - shared_future& operator=(shared_future&& rhs); + shared_future& operator=(shared_future&& rhs) noexcept; // retrieving the value void get() const; // functions to check state - bool valid() const; + bool valid() const noexcept; void wait() const; template @@ -325,7 +325,7 @@ public: typedef R result_type; // construction and destruction - packaged_task(); + packaged_task() noexcept; template explicit packaged_task(F&& f); template @@ -333,15 +333,15 @@ public: ~packaged_task(); // no copy - packaged_task(packaged_task&) = delete; - packaged_task& operator=(packaged_task&) = delete; + packaged_task(const packaged_task&) = delete; + packaged_task& operator=(const packaged_task&) = delete; // move support - packaged_task(packaged_task&& other); - packaged_task& operator=(packaged_task&& other); - void swap(packaged_task& other); + packaged_task(packaged_task&& other) noexcept; + packaged_task& operator=(packaged_task&& other) noexcept; + void swap(packaged_task& other) noexcept; - bool valid() const; + bool valid() const noexcept; // result retrieval future get_future(); @@ -354,7 +354,7 @@ public: }; template - void swap(packaged_task&); + void swap(packaged_task&) noexcept; template struct uses_allocator, Alloc>; @@ -413,18 +413,18 @@ _LIBCPP_DECLARE_STRONG_ENUM(future_status) _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(future_status) _LIBCPP_VISIBLE -const error_category& future_category(); +const error_category& future_category() _NOEXCEPT; inline _LIBCPP_INLINE_VISIBILITY error_code -make_error_code(future_errc __e) +make_error_code(future_errc __e) _NOEXCEPT { return error_code(static_cast(__e), future_category()); } inline _LIBCPP_INLINE_VISIBILITY error_condition -make_error_condition(future_errc __e) +make_error_condition(future_errc __e) _NOEXCEPT { return error_condition(static_cast(__e), future_category()); } @@ -437,7 +437,7 @@ public: future_error(error_code __ec); _LIBCPP_INLINE_VISIBILITY - const error_code& code() const throw() {return __ec_;} + const error_code& code() const _NOEXCEPT {return __ec_;} virtual ~future_error() _NOEXCEPT; }; @@ -755,7 +755,6 @@ template void __assoc_sub_state_alloc<_Alloc>::__on_zero_shared() _NOEXCEPT { - this->~base(); typename _Alloc::template rebind<__assoc_sub_state_alloc>::other __a(__alloc_); this->~__assoc_sub_state_alloc(); __a.deallocate(this, 1); @@ -963,12 +962,12 @@ __async_assoc_state::__on_zero_shared() _NOEXCEPT base::__on_zero_shared(); } -template class promise; -template class shared_future; +template class _LIBCPP_VISIBLE promise; +template class _LIBCPP_VISIBLE shared_future; // future -template class future; +template class _LIBCPP_VISIBLE future; template future<_Rp> @@ -1010,15 +1009,15 @@ class _LIBCPP_VISIBLE future public: _LIBCPP_INLINE_VISIBILITY - future() : __state_(nullptr) {} + future() _NOEXCEPT : __state_(nullptr) {} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - future(future&& __rhs) + future(future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} future(const future&) = delete; future& operator=(const future&) = delete; _LIBCPP_INLINE_VISIBILITY - future& operator=(future&& __rhs) + future& operator=(future&& __rhs) _NOEXCEPT { future(std::move(__rhs)).swap(*this); return *this; @@ -1036,11 +1035,11 @@ public: _Rp get(); _LIBCPP_INLINE_VISIBILITY - void swap(future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);} + void swap(future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);} // functions to check state _LIBCPP_INLINE_VISIBILITY - bool valid() const {return __state_ != nullptr;} + bool valid() const _NOEXCEPT {return __state_ != nullptr;} _LIBCPP_INLINE_VISIBILITY void wait() const {__state_->wait();} @@ -1114,15 +1113,15 @@ class _LIBCPP_VISIBLE future<_Rp&> public: _LIBCPP_INLINE_VISIBILITY - future() : __state_(nullptr) {} + future() _NOEXCEPT : __state_(nullptr) {} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - future(future&& __rhs) + future(future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} future(const future&) = delete; future& operator=(const future&) = delete; _LIBCPP_INLINE_VISIBILITY - future& operator=(future&& __rhs) + future& operator=(future&& __rhs) _NOEXCEPT { future(std::move(__rhs)).swap(*this); return *this; @@ -1140,11 +1139,11 @@ public: _Rp& get(); _LIBCPP_INLINE_VISIBILITY - void swap(future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);} + void swap(future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);} // functions to check state _LIBCPP_INLINE_VISIBILITY - bool valid() const {return __state_ != nullptr;} + bool valid() const _NOEXCEPT {return __state_ != nullptr;} _LIBCPP_INLINE_VISIBILITY void wait() const {__state_->wait();} @@ -1213,15 +1212,15 @@ class _LIBCPP_VISIBLE future public: _LIBCPP_INLINE_VISIBILITY - future() : __state_(nullptr) {} + future() _NOEXCEPT : __state_(nullptr) {} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - future(future&& __rhs) + future(future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} future(const future&) = delete; future& operator=(const future&) = delete; _LIBCPP_INLINE_VISIBILITY - future& operator=(future&& __rhs) + future& operator=(future&& __rhs) _NOEXCEPT { future(std::move(__rhs)).swap(*this); return *this; @@ -1239,11 +1238,11 @@ public: void get(); _LIBCPP_INLINE_VISIBILITY - void swap(future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);} + void swap(future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);} // functions to check state _LIBCPP_INLINE_VISIBILITY - bool valid() const {return __state_ != nullptr;} + bool valid() const _NOEXCEPT {return __state_ != nullptr;} _LIBCPP_INLINE_VISIBILITY void wait() const {__state_->wait();} @@ -1262,7 +1261,7 @@ public: template inline _LIBCPP_INLINE_VISIBILITY void -swap(future<_Rp>& __x, future<_Rp>& __y) +swap(future<_Rp>& __x, future<_Rp>& __y) _NOEXCEPT { __x.swap(__y); } @@ -1277,7 +1276,7 @@ class _LIBCPP_VISIBLE promise __assoc_state<_Rp>* __state_; _LIBCPP_INLINE_VISIBILITY - explicit promise(nullptr_t) : __state_(nullptr) {} + explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {} template friend class packaged_task; public: @@ -1286,7 +1285,7 @@ public: promise(allocator_arg_t, const _Alloc& __a); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - promise(promise&& __rhs) + promise(promise&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} promise(const promise& __rhs) = delete; #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -1299,7 +1298,7 @@ public: // assignment #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - promise& operator=(promise&& __rhs) + promise& operator=(promise&& __rhs) _NOEXCEPT { promise(std::move(__rhs)).swap(*this); return *this; @@ -1311,7 +1310,7 @@ private: public: #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - void swap(promise& __rhs) {_VSTD::swap(__state_, __rhs.__state_);} + void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);} // retrieving the result future<_Rp> get_future(); @@ -1455,7 +1454,7 @@ class _LIBCPP_VISIBLE promise<_Rp&> __assoc_state<_Rp&>* __state_; _LIBCPP_INLINE_VISIBILITY - explicit promise(nullptr_t) : __state_(nullptr) {} + explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {} template friend class packaged_task; @@ -1465,7 +1464,7 @@ public: promise(allocator_arg_t, const _Allocator& __a); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - promise(promise&& __rhs) + promise(promise&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} promise(const promise& __rhs) = delete; #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -1478,7 +1477,7 @@ public: // assignment #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - promise& operator=(promise&& __rhs) + promise& operator=(promise&& __rhs) _NOEXCEPT { promise(std::move(__rhs)).swap(*this); return *this; @@ -1490,7 +1489,7 @@ private: public: #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - void swap(promise& __rhs) {_VSTD::swap(__state_, __rhs.__state_);} + void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);} // retrieving the result future<_Rp&> get_future(); @@ -1598,7 +1597,7 @@ class _LIBCPP_VISIBLE promise __assoc_sub_state* __state_; _LIBCPP_INLINE_VISIBILITY - explicit promise(nullptr_t) : __state_(nullptr) {} + explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {} template friend class packaged_task; @@ -1608,7 +1607,7 @@ public: promise(allocator_arg_t, const _Allocator& __a); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - promise(promise&& __rhs) + promise(promise&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} promise(const promise& __rhs) = delete; #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -1621,7 +1620,7 @@ public: // assignment #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - promise& operator=(promise&& __rhs) + promise& operator=(promise&& __rhs) _NOEXCEPT { promise(std::move(__rhs)).swap(*this); return *this; @@ -1633,7 +1632,7 @@ private: public: #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - void swap(promise& __rhs) {_VSTD::swap(__state_, __rhs.__state_);} + void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);} // retrieving the result future get_future(); @@ -1661,7 +1660,7 @@ promise::promise(allocator_arg_t, const _Alloc& __a0) template inline _LIBCPP_INLINE_VISIBILITY void -swap(promise<_Rp>& __x, promise<_Rp>& __y) +swap(promise<_Rp>& __x, promise<_Rp>& __y) _NOEXCEPT { __x.swap(__y); } @@ -1686,7 +1685,7 @@ public: __packaged_task_base() {} _LIBCPP_INLINE_VISIBILITY virtual ~__packaged_task_base() {} - virtual void __move_to(__packaged_task_base*) = 0; + virtual void __move_to(__packaged_task_base*) _NOEXCEPT = 0; virtual void destroy() = 0; virtual void destroy_deallocate() = 0; virtual _Rp operator()(_ArgTypes&& ...) = 0; @@ -1710,7 +1709,7 @@ public: _LIBCPP_INLINE_VISIBILITY __packaged_task_func(_Fp&& __f, const _Alloc& __a) : __f_(_VSTD::move(__f), __a) {} - virtual void __move_to(__packaged_task_base<_Rp(_ArgTypes...)>*); + virtual void __move_to(__packaged_task_base<_Rp(_ArgTypes...)>*) _NOEXCEPT; virtual void destroy(); virtual void destroy_deallocate(); virtual _Rp operator()(_ArgTypes&& ... __args); @@ -1719,7 +1718,7 @@ public: template void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to( - __packaged_task_base<_Rp(_ArgTypes...)>* __p) + __packaged_task_base<_Rp(_ArgTypes...)>* __p) _NOEXCEPT { ::new (__p) __packaged_task_func(_VSTD::move(__f_.first()), _VSTD::move(__f_.second())); } @@ -1762,27 +1761,27 @@ public: // construct/copy/destroy: _LIBCPP_INLINE_VISIBILITY - __packaged_task_function() : __f_(nullptr) {} + __packaged_task_function() _NOEXCEPT : __f_(nullptr) {} template __packaged_task_function(_Fp&& __f); template __packaged_task_function(allocator_arg_t, const _Alloc& __a, _Fp&& __f); - __packaged_task_function(__packaged_task_function&&); - __packaged_task_function& operator=(__packaged_task_function&&); + __packaged_task_function(__packaged_task_function&&) _NOEXCEPT; + __packaged_task_function& operator=(__packaged_task_function&&) _NOEXCEPT; __packaged_task_function(const __packaged_task_function&) = delete; __packaged_task_function& operator=(const __packaged_task_function&) = delete; ~__packaged_task_function(); - void swap(__packaged_task_function&); + void swap(__packaged_task_function&) _NOEXCEPT; _Rp operator()(_ArgTypes...) const; }; template -__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(__packaged_task_function&& __f) +__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(__packaged_task_function&& __f) _NOEXCEPT { if (__f.__f_ == nullptr) __f_ = nullptr; @@ -1854,7 +1853,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function( template __packaged_task_function<_Rp(_ArgTypes...)>& -__packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function&& __f) +__packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function&& __f) _NOEXCEPT { if (__f_ == (__base*)&__buf_) __f_->destroy(); @@ -1873,6 +1872,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function& __f_ = __f.__f_; __f.__f_ = nullptr; } + return *this; } template @@ -1886,7 +1886,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::~__packaged_task_function() template void -__packaged_task_function<_Rp(_ArgTypes...)>::swap(__packaged_task_function& __f) +__packaged_task_function<_Rp(_ArgTypes...)>::swap(__packaged_task_function& __f) _NOEXCEPT { if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_) { @@ -1942,7 +1942,7 @@ private: public: // construction and destruction _LIBCPP_INLINE_VISIBILITY - packaged_task() : __p_(nullptr) {} + packaged_task() _NOEXCEPT : __p_(nullptr) {} template _LIBCPP_INLINE_VISIBILITY explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {} @@ -1954,29 +1954,29 @@ public: // ~packaged_task() = default; // no copy - packaged_task(packaged_task&) = delete; - packaged_task& operator=(packaged_task&) = delete; + packaged_task(const packaged_task&) = delete; + packaged_task& operator=(const packaged_task&) = delete; // move support _LIBCPP_INLINE_VISIBILITY - packaged_task(packaged_task&& __other) + packaged_task(packaged_task&& __other) _NOEXCEPT : __f_(_VSTD::move(__other.__f_)), __p_(_VSTD::move(__other.__p_)) {} _LIBCPP_INLINE_VISIBILITY - packaged_task& operator=(packaged_task&& __other) + packaged_task& operator=(packaged_task&& __other) _NOEXCEPT { __f_ = _VSTD::move(__other.__f_); __p_ = _VSTD::move(__other.__p_); return *this; } _LIBCPP_INLINE_VISIBILITY - void swap(packaged_task& __other) + void swap(packaged_task& __other) _NOEXCEPT { __f_.swap(__other.__f_); __p_.swap(__other.__p_); } _LIBCPP_INLINE_VISIBILITY - bool valid() const {return __p_.__state_ != nullptr;} + bool valid() const _NOEXCEPT {return __p_.__state_ != nullptr;} // result retrieval _LIBCPP_INLINE_VISIBILITY @@ -2057,7 +2057,7 @@ private: public: // construction and destruction _LIBCPP_INLINE_VISIBILITY - packaged_task() : __p_(nullptr) {} + packaged_task() _NOEXCEPT : __p_(nullptr) {} template _LIBCPP_INLINE_VISIBILITY explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {} @@ -2069,29 +2069,29 @@ public: // ~packaged_task() = default; // no copy - packaged_task(packaged_task&) = delete; - packaged_task& operator=(packaged_task&) = delete; + packaged_task(const packaged_task&) = delete; + packaged_task& operator=(const packaged_task&) = delete; // move support _LIBCPP_INLINE_VISIBILITY - packaged_task(packaged_task&& __other) + packaged_task(packaged_task&& __other) _NOEXCEPT : __f_(_VSTD::move(__other.__f_)), __p_(_VSTD::move(__other.__p_)) {} _LIBCPP_INLINE_VISIBILITY - packaged_task& operator=(packaged_task&& __other) + packaged_task& operator=(packaged_task&& __other) _NOEXCEPT { __f_ = _VSTD::move(__other.__f_); __p_ = _VSTD::move(__other.__p_); return *this; } _LIBCPP_INLINE_VISIBILITY - void swap(packaged_task& __other) + void swap(packaged_task& __other) _NOEXCEPT { __f_.swap(__other.__f_); __p_.swap(__other.__p_); } _LIBCPP_INLINE_VISIBILITY - bool valid() const {return __p_.__state_ != nullptr;} + bool valid() const _NOEXCEPT {return __p_.__state_ != nullptr;} // result retrieval _LIBCPP_INLINE_VISIBILITY @@ -2164,7 +2164,7 @@ packaged_task::reset() template inline _LIBCPP_INLINE_VISIBILITY void -swap(packaged_task<_Callable>& __x, packaged_task<_Callable>& __y) +swap(packaged_task<_Callable>& __x, packaged_task<_Callable>& __y) _NOEXCEPT { __x.swap(__y); } @@ -2265,23 +2265,23 @@ class _LIBCPP_VISIBLE shared_future public: _LIBCPP_INLINE_VISIBILITY - shared_future() : __state_(nullptr) {} + shared_future() _NOEXCEPT : __state_(nullptr) {} _LIBCPP_INLINE_VISIBILITY shared_future(const shared_future& __rhs) : __state_(__rhs.__state_) {if (__state_) __state_->__add_shared();} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - shared_future(future<_Rp>&& __f) : __state_(__f.__state_) + shared_future(future<_Rp>&& __f) _NOEXCEPT : __state_(__f.__state_) {__f.__state_ = nullptr;} _LIBCPP_INLINE_VISIBILITY - shared_future(shared_future&& __rhs) : __state_(__rhs.__state_) + shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES ~shared_future(); shared_future& operator=(const shared_future& __rhs); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - shared_future& operator=(shared_future&& __rhs) + shared_future& operator=(shared_future&& __rhs) _NOEXCEPT { shared_future(std::move(__rhs)).swap(*this); return *this; @@ -2293,11 +2293,11 @@ public: const _Rp& get() const {return __state_->copy();} _LIBCPP_INLINE_VISIBILITY - void swap(shared_future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);} + void swap(shared_future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);} // functions to check state _LIBCPP_INLINE_VISIBILITY - bool valid() const {return __state_ != nullptr;} + bool valid() const _NOEXCEPT {return __state_ != nullptr;} _LIBCPP_INLINE_VISIBILITY void wait() const {__state_->wait();} @@ -2339,23 +2339,23 @@ class _LIBCPP_VISIBLE shared_future<_Rp&> public: _LIBCPP_INLINE_VISIBILITY - shared_future() : __state_(nullptr) {} + shared_future() _NOEXCEPT : __state_(nullptr) {} _LIBCPP_INLINE_VISIBILITY shared_future(const shared_future& __rhs) : __state_(__rhs.__state_) {if (__state_) __state_->__add_shared();} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - shared_future(future<_Rp&>&& __f) : __state_(__f.__state_) + shared_future(future<_Rp&>&& __f) _NOEXCEPT : __state_(__f.__state_) {__f.__state_ = nullptr;} _LIBCPP_INLINE_VISIBILITY - shared_future(shared_future&& __rhs) : __state_(__rhs.__state_) + shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES ~shared_future(); shared_future& operator=(const shared_future& __rhs); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - shared_future& operator=(shared_future&& __rhs) + shared_future& operator=(shared_future&& __rhs) _NOEXCEPT { shared_future(std::move(__rhs)).swap(*this); return *this; @@ -2367,11 +2367,11 @@ public: _Rp& get() const {return __state_->copy();} _LIBCPP_INLINE_VISIBILITY - void swap(shared_future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);} + void swap(shared_future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);} // functions to check state _LIBCPP_INLINE_VISIBILITY - bool valid() const {return __state_ != nullptr;} + bool valid() const _NOEXCEPT {return __state_ != nullptr;} _LIBCPP_INLINE_VISIBILITY void wait() const {__state_->wait();} @@ -2413,23 +2413,23 @@ class _LIBCPP_VISIBLE shared_future public: _LIBCPP_INLINE_VISIBILITY - shared_future() : __state_(nullptr) {} + shared_future() _NOEXCEPT : __state_(nullptr) {} _LIBCPP_INLINE_VISIBILITY shared_future(const shared_future& __rhs) : __state_(__rhs.__state_) {if (__state_) __state_->__add_shared();} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - shared_future(future&& __f) : __state_(__f.__state_) + shared_future(future&& __f) _NOEXCEPT : __state_(__f.__state_) {__f.__state_ = nullptr;} _LIBCPP_INLINE_VISIBILITY - shared_future(shared_future&& __rhs) : __state_(__rhs.__state_) + shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES ~shared_future(); shared_future& operator=(const shared_future& __rhs); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - shared_future& operator=(shared_future&& __rhs) + shared_future& operator=(shared_future&& __rhs) _NOEXCEPT { shared_future(std::move(__rhs)).swap(*this); return *this; @@ -2441,11 +2441,11 @@ public: void get() const {__state_->copy();} _LIBCPP_INLINE_VISIBILITY - void swap(shared_future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);} + void swap(shared_future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);} // functions to check state _LIBCPP_INLINE_VISIBILITY - bool valid() const {return __state_ != nullptr;} + bool valid() const _NOEXCEPT {return __state_ != nullptr;} _LIBCPP_INLINE_VISIBILITY void wait() const {__state_->wait();} @@ -2464,7 +2464,7 @@ public: template inline _LIBCPP_INLINE_VISIBILITY void -swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y) +swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y) _NOEXCEPT { __x.swap(__y); } diff --git a/contrib/libc++/include/ios b/contrib/libc++/include/ios index 51d50870b..7e489e390 100644 --- a/contrib/libc++/include/ios +++ b/contrib/libc++/include/ios @@ -29,43 +29,43 @@ public: class failure; typedef T1 fmtflags; - static const fmtflags boolalpha; - static const fmtflags dec; - static const fmtflags fixed; - static const fmtflags hex; - static const fmtflags internal; - static const fmtflags left; - static const fmtflags oct; - static const fmtflags right; - static const fmtflags scientific; - static const fmtflags showbase; - static const fmtflags showpoint; - static const fmtflags showpos; - static const fmtflags skipws; - static const fmtflags unitbuf; - static const fmtflags uppercase; - static const fmtflags adjustfield; - static const fmtflags basefield; - static const fmtflags floatfield; + static constexpr fmtflags boolalpha; + static constexpr fmtflags dec; + static constexpr fmtflags fixed; + static constexpr fmtflags hex; + static constexpr fmtflags internal; + static constexpr fmtflags left; + static constexpr fmtflags oct; + static constexpr fmtflags right; + static constexpr fmtflags scientific; + static constexpr fmtflags showbase; + static constexpr fmtflags showpoint; + static constexpr fmtflags showpos; + static constexpr fmtflags skipws; + static constexpr fmtflags unitbuf; + static constexpr fmtflags uppercase; + static constexpr fmtflags adjustfield; + static constexpr fmtflags basefield; + static constexpr fmtflags floatfield; typedef T2 iostate; - static const iostate badbit; - static const iostate eofbit; - static const iostate failbit; - static const iostate goodbit; + static constexpr iostate badbit; + static constexpr iostate eofbit; + static constexpr iostate failbit; + static constexpr iostate goodbit; typedef T3 openmode; - static const openmode app; - static const openmode ate; - static const openmode binary; - static const openmode in; - static const openmode out; - static const openmode trunc; + static constexpr openmode app; + static constexpr openmode ate; + static constexpr openmode binary; + static constexpr openmode in; + static constexpr openmode out; + static constexpr openmode trunc; typedef T4 seekdir; - static const seekdir beg; - static const seekdir cur; - static const seekdir end; + static constexpr seekdir beg; + static constexpr seekdir cur; + static constexpr seekdir end; class Init; @@ -160,7 +160,7 @@ protected: basic_ios(); void init(basic_streambuf* sb); void move(basic_ios& rhs); - void swap(basic_ios& rhs); + void swap(basic_ios& rhs) noexcept; void set_rdbuf(basic_streambuf* sb); }; @@ -227,7 +227,7 @@ typedef ptrdiff_t streamsize; class _LIBCPP_VISIBLE ios_base { public: - class failure; + class _LIBCPP_VISIBLE failure; typedef unsigned int fmtflags; static const fmtflags boolalpha = 0x0001; @@ -271,7 +271,7 @@ public: typedef _VSTD::streamoff streamoff; typedef _VSTD::streampos streampos; - class Init; + class _LIBCPP_VISIBLE Init; // 27.5.2.2 fmtflags state: _LIBCPP_INLINE_VISIBILITY fmtflags flags() const; @@ -342,7 +342,7 @@ protected: void __call_callbacks(event); void copyfmt(const ios_base&); void move(ios_base&); - void swap(ios_base&); + void swap(ios_base&) _NOEXCEPT; _LIBCPP_ALWAYS_INLINE void set_rdbuf(void* __sb) @@ -632,12 +632,12 @@ protected: void move(basic_ios&& __rhs) {move(__rhs);} #endif _LIBCPP_INLINE_VISIBILITY - void swap(basic_ios& __rhs); + void swap(basic_ios& __rhs) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY void set_rdbuf(basic_streambuf* __sb); private: basic_ostream* __tie_; - char_type __fill_; + mutable int_type __fill_; }; template @@ -659,7 +659,7 @@ basic_ios<_CharT, _Traits>::init(basic_streambuf* __sb) { ios_base::init(__sb); __tie_ = 0; - __fill_ = widen(' '); + __fill_ = traits_type::eof(); } template @@ -731,6 +731,8 @@ inline _LIBCPP_INLINE_VISIBILITY _CharT basic_ios<_CharT, _Traits>::fill() const { + if (traits_type::eq_int_type(traits_type::eof(), __fill_)) + __fill_ = widen(' '); return __fill_; } @@ -774,7 +776,7 @@ basic_ios<_CharT, _Traits>::move(basic_ios& __rhs) template inline _LIBCPP_INLINE_VISIBILITY void -basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) +basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT { ios_base::swap(__rhs); _VSTD::swap(__tie_, __rhs.__tie_); diff --git a/contrib/libc++/include/iosfwd b/contrib/libc++/include/iosfwd index 7e5ac7321..efdff5f35 100644 --- a/contrib/libc++/include/iosfwd +++ b/contrib/libc++/include/iosfwd @@ -95,7 +95,7 @@ typedef fpos::state_type> wstreampos; _LIBCPP_BEGIN_NAMESPACE_STD -class ios_base; +class _LIBCPP_VISIBLE ios_base; template struct _LIBCPP_VISIBLE char_traits; template class _LIBCPP_VISIBLE allocator; diff --git a/contrib/libc++/include/istream b/contrib/libc++/include/istream index 7312425eb..72b2004dd 100644 --- a/contrib/libc++/include/istream +++ b/contrib/libc++/include/istream @@ -194,7 +194,7 @@ protected: public: // 27.7.1.1.3 Prefix/suffix: - class sentry; + class _LIBCPP_VISIBLE sentry; // 27.7.1.2 Formatted input: basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&)); @@ -1263,6 +1263,7 @@ basic_istream<_CharT, _Traits>::putback(char_type __c) try { #endif // _LIBCPP_NO_EXCEPTIONS + this->clear(this->rdstate() & ~ios_base::eofbit); sentry __sen(*this, true); if (__sen) { @@ -1290,6 +1291,7 @@ basic_istream<_CharT, _Traits>::unget() try { #endif // _LIBCPP_NO_EXCEPTIONS + this->clear(this->rdstate() & ~ios_base::eofbit); sentry __sen(*this, true); if (__sen) { @@ -1368,6 +1370,7 @@ basic_istream<_CharT, _Traits>::seekg(pos_type __pos) try { #endif // _LIBCPP_NO_EXCEPTIONS + this->clear(this->rdstate() & ~ios_base::eofbit); sentry __sen(*this, true); if (__sen) if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1)) diff --git a/contrib/libc++/include/iterator b/contrib/libc++/include/iterator index 75fee4b9d..5747504a3 100644 --- a/contrib/libc++/include/iterator +++ b/contrib/libc++/include/iterator @@ -263,10 +263,10 @@ public: typedef basic_streambuf streambuf_type; typedef basic_istream istream_type; - istreambuf_iterator() throw(); - istreambuf_iterator(istream_type& s) throw(); - istreambuf_iterator(streambuf_type* s) throw(); - istreambuf_iterator(a-private-type) throw(); + istreambuf_iterator() noexcept; + istreambuf_iterator(istream_type& s) noexcept; + istreambuf_iterator(streambuf_type* s) noexcept; + istreambuf_iterator(a-private-type) noexcept; charT operator*() const; pointer operator->() const; @@ -293,13 +293,13 @@ public: typedef basic_streambuf streambuf_type; typedef basic_ostream ostream_type; - ostreambuf_iterator(ostream_type& s) throw(); - ostreambuf_iterator(streambuf_type* s) throw(); + ostreambuf_iterator(ostream_type& s) noexcept; + ostreambuf_iterator(streambuf_type* s) noexcept; ostreambuf_iterator& operator=(charT c); ostreambuf_iterator& operator*(); ostreambuf_iterator& operator++(); ostreambuf_iterator& operator++(int); - bool failed() const throw(); + bool failed() const noexcept; }; template auto begin(C& c) -> decltype(c.begin()); @@ -815,12 +815,12 @@ private: __sbuf_ = 0; } public: - _LIBCPP_INLINE_VISIBILITY istreambuf_iterator() throw() : __sbuf_(0) {} - _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) throw() + _LIBCPP_INLINE_VISIBILITY istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {} + _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT : __sbuf_(__s.rdbuf()) {__test_for_eof();} - _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) throw() + _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) _NOEXCEPT : __sbuf_(__s) {__test_for_eof();} - _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) throw() + _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) _NOEXCEPT : __sbuf_(__p.__sbuf_) {} _LIBCPP_INLINE_VISIBILITY char_type operator*() const @@ -867,9 +867,9 @@ public: private: streambuf_type* __sbuf_; public: - _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(ostream_type& __s) throw() + _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(ostream_type& __s) _NOEXCEPT : __sbuf_(__s.rdbuf()) {} - _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(streambuf_type* __s) throw() + _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(streambuf_type* __s) _NOEXCEPT : __sbuf_(__s) {} _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator=(_CharT __c) { @@ -880,7 +880,15 @@ public: _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++() {return *this;} _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;} - _LIBCPP_INLINE_VISIBILITY bool failed() const throw() {return __sbuf_ == 0;} + _LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == 0;} + + template + friend + _LIBCPP_HIDDEN + ostreambuf_iterator<_Ch, _Tr> + __pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s, + const _Ch* __ob, const _Ch* __op, const _Ch* __oe, + ios_base& __iob, _Ch __fl); }; template @@ -1009,43 +1017,52 @@ make_move_iterator(const _Iter& __i) template class __wrap_iter; template +_LIBCPP_INLINE_VISIBILITY bool operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; template +_LIBCPP_INLINE_VISIBILITY bool operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; template +_LIBCPP_INLINE_VISIBILITY bool operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; template +_LIBCPP_INLINE_VISIBILITY bool operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; template +_LIBCPP_INLINE_VISIBILITY bool operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; template +_LIBCPP_INLINE_VISIBILITY bool operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; template +_LIBCPP_INLINE_VISIBILITY typename __wrap_iter<_Iter1>::difference_type operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; template +_LIBCPP_INLINE_VISIBILITY __wrap_iter<_Iter> operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT; -template _Op copy(_Ip, _Ip, _Op); -template _B2 copy_backward(_B1, _B1, _B2); -template _Op move(_Ip, _Ip, _Op); -template _B2 move_backward(_B1, _B1, _B2); +template _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op); +template _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2); +template _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op); +template _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2); template +_LIBCPP_INLINE_VISIBILITY typename enable_if < is_trivially_copy_assignable<_Tp>::value, @@ -1284,6 +1301,38 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX return !(__y < __x); } +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT +{ + return !(__x == __y); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT +{ + return __y < __x; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT +{ + return !(__x < __y); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT +{ + return !(__y < __x); +} + template inline _LIBCPP_INLINE_VISIBILITY typename __wrap_iter<_Iter1>::difference_type @@ -1313,34 +1362,42 @@ operator+(typename __wrap_iter<_Iter>::difference_type __n, template class __debug_iter; template +_LIBCPP_INLINE_VISIBILITY bool operator==(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); template +_LIBCPP_INLINE_VISIBILITY bool operator<(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); template +_LIBCPP_INLINE_VISIBILITY bool operator!=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); template +_LIBCPP_INLINE_VISIBILITY bool operator>(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); template +_LIBCPP_INLINE_VISIBILITY bool operator>=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); template +_LIBCPP_INLINE_VISIBILITY bool operator<=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); template +_LIBCPP_INLINE_VISIBILITY typename __debug_iter<_Container, _Iter1>::difference_type operator-(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); template +_LIBCPP_INLINE_VISIBILITY __debug_iter<_Container, _Iter> operator+(typename __debug_iter<_Container, _Iter>::difference_type, const __debug_iter<_Container, _Iter>&); diff --git a/contrib/libc++/include/list b/contrib/libc++/include/list index b486e8313..812588690 100644 --- a/contrib/libc++/include/list +++ b/contrib/libc++/include/list @@ -213,9 +213,9 @@ struct __list_node _Tp __value_; }; -template class list; +template class _LIBCPP_VISIBLE list; template class __list_imp; -template class __list_const_iterator; +template class _LIBCPP_VISIBLE __list_const_iterator; template class _LIBCPP_VISIBLE __list_iterator diff --git a/contrib/libc++/include/locale b/contrib/libc++/include/locale index bec27f6d9..3e8d9a82a 100644 --- a/contrib/libc++/include/locale +++ b/contrib/libc++/include/locale @@ -1587,6 +1587,52 @@ __pad_and_output(_OutputIterator __s, return __s; } +template +_LIBCPP_HIDDEN +ostreambuf_iterator<_CharT, _Traits> +__pad_and_output(ostreambuf_iterator<_CharT, _Traits> __s, + const _CharT* __ob, const _CharT* __op, const _CharT* __oe, + ios_base& __iob, _CharT __fl) +{ + if (__s.__sbuf_ == nullptr) + return __s; + streamsize __sz = __oe - __ob; + streamsize __ns = __iob.width(); + if (__ns > __sz) + __ns -= __sz; + else + __ns = 0; + streamsize __np = __op - __ob; + if (__np > 0) + { + if (__s.__sbuf_->sputn(__ob, __np) != __np) + { + __s.__sbuf_ = nullptr; + return __s; + } + } + if (__ns > 0) + { + basic_string<_CharT, _Traits> __sp(__ns, __fl); + if (__s.__sbuf_->sputn(__sp.data(), __ns) != __ns) + { + __s.__sbuf_ = nullptr; + return __s; + } + } + __np = __oe - __op; + if (__np > 0) + { + if (__s.__sbuf_->sputn(__op, __np) != __np) + { + __s.__sbuf_ = nullptr; + return __s; + } + } + __iob.width(0); + return __s; +} + template _OutputIterator num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, @@ -2830,9 +2876,9 @@ protected: virtual string_type do_negative_sign() const {return string_type(1, '-');} virtual int do_frac_digits() const {return 0;} virtual pattern do_pos_format() const - {pattern __p = {symbol, sign, none, value}; return __p;} + {pattern __p = {{symbol, sign, none, value}}; return __p;} virtual pattern do_neg_format() const - {pattern __p = {symbol, sign, none, value}; return __p;} + {pattern __p = {{symbol, sign, none, value}}; return __p;} }; template @@ -3146,7 +3192,6 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e, bool __sb = __flags & ios_base::showbase; if (__sb || __more_needed) { - ios_base::iostate __et = ios_base::goodbit; typename string_type::const_iterator __sym_space_end = __sym.begin(); if (__p > 0 && (__pat.field[__p - 1] == money_base::none || __pat.field[__p - 1] == money_base::space)) { @@ -3920,7 +3965,8 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: if (__cvtptr_ != nullptr) { wide_string __ws(2*(__frm_end - __frm), _Elem()); - __ws.resize(__ws.capacity()); + if (__frm != __frm_end) + __ws.resize(__ws.capacity()); codecvt_base::result __r = codecvt_base::ok; state_type __st = __cvtstate_; if (__frm != __frm_end) @@ -3980,7 +4026,8 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: if (__cvtptr_ != nullptr) { byte_string __bs(2*(__frm_end - __frm), char()); - __bs.resize(__bs.capacity()); + if (__frm != __frm_end) + __bs.resize(__bs.capacity()); codecvt_base::result __r = codecvt_base::ok; state_type __st = __cvtstate_; if (__frm != __frm_end) diff --git a/contrib/libc++/include/map b/contrib/libc++/include/map index 633579b7e..dd98da5e7 100644 --- a/contrib/libc++/include/map +++ b/contrib/libc++/include/map @@ -880,45 +880,15 @@ public: value_compare value_comp() const {return value_compare(__tree_.value_comp().key_comp());} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - - _LIBCPP_INLINE_VISIBILITY - pair - emplace() {return __tree_.__emplace_unique();} - - template ::value>::type> - _LIBCPP_INLINE_VISIBILITY - pair - emplace(_A0&& __a0) - {return __tree_.__emplace_unique(_VSTD::forward<_A0>(__a0));} - #ifndef _LIBCPP_HAS_NO_VARIADICS - template ::value>::type> + template pair - emplace(_A0&& __a0, _Args&& ...__args); - -#endif // _LIBCPP_HAS_NO_VARIADICS - - _LIBCPP_INLINE_VISIBILITY - iterator - emplace_hint(const_iterator __p) - {return __tree_.__emplace_hint_unique(__p.__i_);} - - template ::value>::type> - _LIBCPP_INLINE_VISIBILITY - iterator - emplace_hint(const_iterator __p, _A0&& __a0) - {return __tree_.__emplace_hint_unique(__p.__i_, _VSTD::forward<_A0>(__a0));} - -#ifndef _LIBCPP_HAS_NO_VARIADICS + emplace(_Args&& ...__args); - template ::value>::type> + template iterator - emplace_hint(const_iterator __p, _A0&& __a0, _Args&& ...__args); + emplace_hint(const_iterator __p, _Args&& ...__args); #endif // _LIBCPP_HAS_NO_VARIADICS @@ -1015,13 +985,23 @@ private: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES __node_holder __construct_node(); - template ::value>::type> - __node_holder __construct_node(_A0&& __a0); + template + typename enable_if + < + is_constructible::value, + __node_holder + >::type + __construct_node(_A0&& __a0); + template + typename enable_if + < + is_constructible::value, + __node_holder + >::type + __construct_node(_A0&& __a0); #ifndef _LIBCPP_HAS_NO_VARIADICS - template ::value>::type> - __node_holder __construct_node(_A0&& __a0, _Args&& ...__args); + template + __node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args); #endif // _LIBCPP_HAS_NO_VARIADICS #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES __node_holder __construct_node(const key_type& __k); @@ -1215,9 +1195,12 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node() } template -template -typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder +template +typename enable_if +< + is_constructible, _A0>::value, + typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder +>::type map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0) { __node_allocator& __na = __tree_.__node_alloc(); @@ -1228,19 +1211,37 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0) return __h; } +template +template +typename enable_if +< + is_constructible<_Key, _A0>::value, + typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder +>::type +map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0) +{ + __node_allocator& __na = __tree_.__node_alloc(); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); + __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0)); + __h.get_deleter().__first_constructed = true; + __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second)); + __h.get_deleter().__second_constructed = true; + return __h; +} + #ifndef _LIBCPP_HAS_NO_VARIADICS template -template +template typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder -map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__args) +map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args) { __node_allocator& __na = __tree_.__node_alloc(); __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0)); + __node_traits::construct(__na, _VSTD::addressof(__h->__value_), + _VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1), + _VSTD::forward<_Args>(__args)...); __h.get_deleter().__first_constructed = true; - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), _VSTD::forward<_Args>(__args)...); __h.get_deleter().__second_constructed = true; return __h; } @@ -1329,14 +1330,11 @@ map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) template -template ::value>::type - > +template pair::iterator, bool> -map<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args) +map<_Key, _Tp, _Compare, _Allocator>::emplace(_Args&& ...__args) { - __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0), - _VSTD::forward<_Args>(__args)...); + __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...); pair __r = __tree_.__node_insert_unique(__h.get()); if (__r.second) __h.release(); @@ -1344,15 +1342,12 @@ map<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args) } template -template ::value>::type - > +template typename map<_Key, _Tp, _Compare, _Allocator>::iterator map<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p, - _A0&& __a0, _Args&& ...__args) + _Args&& ...__args) { - __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0), - _VSTD::forward<_Args>(__args)...); + __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...); iterator __r = __tree_.__node_insert_unique(__p.__i_, __h.get()); if (__r.__i_.__ptr_ == __h.get()) __h.release(); @@ -1629,43 +1624,15 @@ public: {return value_compare(__tree_.value_comp().key_comp());} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - - _LIBCPP_INLINE_VISIBILITY - iterator emplace() {return __tree_.__emplace_multi();} - - template ::value>::type> - _LIBCPP_INLINE_VISIBILITY - iterator - emplace(_A0&& __a0) - {return __tree_.__emplace_multi(_VSTD::forward<_A0>(__a0));} - #ifndef _LIBCPP_HAS_NO_VARIADICS - template ::value>::type> + template iterator - emplace(_A0&& __a0, _Args&& ...__args); - -#endif // _LIBCPP_HAS_NO_VARIADICS + emplace(_Args&& ...__args); - _LIBCPP_INLINE_VISIBILITY - iterator emplace_hint(const_iterator __p) - {return __tree_.__emplace_hint_multi(__p.__i_);} - - template ::value>::type> - _LIBCPP_INLINE_VISIBILITY - iterator - emplace_hint(const_iterator __p, _A0&& __a0) - {return __tree_.__emplace_hint_multi(__p.__i_, _VSTD::forward<_A0>(__a0));} - -#ifndef _LIBCPP_HAS_NO_VARIADICS - - template ::value>::type> + template iterator - emplace_hint(const_iterator __p, _A0&& __a0, _Args&& ...__args); + emplace_hint(const_iterator __p, _Args&& ...__args); #endif // _LIBCPP_HAS_NO_VARIADICS @@ -1757,13 +1724,23 @@ private: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES __node_holder __construct_node(); - template ::value>::type> - __node_holder __construct_node(_A0&& __a0); + template + typename enable_if + < + is_constructible::value, + __node_holder + >::type + __construct_node(_A0&& __a0); + template + typename enable_if + < + is_constructible::value, + __node_holder + >::type + __construct_node(_A0&& __a0); #ifndef _LIBCPP_HAS_NO_VARIADICS - template ::value>::type> - __node_holder __construct_node(_A0&& __a0, _Args&& ...__args); + template + __node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args); #endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES }; @@ -1797,10 +1774,12 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node() } template -template ::value>::type - > -typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder +template +typename enable_if +< + is_constructible, _A0>::value, + typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder +>::type multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0) { __node_allocator& __na = __tree_.__node_alloc(); @@ -1811,20 +1790,37 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0) return __h; } +template +template +typename enable_if +< + is_constructible<_Key, _A0>::value, + typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder +>::type +multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0) +{ + __node_allocator& __na = __tree_.__node_alloc(); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); + __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0)); + __h.get_deleter().__first_constructed = true; + __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second)); + __h.get_deleter().__second_constructed = true; + return __h; +} + #ifndef _LIBCPP_HAS_NO_VARIADICS template -template ::value>::type - > +template typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder -multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__args) +multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args) { __node_allocator& __na = __tree_.__node_alloc(); __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0)); + __node_traits::construct(__na, _VSTD::addressof(__h->__value_), + _VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1), + _VSTD::forward<_Args>(__args)...); __h.get_deleter().__first_constructed = true; - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), _VSTD::forward<_Args>(__args)...); __h.get_deleter().__second_constructed = true; return __h; } @@ -1835,30 +1831,23 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) template -template ::value>::type - > +template typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator -multimap<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args) +multimap<_Key, _Tp, _Compare, _Allocator>::emplace(_Args&& ...__args) { - __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0), - _VSTD::forward<_Args>(__args)...); + __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...); iterator __r = __tree_.__node_insert_multi(__h.get()); __h.release(); return __r; } template -template ::value>::type - > +template typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator multimap<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p, - _A0&& __a0, _Args&& ...__args) { - __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0), - _VSTD::forward<_Args>(__args)...); + __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...); iterator __r = __tree_.__node_insert_multi(__p.__i_, __h.get()); __h.release(); return __r; diff --git a/contrib/libc++/include/memory b/contrib/libc++/include/memory index e30a6fd7c..fe5dd0c79 100644 --- a/contrib/libc++/include/memory +++ b/contrib/libc++/include/memory @@ -602,6 +602,10 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space); #include #endif +#if __has_feature(cxx_atomic) +# include +#endif + #include <__undef_min_max> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -2467,7 +2471,11 @@ struct __same_or_less_cv_qualified<_Ptr1, _Ptr2, true> template struct _LIBCPP_VISIBLE default_delete { - _LIBCPP_INLINE_VISIBILITY default_delete() _NOEXCEPT {} +#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT = default; +#else + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT {} +#endif template _LIBCPP_INLINE_VISIBILITY default_delete(const default_delete<_Up>&, typename enable_if::value>::type* = 0) _NOEXCEPT {} @@ -2482,7 +2490,11 @@ template struct _LIBCPP_VISIBLE default_delete<_Tp[]> { public: - _LIBCPP_INLINE_VISIBILITY default_delete() _NOEXCEPT {} +#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT = default; +#else + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT {} +#endif template _LIBCPP_INLINE_VISIBILITY default_delete(const default_delete<_Up[]>&, typename enable_if<__same_or_less_cv_qualified<_Up*, _Tp*>::value>::type* = 0) _NOEXCEPT {} @@ -2520,13 +2532,13 @@ private: typedef typename remove_reference::type& _Dp_reference; typedef const typename remove_reference::type& _Dp_const_reference; public: - _LIBCPP_INLINE_VISIBILITY unique_ptr() _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer()) { static_assert(!is_pointer::value, "unique_ptr constructed with null function pointer deleter"); } - _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t) _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer()) { static_assert(!is_pointer::value, @@ -2699,13 +2711,13 @@ private: typedef typename remove_reference::type& _Dp_reference; typedef const typename remove_reference::type& _Dp_const_reference; public: - _LIBCPP_INLINE_VISIBILITY unique_ptr() _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer()) { static_assert(!is_pointer::value, "unique_ptr constructed with null function pointer deleter"); } - _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t) _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer()) { static_assert(!is_pointer::value, @@ -2955,7 +2967,7 @@ operator>=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {re template inline _LIBCPP_INLINE_VISIBILITY bool -operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) +operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT { return !__x; } @@ -2963,7 +2975,7 @@ operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) template inline _LIBCPP_INLINE_VISIBILITY bool -operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) +operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT { return !__x; } @@ -2971,7 +2983,7 @@ operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) template inline _LIBCPP_INLINE_VISIBILITY bool -operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) +operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT { return static_cast(__x); } @@ -2979,7 +2991,7 @@ operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) template inline _LIBCPP_INLINE_VISIBILITY bool -operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x) +operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT { return static_cast(__x); } @@ -3379,8 +3391,19 @@ struct __scalar_hash<_Tp, 4> template struct _LIBCPP_VISIBLE hash<_Tp*> - : public __scalar_hash<_Tp*> + : public unary_function<_Tp*, size_t> { + _LIBCPP_INLINE_VISIBILITY + size_t operator()(_Tp* __v) const _NOEXCEPT + { + union + { + _Tp* __t; + size_t __a; + } __u; + __u.__t = __v; + return __murmur2_or_cityhash()(&__u, sizeof(__u)); + } }; template @@ -3557,7 +3580,7 @@ public: virtual const char* what() const _NOEXCEPT; }; -template class weak_ptr; +template class _LIBCPP_VISIBLE weak_ptr; class __shared_count { @@ -3603,6 +3626,9 @@ public: long use_count() const _NOEXCEPT {return __shared_count::use_count();} __shared_weak_count* lock() _NOEXCEPT; + // purposefully not protected with #ifndef _LIBCPP_NO_RTTI because doing so + // breaks ABI for those clients who need to compile their projects with + // -fno-rtti and yet link against a libc++.dylib compiled without -fno-rtti. virtual const void* __get_deleter(const type_info&) const _NOEXCEPT; private: virtual void __on_zero_shared_weak() _NOEXCEPT = 0; @@ -3720,7 +3746,7 @@ __shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT __a.deallocate(this, 1); } -template class enable_shared_from_this; +template class _LIBCPP_VISIBLE enable_shared_from_this; template class _LIBCPP_VISIBLE shared_ptr @@ -3733,8 +3759,8 @@ private: struct __nat {int __for_bool_;}; public: - shared_ptr() _NOEXCEPT; - shared_ptr(nullptr_t) _NOEXCEPT; + _LIBCPP_CONSTEXPR shared_ptr() _NOEXCEPT; + _LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT; template const& __p) const {return __cntrl_ < __p.__cntrl_;} + _LIBCPP_INLINE_VISIBILITY + bool + __owner_equivalent(const shared_ptr& __p) const + {return __cntrl_ == __p.__cntrl_;} #ifndef _LIBCPP_NO_RTTI template @@ -3994,6 +4024,7 @@ private: template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR shared_ptr<_Tp>::shared_ptr() _NOEXCEPT : __ptr_(0), __cntrl_(0) @@ -4002,6 +4033,7 @@ shared_ptr<_Tp>::shared_ptr() _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR shared_ptr<_Tp>::shared_ptr(nullptr_t) _NOEXCEPT : __ptr_(0), __cntrl_(0) @@ -4892,7 +4924,7 @@ private: __shared_weak_count* __cntrl_; public: - weak_ptr() _NOEXCEPT; + _LIBCPP_CONSTEXPR weak_ptr() _NOEXCEPT; template weak_ptr(shared_ptr<_Yp> const& __r, typename enable_if::value, __nat*>::type = 0) _NOEXCEPT; @@ -4964,6 +4996,7 @@ public: template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR weak_ptr<_Tp>::weak_ptr() _NOEXCEPT : __ptr_(0), __cntrl_(0) @@ -5194,7 +5227,7 @@ class _LIBCPP_VISIBLE enable_shared_from_this { mutable weak_ptr<_Tp> __weak_this_; protected: - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR enable_shared_from_this() _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY enable_shared_from_this(enable_shared_from_this const&) _NOEXCEPT {} @@ -5231,6 +5264,134 @@ inline _LIBCPP_INLINE_VISIBILITY basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p); +#if __has_feature(cxx_atomic) + +class __sp_mut +{ + void* _; +public: + void lock() _NOEXCEPT; + void unlock() _NOEXCEPT; + +private: + _LIBCPP_CONSTEXPR __sp_mut(void*) _NOEXCEPT; + __sp_mut(const __sp_mut&); + __sp_mut& operator=(const __sp_mut&); + + friend _LIBCPP_VISIBLE __sp_mut& __get_sp_mut(const void*); +}; + +_LIBCPP_VISIBLE __sp_mut& __get_sp_mut(const void*); + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +atomic_is_lock_free(const shared_ptr<_Tp>*) +{ + return false; +} + +template +shared_ptr<_Tp> +atomic_load(const shared_ptr<_Tp>* __p) +{ + __sp_mut& __m = __get_sp_mut(__p); + __m.lock(); + shared_ptr<_Tp> __q = *__p; + __m.unlock(); + return __q; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +shared_ptr<_Tp> +atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order) +{ + return atomic_load(__p); +} + +template +void +atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) +{ + __sp_mut& __m = __get_sp_mut(__p); + __m.lock(); + __p->swap(__r); + __m.unlock(); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +void +atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) +{ + atomic_store(__p, __r); +} + +template +shared_ptr<_Tp> +atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) +{ + __sp_mut& __m = __get_sp_mut(__p); + __m.lock(); + __p->swap(__r); + __m.unlock(); + return __r; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +shared_ptr<_Tp> +atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) +{ + return atomic_exchange(__p, __r); +} + +template +bool +atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w) +{ + __sp_mut& __m = __get_sp_mut(__p); + __m.lock(); + if (__p->__owner_equivalent(*__v)) + { + *__p = __w; + __m.unlock(); + return true; + } + *__v = *__p; + __m.unlock(); + return false; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w) +{ + return atomic_compare_exchange_strong(__p, __v, __w); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, + shared_ptr<_Tp> __w, memory_order, memory_order) +{ + return atomic_compare_exchange_strong(__p, __v, __w); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, + shared_ptr<_Tp> __w, memory_order, memory_order) +{ + return atomic_compare_exchange_weak(__p, __v, __w); +} + +#endif // __has_feature(cxx_atomic) + //enum class struct _LIBCPP_VISIBLE pointer_safety { diff --git a/contrib/libc++/include/mutex b/contrib/libc++/include/mutex index 62b733f41..ee20f021e 100644 --- a/contrib/libc++/include/mutex +++ b/contrib/libc++/include/mutex @@ -20,7 +20,7 @@ namespace std class mutex { public: - mutex(); + constexpr mutex() noexcept; ~mutex(); mutex(const mutex&) = delete; @@ -44,7 +44,7 @@ public: recursive_mutex& operator=(const recursive_mutex&) = delete; void lock(); - bool try_lock(); + bool try_lock() noexcept; void unlock(); typedef pthread_mutex_t* native_handle_type; @@ -79,7 +79,7 @@ public: recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete; void lock(); - bool try_lock(); + bool try_lock() noexcept; template bool try_lock_for(const chrono::duration& rel_time); template @@ -114,9 +114,9 @@ class unique_lock { public: typedef Mutex mutex_type; - unique_lock(); + unique_lock() noexcept; explicit unique_lock(mutex_type& m); - unique_lock(mutex_type& m, defer_lock_t); + unique_lock(mutex_type& m, defer_lock_t) noexcept; unique_lock(mutex_type& m, try_to_lock_t); unique_lock(mutex_type& m, adopt_lock_t); template @@ -128,8 +128,8 @@ public: unique_lock(unique_lock const&) = delete; unique_lock& operator=(unique_lock const&) = delete; - unique_lock(unique_lock&& u); - unique_lock& operator=(unique_lock&& u); + unique_lock(unique_lock&& u) noexcept; + unique_lock& operator=(unique_lock&& u) noexcept; void lock(); bool try_lock(); @@ -141,16 +141,16 @@ public: void unlock(); - void swap(unique_lock& u); - mutex_type* release(); + void swap(unique_lock& u) noexcept; + mutex_type* release() noexcept; - bool owns_lock() const; - explicit operator bool () const; - mutex_type* mutex() const; + bool owns_lock() const noexcept; + explicit operator bool () const noexcept; + mutex_type* mutex() const noexcept; }; template - void swap(unique_lock& x, unique_lock& y); + void swap(unique_lock& x, unique_lock& y) noexcept; template int try_lock(L1&, L2&, L3&...); @@ -159,7 +159,7 @@ template struct once_flag { - constexpr once_flag(); + constexpr once_flag() noexcept; once_flag(const once_flag&) = delete; once_flag& operator=(const once_flag&) = delete; @@ -201,8 +201,8 @@ private: public: void lock(); - bool try_lock(); - void unlock(); + bool try_lock() _NOEXCEPT; + void unlock() _NOEXCEPT; typedef pthread_mutex_t* native_handle_type; _LIBCPP_INLINE_VISIBILITY @@ -224,14 +224,14 @@ private: public: void lock(); - bool try_lock(); + bool try_lock() _NOEXCEPT; template _LIBCPP_INLINE_VISIBILITY bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) {return try_lock_until(chrono::steady_clock::now() + __d);} template bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); - void unlock(); + void unlock() _NOEXCEPT; }; template @@ -267,14 +267,14 @@ private: public: void lock(); - bool try_lock(); + bool try_lock() _NOEXCEPT; template _LIBCPP_INLINE_VISIBILITY bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) {return try_lock_until(chrono::steady_clock::now() + __d);} template bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); - void unlock(); + void unlock() _NOEXCEPT; }; template @@ -425,25 +425,27 @@ lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3) #endif // _LIBCPP_HAS_NO_VARIADICS -struct once_flag; +struct _LIBCPP_VISIBLE once_flag; #ifndef _LIBCPP_HAS_NO_VARIADICS template - void call_once(once_flag&, _Callable&&, _Args&&...); +_LIBCPP_INLINE_VISIBILITY +void call_once(once_flag&, _Callable&&, _Args&&...); #else // _LIBCPP_HAS_NO_VARIADICS template - void call_once(once_flag&, _Callable); +_LIBCPP_INLINE_VISIBILITY +void call_once(once_flag&, _Callable); #endif // _LIBCPP_HAS_NO_VARIADICS struct _LIBCPP_VISIBLE once_flag { _LIBCPP_INLINE_VISIBILITY - // constexpr - once_flag() {} + _LIBCPP_CONSTEXPR + once_flag() _NOEXCEPT : __state_(0) {} private: once_flag(const once_flag&); // = delete; diff --git a/contrib/libc++/include/new b/contrib/libc++/include/new index 5bcbad0cd..ae0951a74 100644 --- a/contrib/libc++/include/new +++ b/contrib/libc++/include/new @@ -96,7 +96,7 @@ _LIBCPP_VISIBLE void* operator new(std::size_t __sz) throw(std::bad_alloc) #endif ; -_LIBCPP_VISIBLE void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT; +_LIBCPP_VISIBLE void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS; _LIBCPP_VISIBLE void operator delete(void* __p) _NOEXCEPT; _LIBCPP_VISIBLE void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT; @@ -105,7 +105,7 @@ _LIBCPP_VISIBLE void* operator new[](std::size_t __sz) throw(std::bad_alloc) #endif ; -_LIBCPP_VISIBLE void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT; +_LIBCPP_VISIBLE void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS; _LIBCPP_VISIBLE void operator delete[](void* __p) _NOEXCEPT; _LIBCPP_VISIBLE void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT; diff --git a/contrib/libc++/include/ostream b/contrib/libc++/include/ostream index e6dd4b578..b135ddb77 100644 --- a/contrib/libc++/include/ostream +++ b/contrib/libc++/include/ostream @@ -169,7 +169,7 @@ protected: public: // 27.7.2.4 Prefix/suffix: - class sentry; + class _LIBCPP_VISIBLE sentry; // 27.7.2.6 Formatted output: basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&)); diff --git a/contrib/libc++/include/queue b/contrib/libc++/include/queue index e05ab8f8b..4741f0035 100644 --- a/contrib/libc++/include/queue +++ b/contrib/libc++/include/queue @@ -177,13 +177,15 @@ template _LIBCPP_BEGIN_NAMESPACE_STD -template class queue; +template class _LIBCPP_VISIBLE queue; template +_LIBCPP_INLINE_VISIBILITY bool operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y); template +_LIBCPP_INLINE_VISIBILITY bool operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y); diff --git a/contrib/libc++/include/random b/contrib/libc++/include/random index 098332725..a1553f13f 100644 --- a/contrib/libc++/include/random +++ b/contrib/libc++/include/random @@ -217,7 +217,7 @@ public: void discard(unsigned long long z); // property functions - const Engine& base() const; + const Engine& base() const noexcept; }; template @@ -269,7 +269,7 @@ public: result_type operator()(); void discard(unsigned long long z); // property functions - const Engine& base() const; + const Engine& base() const noexcept; }; template @@ -323,7 +323,7 @@ public: void discard(unsigned long long z); // property functions - const Engine& base() const; + const Engine& base() const noexcept; }; template @@ -392,7 +392,7 @@ public: result_type operator()(); // property functions - double entropy() const; + double entropy() const noexcept; // no copy functions random_device(const random_device& ) = delete; @@ -1813,10 +1813,11 @@ struct __lce_ta<__a, __c, __m, (unsigned short)(~0), __b> }; template -class linear_congruential_engine; +class _LIBCPP_VISIBLE linear_congruential_engine; template +_LIBCPP_INLINE_VISIBILITY basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&); @@ -2021,7 +2022,7 @@ typedef minstd_rand default_random_engine; template -class mersenne_twister_engine; +class _LIBCPP_VISIBLE mersenne_twister_engine; template +_LIBCPP_INLINE_VISIBILITY bool operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x, @@ -2424,7 +2426,7 @@ typedef mersenne_twister_engine -class subtract_with_carry_engine; +class _LIBCPP_VISIBLE subtract_with_carry_engine; template bool @@ -2433,6 +2435,7 @@ operator==( const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y); template +_LIBCPP_INLINE_VISIBILITY bool operator!=( const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, @@ -2788,7 +2791,7 @@ public: // property functions _LIBCPP_INLINE_VISIBILITY - const _Engine& base() const {return __e_;} + const _Engine& base() const _NOEXCEPT {return __e_;} template friend @@ -2993,7 +2996,7 @@ public: // property functions _LIBCPP_INLINE_VISIBILITY - const _Engine& base() const {return __e_;} + const _Engine& base() const _NOEXCEPT {return __e_;} template friend @@ -3222,7 +3225,7 @@ public: // property functions _LIBCPP_INLINE_VISIBILITY - const _Engine& base() const {return __e_;} + const _Engine& base() const _NOEXCEPT {return __e_;} private: template @@ -3399,7 +3402,7 @@ public: result_type operator()(); // property functions - double entropy() const; + double entropy() const _NOEXCEPT; private: // no copy functions diff --git a/contrib/libc++/include/regex b/contrib/libc++/include/regex index 2ebb0f1d5..7505f2ea3 100644 --- a/contrib/libc++/include/regex +++ b/contrib/libc++/include/regex @@ -147,7 +147,7 @@ public: explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript); basic_regex(const charT* p, size_t len, flag_type f); basic_regex(const basic_regex&); - basic_regex(basic_regex&&); + basic_regex(basic_regex&&) noexcept; template explicit basic_regex(const basic_string& p, flag_type f = regex_constants::ECMAScript); @@ -159,7 +159,7 @@ public: ~basic_regex(); basic_regex& operator=(const basic_regex&); - basic_regex& operator=(basic_regex&&); + basic_regex& operator=(basic_regex&&) noexcept; basic_regex& operator=(const charT* ptr); basic_regex& operator=(initializer_list il); template @@ -167,7 +167,7 @@ public: // assign: basic_regex& assign(const basic_regex& that); - basic_regex& assign(basic_regex&& that); + basic_regex& assign(basic_regex&& that) noexcept; basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript); basic_regex& assign(const charT* p, size_t len, flag_type f); template @@ -449,7 +449,7 @@ public: // construct/copy/destroy: explicit match_results(const Allocator& a = Allocator()); match_results(const match_results& m); - match_results(match_results&& m); + match_results(match_results&& m) noexcept; match_results& operator=(const match_results& m); match_results& operator=(match_results&& m); ~match_results(); @@ -760,7 +760,7 @@ enum syntax_option_type }; inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ +_LIBCPP_CONSTEXPR syntax_option_type operator~(syntax_option_type __x) { @@ -768,7 +768,7 @@ operator~(syntax_option_type __x) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ +_LIBCPP_CONSTEXPR syntax_option_type operator&(syntax_option_type __x, syntax_option_type __y) { @@ -776,7 +776,7 @@ operator&(syntax_option_type __x, syntax_option_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ +_LIBCPP_CONSTEXPR syntax_option_type operator|(syntax_option_type __x, syntax_option_type __y) { @@ -784,7 +784,7 @@ operator|(syntax_option_type __x, syntax_option_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ +_LIBCPP_CONSTEXPR syntax_option_type operator^(syntax_option_type __x, syntax_option_type __y) { @@ -792,7 +792,6 @@ operator^(syntax_option_type __x, syntax_option_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ syntax_option_type& operator&=(syntax_option_type& __x, syntax_option_type __y) { @@ -801,7 +800,6 @@ operator&=(syntax_option_type& __x, syntax_option_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ syntax_option_type& operator|=(syntax_option_type& __x, syntax_option_type __y) { @@ -810,7 +808,6 @@ operator|=(syntax_option_type& __x, syntax_option_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ syntax_option_type& operator^=(syntax_option_type& __x, syntax_option_type __y) { @@ -839,7 +836,7 @@ enum match_flag_type }; inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ +_LIBCPP_CONSTEXPR match_flag_type operator~(match_flag_type __x) { @@ -847,7 +844,7 @@ operator~(match_flag_type __x) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ +_LIBCPP_CONSTEXPR match_flag_type operator&(match_flag_type __x, match_flag_type __y) { @@ -855,7 +852,7 @@ operator&(match_flag_type __x, match_flag_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ +_LIBCPP_CONSTEXPR match_flag_type operator|(match_flag_type __x, match_flag_type __y) { @@ -863,7 +860,7 @@ operator|(match_flag_type __x, match_flag_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ +_LIBCPP_CONSTEXPR match_flag_type operator^(match_flag_type __x, match_flag_type __y) { @@ -871,7 +868,6 @@ operator^(match_flag_type __x, match_flag_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ match_flag_type& operator&=(match_flag_type& __x, match_flag_type __y) { @@ -880,7 +876,6 @@ operator&=(match_flag_type& __x, match_flag_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ match_flag_type& operator|=(match_flag_type& __x, match_flag_type __y) { @@ -889,7 +884,6 @@ operator|=(match_flag_type& __x, match_flag_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ match_flag_type& operator^=(match_flag_type& __x, match_flag_type __y) { @@ -1237,11 +1231,11 @@ regex_traits<_CharT>::__value(wchar_t __ch, int __radix) const template class __node; -template class sub_match; +template class _LIBCPP_VISIBLE sub_match; template > > -class match_results; +class _LIBCPP_VISIBLE match_results; template struct __state @@ -2439,16 +2433,16 @@ private: public: // constants: - static const/*expr*/ regex_constants::syntax_option_type icase = regex_constants::icase; - static const/*expr*/ regex_constants::syntax_option_type nosubs = regex_constants::nosubs; - static const/*expr*/ regex_constants::syntax_option_type optimize = regex_constants::optimize; - static const/*expr*/ regex_constants::syntax_option_type collate = regex_constants::collate; - static const/*expr*/ regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript; - static const/*expr*/ regex_constants::syntax_option_type basic = regex_constants::basic; - static const/*expr*/ regex_constants::syntax_option_type extended = regex_constants::extended; - static const/*expr*/ regex_constants::syntax_option_type awk = regex_constants::awk; - static const/*expr*/ regex_constants::syntax_option_type grep = regex_constants::grep; - static const/*expr*/ regex_constants::syntax_option_type egrep = regex_constants::egrep; + static const regex_constants::syntax_option_type icase = regex_constants::icase; + static const regex_constants::syntax_option_type nosubs = regex_constants::nosubs; + static const regex_constants::syntax_option_type optimize = regex_constants::optimize; + static const regex_constants::syntax_option_type collate = regex_constants::collate; + static const regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript; + static const regex_constants::syntax_option_type basic = regex_constants::basic; + static const regex_constants::syntax_option_type extended = regex_constants::extended; + static const regex_constants::syntax_option_type awk = regex_constants::awk; + static const regex_constants::syntax_option_type grep = regex_constants::grep; + static const regex_constants::syntax_option_type egrep = regex_constants::egrep; // construct/copy/destroy: _LIBCPP_INLINE_VISIBILITY @@ -2512,6 +2506,11 @@ public: _LIBCPP_INLINE_VISIBILITY basic_regex& assign(const basic_regex& __that) {return *this = __that;} +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + basic_regex& assign(basic_regex&& __that) _NOEXCEPT + {return *this = _VSTD::move(__that);} +#endif _LIBCPP_INLINE_VISIBILITY basic_regex& assign(const value_type* __p, flag_type __f = regex_constants::ECMAScript) {return assign(__p, __p + __traits_.length(__p), __f);} @@ -2563,6 +2562,7 @@ public: { __member_init(__f); __parse(__first, __last); + return *this; } #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS @@ -4740,7 +4740,7 @@ public: bool matched; _LIBCPP_INLINE_VISIBILITY - /*constexpr*/ sub_match() : matched() {} + _LIBCPP_CONSTEXPR sub_match() : matched() {} _LIBCPP_INLINE_VISIBILITY difference_type length() const diff --git a/contrib/libc++/include/stack b/contrib/libc++/include/stack index 59906bd89..12fb35b70 100644 --- a/contrib/libc++/include/stack +++ b/contrib/libc++/include/stack @@ -91,13 +91,15 @@ template _LIBCPP_BEGIN_NAMESPACE_STD -template class stack; +template class _LIBCPP_VISIBLE stack; template +_LIBCPP_INLINE_VISIBILITY bool operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y); template +_LIBCPP_INLINE_VISIBILITY bool operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y); diff --git a/contrib/libc++/include/streambuf b/contrib/libc++/include/streambuf index e128be5d5..e34ad23eb 100644 --- a/contrib/libc++/include/streambuf +++ b/contrib/libc++/include/streambuf @@ -540,7 +540,7 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n) { if (__nout_ < __eout_) *__nout_++ = *__s; - else if (overflow(*__s) == __eof) + else if (overflow(traits_type::to_int_type(*__s)) == __eof) break; } return __i; diff --git a/contrib/libc++/include/string b/contrib/libc++/include/string index 620e6f828..89a00e55b 100644 --- a/contrib/libc++/include/string +++ b/contrib/libc++/include/string @@ -51,8 +51,8 @@ struct char_traits typedef mbstate_t state_type; static void assign(char_type& c1, const char_type& c2) noexcept; - static bool eq(char_type c1, char_type c2) noexcept; - static bool lt(char_type c1, char_type c2) noexcept; + static constexpr bool eq(char_type c1, char_type c2) noexcept; + static constexpr bool lt(char_type c1, char_type c2) noexcept; static int compare(const char_type* s1, const char_type* s2, size_t n); static size_t length(const char_type* s); @@ -61,11 +61,11 @@ struct char_traits static char_type* copy(char_type* s1, const char_type* s2, size_t n); static char_type* assign(char_type* s, size_t n, char_type a); - static int_type not_eof(int_type c) noexcept; - static char_type to_char_type(int_type c) noexcept; - static int_type to_int_type(char_type c) noexcept; - static bool eq_int_type(int_type c1, int_type c2) noexcept; - static int_type eof() noexcept; + static constexpr int_type not_eof(int_type c) noexcept; + static constexpr char_type to_char_type(int_type c) noexcept; + static constexpr int_type to_int_type(char_type c) noexcept; + static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept; + static constexpr int_type eof() noexcept; }; template <> struct char_traits; @@ -506,10 +506,10 @@ struct _LIBCPP_VISIBLE char_traits static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} _LIBCPP_INLINE_VISIBILITY - static bool eq(char_type __c1, char_type __c2) _NOEXCEPT + static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT {return __c1 == __c2;} _LIBCPP_INLINE_VISIBILITY - static bool lt(char_type __c1, char_type __c2) _NOEXCEPT + static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT {return __c1 < __c2;} static int compare(const char_type* __s1, const char_type* __s2, size_t __n); @@ -519,19 +519,20 @@ struct _LIBCPP_VISIBLE char_traits static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n); static char_type* assign(char_type* __s, size_t __n, char_type __a); - _LIBCPP_INLINE_VISIBILITY static int_type not_eof(int_type __c) _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY + static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {return eq_int_type(__c, eof()) ? ~eof() : __c;} _LIBCPP_INLINE_VISIBILITY - static char_type to_char_type(int_type __c) _NOEXCEPT + static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT {return char_type(__c);} _LIBCPP_INLINE_VISIBILITY - static int_type to_int_type(char_type __c) _NOEXCEPT + static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT {return int_type(__c);} _LIBCPP_INLINE_VISIBILITY - static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT + static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT {return __c1 == __c2;} _LIBCPP_INLINE_VISIBILITY - static int_type eof() _NOEXCEPT + static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT {return int_type(EOF);} }; @@ -631,10 +632,10 @@ struct _LIBCPP_VISIBLE char_traits static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} _LIBCPP_INLINE_VISIBILITY - static bool eq(char_type __c1, char_type __c2) _NOEXCEPT + static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT {return __c1 == __c2;} _LIBCPP_INLINE_VISIBILITY - static bool lt(char_type __c1, char_type __c2) _NOEXCEPT + static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT {return (unsigned char)__c1 < (unsigned char)__c2;} _LIBCPP_INLINE_VISIBILITY @@ -655,19 +656,20 @@ struct _LIBCPP_VISIBLE char_traits static char_type* assign(char_type* __s, size_t __n, char_type __a) {return (char_type*)memset(__s, to_int_type(__a), __n);} - _LIBCPP_INLINE_VISIBILITY static int_type not_eof(int_type __c) _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY + static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {return eq_int_type(__c, eof()) ? ~eof() : __c;} _LIBCPP_INLINE_VISIBILITY - static char_type to_char_type(int_type __c) _NOEXCEPT + static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT {return char_type(__c);} _LIBCPP_INLINE_VISIBILITY - static int_type to_int_type(char_type __c) _NOEXCEPT + static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT {return int_type((unsigned char)__c);} _LIBCPP_INLINE_VISIBILITY - static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT + static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT {return __c1 == __c2;} _LIBCPP_INLINE_VISIBILITY - static int_type eof() _NOEXCEPT + static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT {return int_type(EOF);} }; @@ -686,10 +688,10 @@ struct _LIBCPP_VISIBLE char_traits static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} _LIBCPP_INLINE_VISIBILITY - static bool eq(char_type __c1, char_type __c2) _NOEXCEPT + static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT {return __c1 == __c2;} _LIBCPP_INLINE_VISIBILITY - static bool lt(char_type __c1, char_type __c2) _NOEXCEPT + static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT {return __c1 < __c2;} _LIBCPP_INLINE_VISIBILITY @@ -712,19 +714,19 @@ struct _LIBCPP_VISIBLE char_traits {return (char_type*)wmemset(__s, __a, __n);} _LIBCPP_INLINE_VISIBILITY - static int_type not_eof(int_type __c) _NOEXCEPT + static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {return eq_int_type(__c, eof()) ? ~eof() : __c;} _LIBCPP_INLINE_VISIBILITY - static char_type to_char_type(int_type __c) _NOEXCEPT + static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT {return char_type(__c);} _LIBCPP_INLINE_VISIBILITY - static int_type to_int_type(char_type __c) _NOEXCEPT + static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT {return int_type(__c);} _LIBCPP_INLINE_VISIBILITY - static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT + static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT {return __c1 == __c2;} _LIBCPP_INLINE_VISIBILITY - static int_type eof() _NOEXCEPT + static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT {return int_type(WEOF);} }; @@ -743,10 +745,10 @@ struct _LIBCPP_VISIBLE char_traits static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} _LIBCPP_INLINE_VISIBILITY - static bool eq(char_type __c1, char_type __c2) _NOEXCEPT + static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT {return __c1 == __c2;} _LIBCPP_INLINE_VISIBILITY - static bool lt(char_type __c1, char_type __c2) _NOEXCEPT + static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT {return __c1 < __c2;} static int compare(const char_type* __s1, const char_type* __s2, size_t __n); @@ -757,19 +759,19 @@ struct _LIBCPP_VISIBLE char_traits static char_type* assign(char_type* __s, size_t __n, char_type __a); _LIBCPP_INLINE_VISIBILITY - static int_type not_eof(int_type __c) _NOEXCEPT + static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {return eq_int_type(__c, eof()) ? ~eof() : __c;} _LIBCPP_INLINE_VISIBILITY - static char_type to_char_type(int_type __c) _NOEXCEPT + static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT {return char_type(__c);} _LIBCPP_INLINE_VISIBILITY - static int_type to_int_type(char_type __c) _NOEXCEPT + static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT {return int_type(__c);} _LIBCPP_INLINE_VISIBILITY - static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT + static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT {return __c1 == __c2;} _LIBCPP_INLINE_VISIBILITY - static int_type eof() _NOEXCEPT + static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT {return int_type(0xDFFF);} }; @@ -863,10 +865,10 @@ struct _LIBCPP_VISIBLE char_traits static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} _LIBCPP_INLINE_VISIBILITY - static bool eq(char_type __c1, char_type __c2) _NOEXCEPT + static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT {return __c1 == __c2;} _LIBCPP_INLINE_VISIBILITY - static bool lt(char_type __c1, char_type __c2) _NOEXCEPT + static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT {return __c1 < __c2;} static int compare(const char_type* __s1, const char_type* __s2, size_t __n); @@ -877,19 +879,19 @@ struct _LIBCPP_VISIBLE char_traits static char_type* assign(char_type* __s, size_t __n, char_type __a); _LIBCPP_INLINE_VISIBILITY - static int_type not_eof(int_type __c) _NOEXCEPT + static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {return eq_int_type(__c, eof()) ? ~eof() : __c;} _LIBCPP_INLINE_VISIBILITY - static char_type to_char_type(int_type __c) _NOEXCEPT + static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT {return char_type(__c);} _LIBCPP_INLINE_VISIBILITY - static int_type to_int_type(char_type __c) _NOEXCEPT + static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT {return int_type(__c);} _LIBCPP_INLINE_VISIBILITY - static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT + static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT {return __c1 == __c2;} _LIBCPP_INLINE_VISIBILITY - static int_type eof() _NOEXCEPT + static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT {return int_type(0xFFFFFFFF);} }; @@ -2206,6 +2208,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(_InputIterator __first, _Input clear(); for (; __first != __last; ++__first) push_back(*__first); + return *this; } template diff --git a/contrib/libc++/include/system_error b/contrib/libc++/include/system_error index e9f2b55ea..9f7e4e9e3 100644 --- a/contrib/libc++/include/system_error +++ b/contrib/libc++/include/system_error @@ -354,12 +354,12 @@ struct _LIBCPP_VISIBLE is_error_condition_enum : true_type { }; #endif -class error_condition; -class error_code; +class _LIBCPP_VISIBLE error_condition; +class _LIBCPP_VISIBLE error_code; // class error_category -class __do_message; +class _LIBCPP_HIDDEN __do_message; class _LIBCPP_VISIBLE error_category { @@ -387,7 +387,7 @@ public: _LIBCPP_ALWAYS_INLINE bool operator< (const error_category& __rhs) const _NOEXCEPT {return this < &__rhs;} - friend class __do_message; + friend class _LIBCPP_HIDDEN __do_message; }; class _LIBCPP_HIDDEN __do_message diff --git a/contrib/libc++/include/thread b/contrib/libc++/include/thread index 23b191589..60d888595 100644 --- a/contrib/libc++/include/thread +++ b/contrib/libc++/include/thread @@ -26,41 +26,41 @@ public: class id; typedef pthread_t native_handle_type; - thread(); + thread() noexcept; template explicit thread(F&& f, Args&&... args); ~thread(); thread(const thread&) = delete; - thread(thread&& t); + thread(thread&& t) noexcept; thread& operator=(const thread&) = delete; - thread& operator=(thread&& t); + thread& operator=(thread&& t) noexcept; - void swap(thread& t); + void swap(thread& t) noexcept; - bool joinable() const; + bool joinable() const noexcept; void join(); void detach(); - id get_id() const; + id get_id() const noexcept; native_handle_type native_handle(); - static unsigned hardware_concurrency(); + static unsigned hardware_concurrency() noexcept; }; -void swap(thread& x, thread& y); +void swap(thread& x, thread& y) noexcept; class thread::id { public: - id(); + id() noexcept; }; -bool operator==(thread::id x, thread::id y); -bool operator!=(thread::id x, thread::id y); -bool operator< (thread::id x, thread::id y); -bool operator<=(thread::id x, thread::id y); -bool operator> (thread::id x, thread::id y); -bool operator>=(thread::id x, thread::id y); +bool operator==(thread::id x, thread::id y) noexcept; +bool operator!=(thread::id x, thread::id y) noexcept; +bool operator< (thread::id x, thread::id y) noexcept; +bool operator<=(thread::id x, thread::id y) noexcept; +bool operator> (thread::id x, thread::id y) noexcept; +bool operator>=(thread::id x, thread::id y) noexcept; template basic_ostream& @@ -69,9 +69,9 @@ operator<<(basic_ostream& out, thread::id id); namespace this_thread { -thread::id get_id(); +thread::id get_id() noexcept; -void yield(); +void yield() noexcept; template void sleep_until(const chrono::time_point& abs_time); @@ -173,13 +173,13 @@ __thread_specific_ptr<_Tp>::reset(pointer __p) delete __p_old; } -class thread; -class __thread_id; +class _LIBCPP_VISIBLE thread; +class _LIBCPP_VISIBLE __thread_id; namespace this_thread { -__thread_id get_id(); +_LIBCPP_INLINE_VISIBILITY __thread_id get_id() _NOEXCEPT; } // this_thread @@ -195,25 +195,25 @@ class _LIBCPP_VISIBLE __thread_id public: _LIBCPP_INLINE_VISIBILITY - __thread_id() : __id_(0) {} + __thread_id() _NOEXCEPT : __id_(0) {} friend _LIBCPP_INLINE_VISIBILITY - bool operator==(__thread_id __x, __thread_id __y) + bool operator==(__thread_id __x, __thread_id __y) _NOEXCEPT {return __x.__id_ == __y.__id_;} friend _LIBCPP_INLINE_VISIBILITY - bool operator!=(__thread_id __x, __thread_id __y) + bool operator!=(__thread_id __x, __thread_id __y) _NOEXCEPT {return !(__x == __y);} friend _LIBCPP_INLINE_VISIBILITY - bool operator< (__thread_id __x, __thread_id __y) + bool operator< (__thread_id __x, __thread_id __y) _NOEXCEPT {return __x.__id_ < __y.__id_;} friend _LIBCPP_INLINE_VISIBILITY - bool operator<=(__thread_id __x, __thread_id __y) + bool operator<=(__thread_id __x, __thread_id __y) _NOEXCEPT {return !(__y < __x);} friend _LIBCPP_INLINE_VISIBILITY - bool operator> (__thread_id __x, __thread_id __y) + bool operator> (__thread_id __x, __thread_id __y) _NOEXCEPT {return __y < __x ;} friend _LIBCPP_INLINE_VISIBILITY - bool operator>=(__thread_id __x, __thread_id __y) + bool operator>=(__thread_id __x, __thread_id __y) _NOEXCEPT {return !(__x < __y);} template @@ -227,7 +227,7 @@ private: _LIBCPP_INLINE_VISIBILITY __thread_id(pthread_t __id) : __id_(__id) {} - friend __thread_id this_thread::get_id(); + friend __thread_id this_thread::get_id() _NOEXCEPT; friend class _LIBCPP_VISIBLE thread; friend struct _LIBCPP_VISIBLE hash<__thread_id>; }; @@ -248,7 +248,7 @@ namespace this_thread inline _LIBCPP_INLINE_VISIBILITY __thread_id -get_id() +get_id() _NOEXCEPT { return pthread_self(); } @@ -266,7 +266,7 @@ public: typedef pthread_t native_handle_type; _LIBCPP_INLINE_VISIBILITY - thread() : __t_(0) {} + thread() _NOEXCEPT : __t_(0) {} #ifndef _LIBCPP_HAS_NO_VARIADICS template & __d) { using namespace chrono; - nanoseconds __ns = duration_cast(__d); - if (__ns < __d) - ++__ns; - sleep_for(__ns); + if (__d > duration<_Rep, _Period>::zero()) + { + _LIBCPP_CONSTEXPR duration _Max = nanoseconds::max(); + nanoseconds __ns; + if (__d < _Max) + { + __ns = duration_cast(__d); + if (__ns < __d) + ++__ns; + } + else + __ns = nanoseconds::max(); + sleep_for(__ns); + } } template @@ -438,7 +448,7 @@ sleep_until(const chrono::time_point& __t) } inline _LIBCPP_INLINE_VISIBILITY -void yield() {sched_yield();} +void yield() _NOEXCEPT {sched_yield();} } // this_thread diff --git a/contrib/libc++/include/tuple b/contrib/libc++/include/tuple index 683c9dd52..65af3eb64 100644 --- a/contrib/libc++/include/tuple +++ b/contrib/libc++/include/tuple @@ -130,7 +130,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD struct _LIBCPP_VISIBLE allocator_arg_t { }; +#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY) extern const allocator_arg_t allocator_arg; +#else +constexpr allocator_arg_t allocator_arg = allocator_arg_t(); +#endif // uses_allocator @@ -227,7 +231,8 @@ class __tuple_leaf __tuple_leaf& operator=(const __tuple_leaf&); public: - _LIBCPP_INLINE_VISIBILITY __tuple_leaf() : value() + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf() + _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : value() {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} @@ -255,7 +260,7 @@ public: template ::value>::type> _LIBCPP_INLINE_VISIBILITY - explicit __tuple_leaf(_Tp&& __t) + explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value)) : value(_VSTD::forward<_Tp>(__t)) {static_assert(!is_reference<_Hp>::value || (is_lvalue_reference<_Hp>::value && @@ -311,19 +316,20 @@ public: >::value)), "Attempted to construct a reference element in a tuple with an rvalue");} - __tuple_leaf(const __tuple_leaf& __t) + __tuple_leaf(const __tuple_leaf& __t) _NOEXCEPT_(is_nothrow_copy_constructible<_Hp>::value) : value(__t.get()) {static_assert(!is_rvalue_reference<_Hp>::value, "Can not copy a tuple with rvalue reference member");} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(const __tuple_leaf<_Ip, _Tp>& __t) + _NOEXCEPT_((is_nothrow_constructible<_Hp, const _Tp&>::value)) : value(__t.get()) {} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf& - operator=(_Tp&& __t) + operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value)) { value = _VSTD::forward<_Tp>(__t); return *this; @@ -336,8 +342,8 @@ public: return 0; } - _LIBCPP_INLINE_VISIBILITY _Hp& get() {return value;} - _LIBCPP_INLINE_VISIBILITY const _Hp& get() const {return value;} + _LIBCPP_INLINE_VISIBILITY _Hp& get() _NOEXCEPT {return value;} + _LIBCPP_INLINE_VISIBILITY const _Hp& get() const _NOEXCEPT {return value;} }; template @@ -347,7 +353,8 @@ class __tuple_leaf<_Ip, _Hp, true> __tuple_leaf& operator=(const __tuple_leaf&); public: - _LIBCPP_INLINE_VISIBILITY __tuple_leaf() {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf() + _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) {} template _LIBCPP_INLINE_VISIBILITY @@ -366,7 +373,7 @@ public: template ::value>::type> _LIBCPP_INLINE_VISIBILITY - explicit __tuple_leaf(_Tp&& __t) + explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value)) : _Hp(_VSTD::forward<_Tp>(__t)) {} template @@ -387,12 +394,13 @@ public: template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(const __tuple_leaf<_Ip, _Tp>& __t) + _NOEXCEPT_((is_nothrow_constructible<_Hp, const _Tp&>::value)) : _Hp(__t.get()) {} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf& - operator=(_Tp&& __t) + operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value)) { _Hp::operator=(_VSTD::forward<_Tp>(__t)); return *this; @@ -406,13 +414,13 @@ public: return 0; } - _LIBCPP_INLINE_VISIBILITY _Hp& get() {return static_cast<_Hp&>(*this);} - _LIBCPP_INLINE_VISIBILITY const _Hp& get() const {return static_cast(*this);} + _LIBCPP_INLINE_VISIBILITY _Hp& get() _NOEXCEPT {return static_cast<_Hp&>(*this);} + _LIBCPP_INLINE_VISIBILITY const _Hp& get() const _NOEXCEPT {return static_cast(*this);} }; template _LIBCPP_INLINE_VISIBILITY -void __swallow(_Tp&&...) {} +void __swallow(_Tp&&...) _NOEXCEPT {} template struct __all; @@ -436,13 +444,19 @@ template struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...> : public __tuple_leaf<_Indx, _Tp>... { + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR __tuple_impl() + _NOEXCEPT_(__all::value...>::value) {} + template _LIBCPP_INLINE_VISIBILITY explicit __tuple_impl(__tuple_indices<_Uf...>, __tuple_types<_Tf...>, __tuple_indices<_Ul...>, __tuple_types<_Tl...>, - _Up&&... __u) : + _Up&&... __u) + _NOEXCEPT_((__all::value...>::value && + __all::value...>::value)) : __tuple_leaf<_Uf, _Tf>(_VSTD::forward<_Up>(__u))..., __tuple_leaf<_Ul, _Tl>()... {} @@ -467,7 +481,8 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...> >::type > _LIBCPP_INLINE_VISIBILITY - __tuple_impl(_Tuple&& __t) + __tuple_impl(_Tuple&& __t) _NOEXCEPT_((__all::type>::type>::value...>::value)) : __tuple_leaf<_Indx, _Tp>(_VSTD::forward::type>::type>(_VSTD::get<_Indx>(__t)))... {} @@ -493,7 +508,8 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...> __tuple_assignable<_Tuple, tuple<_Tp...> >::value, __tuple_impl& >::type - operator=(_Tuple&& __t) + operator=(_Tuple&& __t) _NOEXCEPT_((__all::type>::type>::value...>::value)) { __swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward::type>::type>(_VSTD::get<_Indx>(__t)))...); @@ -502,7 +518,7 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...> _LIBCPP_INLINE_VISIBILITY __tuple_impl& - operator=(const __tuple_impl& __t) + operator=(const __tuple_impl& __t) _NOEXCEPT_((__all::value...>::value)) { __swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast&>(__t).get())...); return *this; @@ -532,7 +548,11 @@ class _LIBCPP_VISIBLE tuple public: _LIBCPP_INLINE_VISIBILITY - explicit tuple(const _Tp& ... __t) + _LIBCPP_CONSTEXPR tuple() + _NOEXCEPT_(__all::value...>::value) {} + + _LIBCPP_INLINE_VISIBILITY + explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all::value...>::value)) : base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices<0>::type(), @@ -568,6 +588,15 @@ public: > _LIBCPP_INLINE_VISIBILITY tuple(_Up&&... __u) + _NOEXCEPT_(( + is_nothrow_constructible< + typename __make_tuple_indices::type, + typename __make_tuple_types::type, + typename __make_tuple_indices::type, + typename __make_tuple_types::type, + _Up... + >::value + )) : base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), @@ -600,6 +629,15 @@ public: _LIBCPP_INLINE_VISIBILITY explicit tuple(_Up&&... __u) + _NOEXCEPT_(( + is_nothrow_constructible< + typename __make_tuple_indices::type, + typename __make_tuple_types::type, + typename __make_tuple_indices::type, + typename __make_tuple_types::type, + _Up... + >::value + )) : base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), @@ -637,7 +675,7 @@ public: >::type = false > _LIBCPP_INLINE_VISIBILITY - tuple(_Tuple&& __t) + tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible::value)) : base_(_VSTD::forward<_Tuple>(__t)) {} template _LIBCPP_INLINE_VISIBILITY explicit - tuple(_Tuple&& __t) + tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible::value)) : base_(_VSTD::forward<_Tuple>(__t)) {} template _LIBCPP_INLINE_VISIBILITY tuple& - operator=(_Tuple&& __t) + operator=(_Tuple&& __t) _NOEXCEPT_((is_nothrow_assignable::value)) { base_.operator=(_VSTD::forward<_Tuple>(__t)); return *this; @@ -687,19 +725,19 @@ class _LIBCPP_VISIBLE tuple<> { public: _LIBCPP_INLINE_VISIBILITY - tuple() {} + _LIBCPP_CONSTEXPR tuple() _NOEXCEPT {} template _LIBCPP_INLINE_VISIBILITY - tuple(allocator_arg_t, const _Alloc&) {} + tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {} template _LIBCPP_INLINE_VISIBILITY - tuple(allocator_arg_t, const _Alloc&, const tuple&) {} + tuple(allocator_arg_t, const _Alloc&, const tuple&) _NOEXCEPT {} template _LIBCPP_INLINE_VISIBILITY - tuple(array<_Up, 0>) {} + tuple(array<_Up, 0>) _NOEXCEPT {} template _LIBCPP_INLINE_VISIBILITY - tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) {} + tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void swap(tuple&) _NOEXCEPT {} }; @@ -750,7 +788,7 @@ get(tuple<_Tp...>&& __t) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY tuple<_Tp&...> -tie(_Tp&... __t) +tie(_Tp&... __t) _NOEXCEPT { return tuple<_Tp&...>(__t...); } @@ -765,7 +803,7 @@ struct __ignore_t namespace { const __ignore_t ignore = __ignore_t(); } -template class reference_wrapper; +template class _LIBCPP_VISIBLE reference_wrapper; template struct ___make_tuple_return @@ -796,7 +834,7 @@ make_tuple(_Tp&&... __t) template inline _LIBCPP_INLINE_VISIBILITY tuple<_Tp&&...> -forward_as_tuple(_Tp&&... __t) +forward_as_tuple(_Tp&&... __t) _NOEXCEPT { return tuple<_Tp&&...>(_VSTD::forward<_Tp>(__t)...); } diff --git a/contrib/libc++/include/type_traits b/contrib/libc++/include/type_traits index a54e25204..f74b77846 100644 --- a/contrib/libc++/include/type_traits +++ b/contrib/libc++/include/type_traits @@ -607,22 +607,33 @@ template struct __libcpp_abstract<_Tp, false> : public false_type {} template struct _LIBCPP_VISIBLE is_abstract : public __libcpp_abstract<_Tp> {}; +// is_base_of + +#ifdef _LIBCP_HAS_IS_BASE_OF + +template +struct _LIBCPP_VISIBLE is_base_of + : public integral_constant {}; + +#else // __has_feature(is_base_of) + +#error is_base_of not implemented. + +#endif // __has_feature(is_base_of) + // is_convertible #if __has_feature(is_convertible_to) template struct _LIBCPP_VISIBLE is_convertible - : public integral_constant {}; + : public integral_constant::value> {}; #else // __has_feature(is_convertible_to) namespace __is_convertible_imp { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -template char __test(const volatile typename remove_reference<_Tp>::type&&); -#else template char __test(_Tp); -#endif template __two __test(...); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template _Tp&& __source(); @@ -657,7 +668,17 @@ template ::value> struct __is_convertible : public integral_constant(__is_convertible_imp::__source<_T1>())) == 1 +#else + sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1 + && !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value + && (!is_const::type>::value + || is_volatile::type>::value) + && (is_same::type, + typename remove_cv::type>::type>::value + || is_base_of::type, _T1>::value)) +#endif > {}; @@ -687,6 +708,7 @@ template struct __is_convertible<_T1, _T2, 2, 0> #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct __is_convertible<_T1, _T1&&, 2, 0> : public true_type {}; #endif +template struct __is_convertible<_T1, _T1&, 2, 0> : public true_type {}; template struct __is_convertible<_T1, _T1*, 2, 0> : public true_type {}; template struct __is_convertible<_T1, _T1*const, 2, 0> : public true_type {}; template struct __is_convertible<_T1, _T1*volatile, 2, 0> : public true_type {}; @@ -718,20 +740,6 @@ template struct _LIBCPP_VISIBLE is_convertible #endif // __has_feature(is_convertible_to) -// is_base_of - -#ifdef _LIBCP_HAS_IS_BASE_OF - -template -struct _LIBCPP_VISIBLE is_base_of - : public integral_constant {}; - -#else // __has_feature(is_base_of) - -#error is_base_of not implemented. - -#endif // __has_feature(is_base_of) - // is_empty #if __has_feature(is_empty) @@ -1609,77 +1617,13 @@ struct __member_pointer_traits template class result_of; +#ifdef _LIBCPP_HAS_NO_VARIADICS + template class __result_of { }; -#ifndef _LIBCPP_HAS_NO_VARIADICS - -template -class __result_of<_Fn(_ArgTypes...), true, false> -{ -public: - typedef decltype(declval<_Fn>()(declval<_ArgTypes>()...)) type; -}; - -template -struct __result_of_mp; - -// member function pointer - -template -struct __result_of_mp<_MP, _Tp, true> - : public common_type::_ReturnType> -{ -}; - -// member data pointer - -template -struct __result_of_mdp; - -template -struct __result_of_mdp<_Rp _Class::*, _Tp, false> -{ - typedef typename __apply_cv()), _Rp>::type&& type; -}; - -template -struct __result_of_mdp<_Rp _Class::*, _Tp, true> -{ - typedef typename __apply_cv<_Tp, _Rp>::type&& type; -}; - -template -struct __result_of_mp<_Rp _Class::*, _Tp, false> - : public __result_of_mdp<_Rp _Class::*, _Tp, - is_base_of<_Class, typename remove_reference<_Tp>::type>::value> -{ -}; - -template -class __result_of<_Fn(_Tp, _ArgTypes...), false, true> // _Fn must be member pointer - : public __result_of_mp::type, - _Tp, - is_member_function_pointer::type>::value> -{ -}; - -// result_of - -template -class _LIBCPP_VISIBLE result_of<_Fn(_ArgTypes...)> - : public __result_of<_Fn(_ArgTypes...), - is_class::type>::value || - is_function::type>::value, - is_member_pointer::type>::value - > -{ -}; - -#else // _LIBCPP_HAS_NO_VARIADICS - template class __result_of<_Fn(), true, false> { @@ -2781,37 +2725,37 @@ struct __check_complete<_Tp&&> template struct __check_complete<_Rp (*)(_Param...)> - : private __check_complete<_Param...> + : private __check_complete<_Rp> { }; template struct __check_complete<_Rp (_Param...)> - : private __check_complete<_Param...> + : private __check_complete<_Rp> { }; template struct __check_complete<_Rp (_Class::*)(_Param...)> - : private __check_complete<_Class, _Param...> + : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) const> - : private __check_complete<_Class, _Param...> + : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) volatile> - : private __check_complete<_Class, _Param...> + : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) const volatile> - : private __check_complete<_Class, _Param...> + : private __check_complete<_Class> { }; @@ -2819,49 +2763,49 @@ struct __check_complete<_Rp (_Class::*)(_Param...) const volatile> template struct __check_complete<_Rp (_Class::*)(_Param...) &> - : private __check_complete<_Class, _Param...> + : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) const&> - : private __check_complete<_Class, _Param...> + : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) volatile&> - : private __check_complete<_Class, _Param...> + : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&> - : private __check_complete<_Class, _Param...> + : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) &&> - : private __check_complete<_Class, _Param...> + : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) const&&> - : private __check_complete<_Class, _Param...> + : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) volatile&&> - : private __check_complete<_Class, _Param...> + : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&> - : private __check_complete<_Class, _Param...> + : private __check_complete<_Class> { }; @@ -2885,11 +2829,13 @@ __invoke(__any, _Args&& ...__args) // bullets 1 and 2 template +_LIBCPP_INLINE_VISIBILITY auto __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...)); template +_LIBCPP_INLINE_VISIBILITY auto __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...)); @@ -2897,11 +2843,13 @@ __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) // bullets 3 and 4 template +_LIBCPP_INLINE_VISIBILITY auto __invoke(_Fp&& __f, _A0&& __a0) -> decltype(_VSTD::forward<_A0>(__a0).*__f); template +_LIBCPP_INLINE_VISIBILITY auto __invoke(_Fp&& __f, _A0&& __a0) -> decltype((*_VSTD::forward<_A0>(__a0)).*__f); @@ -2909,6 +2857,7 @@ __invoke(_Fp&& __f, _A0&& __a0) // bullet 5 template +_LIBCPP_INLINE_VISIBILITY auto __invoke(_Fp&& __f, _Args&& ...__args) -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)); @@ -2917,7 +2866,7 @@ __invoke(_Fp&& __f, _Args&& ...__args) template struct __invokable_imp - : private __check_complete<_Fp, _Args...> + : private __check_complete<_Fp> { typedef decltype( __invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...) @@ -2951,6 +2900,12 @@ struct __invoke_of { }; +template +class _LIBCPP_VISIBLE result_of<_Fp(_Args...)> + : public __invoke_of<_Fp, _Args...> +{ +}; + #endif // _LIBCPP_HAS_NO_VARIADICS template diff --git a/contrib/libc++/include/unordered_map b/contrib/libc++/include/unordered_map index 15243f6fe..cb2ab42ab 100644 --- a/contrib/libc++/include/unordered_map +++ b/contrib/libc++/include/unordered_map @@ -786,42 +786,15 @@ public: const_iterator cend() const _NOEXCEPT {return __table_.end();} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY - pair emplace() - {return __table_.__emplace_unique();} - - template ::value>::type> - _LIBCPP_INLINE_VISIBILITY - pair emplace(_A0&& __a0) - {return __table_.__emplace_unique(_VSTD::forward<_A0>(__a0));} - #ifndef _LIBCPP_HAS_NO_VARIADICS - template ::value>::type> - pair emplace(_A0&& __a0, _Args&&... __args); - -#endif // _LIBCPP_HAS_NO_VARIADICS - - _LIBCPP_INLINE_VISIBILITY - iterator emplace_hint(const_iterator) - {return __table_.__emplace_unique().first;} + template + pair emplace(_Args&&... __args); - template ::value>::type> + template _LIBCPP_INLINE_VISIBILITY - iterator emplace_hint(const_iterator, _A0&& __a0) - {return __table_.__emplace_unique(_VSTD::forward<_A0>(__a0)).first;} - -#ifndef _LIBCPP_HAS_NO_VARIADICS - - template ::value>::type> - _LIBCPP_INLINE_VISIBILITY - iterator emplace_hint(const_iterator, _A0&& __a0, _Args&&... __args) - {return emplace(_VSTD::forward<_A0>(__a0), - _VSTD::forward<_Args>(__args)...).first;} + iterator emplace_hint(const_iterator, _Args&&... __args) + {return emplace(_VSTD::forward<_Args>(__args)...).first;} #endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY @@ -932,14 +905,25 @@ public: private: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + __node_holder __construct_node(); + template + typename enable_if + < + is_constructible::value, + __node_holder + >::type + __construct_node(_A0&& __a0); + template + typename enable_if + < + is_constructible::value, + __node_holder + >::type + __construct_node(_A0&& __a0); #ifndef _LIBCPP_HAS_NO_VARIADICS - template ::value>::type> - __node_holder __construct_node(_A0&& __a0, _Args&&... __args); + template + __node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args); #endif // _LIBCPP_HAS_NO_VARIADICS - template ::value>::type> - __node_holder __construct_node(_A0&& __a0); #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES __node_holder __construct_node(const key_type& __k); #endif @@ -1106,34 +1090,26 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=( #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_VARIADICS template -template ::value>::type - > typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0, - _Args&&... __args) +unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node() { __node_allocator& __na = __table_.__node_alloc(); __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), - _VSTD::forward<_A0>(__a0)); + __node_traits::construct(__na, _VSTD::addressof(__h->__value_)); __h.get_deleter().__first_constructed = true; - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), - _VSTD::forward<_Args>(__args)...); __h.get_deleter().__second_constructed = true; return __h; } -#endif // _LIBCPP_HAS_NO_VARIADICS - template -template ::value>::type - > -typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder +template +typename enable_if +< + is_constructible, _A0>::value, + typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder +>::type unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0) { __node_allocator& __na = __table_.__node_alloc(); @@ -1145,17 +1121,50 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0) return __h; } +template +template +typename enable_if +< + is_constructible<_Key, _A0>::value, + typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder +>::type +unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0) +{ + __node_allocator& __na = __table_.__node_alloc(); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); + __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), + _VSTD::forward<_A0>(__a0)); + __h.get_deleter().__first_constructed = true; + __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second)); + __h.get_deleter().__second_constructed = true; + return __h; +} + #ifndef _LIBCPP_HAS_NO_VARIADICS template -template ::value>::type - > +template +typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder +unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0, + _A1&& __a1, + _Args&&... __args) +{ + __node_allocator& __na = __table_.__node_alloc(); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); + __node_traits::construct(__na, _VSTD::addressof(__h->__value_), + _VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1), + _VSTD::forward<_Args>(__args)...); + __h.get_deleter().__first_constructed = true; + __h.get_deleter().__second_constructed = true; + return __h; +} + +template +template pair::iterator, bool> -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace(_A0&& __a0, _Args&&... __args) +unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace(_Args&&... __args) { - __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0), - _VSTD::forward<_Args>(__args)...); + __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...); pair __r = __table_.__node_insert_unique(__h.get()); if (__r.second) __h.release(); @@ -1409,39 +1418,13 @@ public: const_iterator cend() const _NOEXCEPT {return __table_.end();} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY - iterator emplace() - {return __table_.__emplace_multi();} - - template ::value>::type> - _LIBCPP_INLINE_VISIBILITY - iterator emplace(_A0&& __a0) - {return __table_.__emplace_multi(_VSTD::forward<_A0>(__a0));} - #ifndef _LIBCPP_HAS_NO_VARIADICS - template ::value>::type> - iterator emplace(_A0&& __a0, _Args&&... __args); + template + iterator emplace(_Args&&... __args); -#endif // _LIBCPP_HAS_NO_VARIADICS - - _LIBCPP_INLINE_VISIBILITY - iterator emplace_hint(const_iterator __p) - {return __table_.__emplace_hint_multi(__p.__i_);} - - template ::value>::type> - _LIBCPP_INLINE_VISIBILITY - iterator emplace_hint(const_iterator __p, _A0&& __a0) - {return __table_.__emplace_hint_multi(__p.__i_, _VSTD::forward<_A0>(__a0));} - -#ifndef _LIBCPP_HAS_NO_VARIADICS - - template ::value>::type> - iterator emplace_hint(const_iterator __p, _A0&& __a0, _Args&&... __args); + template + iterator emplace_hint(const_iterator __p, _Args&&... __args); #endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY @@ -1543,14 +1526,27 @@ public: void reserve(size_type __n) {__table_.reserve(__n);} private: -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) - template ::value>::type> - __node_holder __construct_node(_A0&& __a0, _Args&&... __args); - template ::value>::type> - __node_holder __construct_node(_A0&& __a0); -#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + __node_holder __construct_node(); + template + typename enable_if + < + is_constructible::value, + __node_holder + >::type + __construct_node(_A0&& __a0); + template + typename enable_if + < + is_constructible::value, + __node_holder + >::type + __construct_node(_A0&& __a0); +#ifndef _LIBCPP_HAS_NO_VARIADICS + template + __node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args); +#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES }; template @@ -1716,34 +1712,26 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=( #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_VARIADICS template -template ::value>::type - > typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder -unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node( - _A0&& __a0, _Args&&... __args) +unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node() { __node_allocator& __na = __table_.__node_alloc(); __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), - _VSTD::forward<_A0>(__a0)); + __node_traits::construct(__na, _VSTD::addressof(__h->__value_)); __h.get_deleter().__first_constructed = true; - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), - _VSTD::forward<_Args>(__args)...); __h.get_deleter().__second_constructed = true; return __h; } -#endif // _LIBCPP_HAS_NO_VARIADICS - template -template ::value>::type - > -typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder +template +typename enable_if +< + is_constructible, _A0>::value, + typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder +>::type unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0) { __node_allocator& __na = __table_.__node_alloc(); @@ -1755,32 +1743,61 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0 return __h; } +template +template +typename enable_if +< + is_constructible<_Key, _A0>::value, + typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder +>::type +unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0) +{ + __node_allocator& __na = __table_.__node_alloc(); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); + __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), + _VSTD::forward<_A0>(__a0)); + __h.get_deleter().__first_constructed = true; + __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second)); + __h.get_deleter().__second_constructed = true; + return __h; +} + #ifndef _LIBCPP_HAS_NO_VARIADICS template -template ::value>::type - > +template +typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder +unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node( + _A0&& __a0, _A1&& __a1, _Args&&... __args) +{ + __node_allocator& __na = __table_.__node_alloc(); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); + __node_traits::construct(__na, _VSTD::addressof(__h->__value_), + _VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1), + _VSTD::forward<_Args>(__args)...); + __h.get_deleter().__first_constructed = true; + __h.get_deleter().__second_constructed = true; + return __h; +} + +template +template typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator -unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace(_A0&& __a0, _Args&&... __args) +unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace(_Args&&... __args) { - __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0), - _VSTD::forward<_Args>(__args)...); + __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...); iterator __r = __table_.__node_insert_multi(__h.get()); __h.release(); return __r; } template -template ::value>::type - > +template typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace_hint( - const_iterator __p, _A0&& __a0, _Args&&... __args) + const_iterator __p, _Args&&... __args) { - __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0), - _VSTD::forward<_Args>(__args)...); + __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...); iterator __r = __table_.__node_insert_multi(__p.__i_, __h.get()); __h.release(); return __r; diff --git a/contrib/libc++/include/utility b/contrib/libc++/include/utility index 279d42188..df693ec1e 100644 --- a/contrib/libc++/include/utility +++ b/contrib/libc++/include/utility @@ -233,8 +233,8 @@ struct _LIBCPP_VISIBLE pair _LIBCPP_INLINE_VISIBILITY pair(const pair<_U1, _U2>& __p #ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE - ,typename enable_if::value && - is_constructible<_T2, _U2>::value>::type* = 0 + ,typename enable_if::value && + is_convertible::value>::type* = 0 #endif ) : first(__p.first), second(__p.second) {} @@ -261,8 +261,8 @@ struct _LIBCPP_VISIBLE pair #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template ::value && - is_constructible::value>::type> + class = typename enable_if::value && + is_convertible<_U2, second_type>::value>::type> _LIBCPP_INLINE_VISIBILITY pair(_U1&& __u1, _U2&& __u2) : first(_VSTD::forward<_U1>(__u1)), @@ -272,8 +272,8 @@ struct _LIBCPP_VISIBLE pair template _LIBCPP_INLINE_VISIBILITY pair(pair<_U1, _U2>&& __p, - typename enable_if::value && - is_constructible<_T2, _U2>::value>::type* = 0) + typename enable_if::value && + is_convertible<_U2, _T2>::value>::type* = 0) : first(_VSTD::forward<_U1>(__p.first)), second(_VSTD::forward<_U2>(__p.second)) {} @@ -419,7 +419,7 @@ swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -template class reference_wrapper; +template class _LIBCPP_VISIBLE reference_wrapper; template struct ___make_pair_return diff --git a/contrib/libc++/include/valarray b/contrib/libc++/include/valarray index 3c0422a1b..4091d0f71 100644 --- a/contrib/libc++/include/valarray +++ b/contrib/libc++/include/valarray @@ -29,7 +29,7 @@ public: valarray(const value_type& x, size_t n); valarray(const value_type* px, size_t n); valarray(const valarray& v); - valarray(valarray&& v); + valarray(valarray&& v) noexcept; valarray(const slice_array& sa); valarray(const gslice_array& ga); valarray(const mask_array& ma); @@ -39,7 +39,7 @@ public: // assignment: valarray& operator=(const valarray& v); - valarray& operator=(valarray&& v); + valarray& operator=(valarray&& v) noexcept; valarray& operator=(initializer_list il); valarray& operator=(const value_type& x); valarray& operator=(const slice_array& sa); @@ -91,7 +91,7 @@ public: valarray& operator>>=(const valarray& v); // member functions: - void swap(valarray& v); + void swap(valarray& v) noexcept; size_t size() const; @@ -231,7 +231,7 @@ public: indirect_array() = delete; }; -template void swap(valarray& x, valarray& y); +template void swap(valarray& x, valarray& y) noexcept; template valarray operator* (const valarray& x, const valarray& y); template valarray operator* (const valarray& x, const T& y); @@ -354,7 +354,7 @@ template unspecified2 end(const valarray& v); _LIBCPP_BEGIN_NAMESPACE_STD -template class valarray; +template class _LIBCPP_VISIBLE valarray; class _LIBCPP_VISIBLE slice { @@ -381,25 +381,29 @@ public: _LIBCPP_INLINE_VISIBILITY size_t stride() const {return __stride_;} }; -template class slice_array; -class gslice; -template class gslice_array; -template class mask_array; -template class indirect_array; +template class _LIBCPP_VISIBLE slice_array; +class _LIBCPP_VISIBLE gslice; +template class _LIBCPP_VISIBLE gslice_array; +template class _LIBCPP_VISIBLE mask_array; +template class _LIBCPP_VISIBLE indirect_array; template +_LIBCPP_INLINE_VISIBILITY _Tp* begin(valarray<_Tp>& __v); template +_LIBCPP_INLINE_VISIBILITY const _Tp* begin(const valarray<_Tp>& __v); template +_LIBCPP_INLINE_VISIBILITY _Tp* end(valarray<_Tp>& __v); template +_LIBCPP_INLINE_VISIBILITY const _Tp* end(const valarray<_Tp>& __v); @@ -801,7 +805,7 @@ public: valarray(const value_type* __p, size_t __n); valarray(const valarray& __v); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - valarray(valarray&& __v); + valarray(valarray&& __v) _NOEXCEPT; #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS valarray(initializer_list __il); @@ -815,7 +819,7 @@ public: // assignment: valarray& operator=(const valarray& __v); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - valarray& operator=(valarray&& __v); + valarray& operator=(valarray&& __v) _NOEXCEPT; #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS valarray& operator=(initializer_list); @@ -956,7 +960,7 @@ public: operator>>= (const _Expr& __v); // member functions: - void swap(valarray& __v); + void swap(valarray& __v) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY size_t size() const {return static_cast(__end_ - __begin_);} @@ -2709,7 +2713,7 @@ valarray<_Tp>::valarray(const valarray& __v) template inline _LIBCPP_INLINE_VISIBILITY -valarray<_Tp>::valarray(valarray&& __v) +valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT : __begin_(__v.__begin_), __end_(__v.__end_) { @@ -2886,7 +2890,7 @@ valarray<_Tp>::operator=(const valarray& __v) template inline _LIBCPP_INLINE_VISIBILITY valarray<_Tp>& -valarray<_Tp>::operator=(valarray&& __v) +valarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT { resize(0); __begin_ = __v.__begin_; @@ -3446,7 +3450,7 @@ valarray<_Tp>::operator>>=(const _Expr& __v) template inline _LIBCPP_INLINE_VISIBILITY void -valarray<_Tp>::swap(valarray& __v) +valarray<_Tp>::swap(valarray& __v) _NOEXCEPT { _VSTD::swap(__begin_, __v.__begin_); _VSTD::swap(__end_, __v.__end_); @@ -3613,7 +3617,7 @@ valarray<_Tp>::resize(size_t __n, value_type __x) template inline _LIBCPP_INLINE_VISIBILITY void -swap(valarray<_Tp>& __x, valarray<_Tp>& __y) +swap(valarray<_Tp>& __x, valarray<_Tp>& __y) _NOEXCEPT { __x.swap(__y); } diff --git a/contrib/libc++/include/vector b/contrib/libc++/include/vector index 61f0aef74..ee7143555 100644 --- a/contrib/libc++/include/vector +++ b/contrib/libc++/include/vector @@ -1681,8 +1681,9 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) } else { + value_type __tmp(_VSTD::forward<_Args>(__args)...); __move_range(__p, this->__end_, __p + 1); - *__p = value_type(_VSTD::forward<_Args>(__args)...); + *__p = _VSTD::move(__tmp); } } else @@ -1970,6 +1971,7 @@ public: typedef allocator_traits __alloc_traits; typedef typename __alloc_traits::size_type size_type; typedef typename __alloc_traits::difference_type difference_type; + typedef size_type __storage_type; typedef __bit_iterator pointer; typedef __bit_iterator const_pointer; #ifdef _LIBCPP_DEBUG @@ -1991,7 +1993,6 @@ public: typedef _VSTD::reverse_iterator const_reverse_iterator; private: - typedef size_type __storage_type; typedef typename __alloc_traits::template #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES rebind_alloc<__storage_type> @@ -2317,7 +2318,7 @@ private: friend class __bit_const_reference; friend class __bit_iterator; friend class __bit_iterator; - friend class __bit_array; + friend struct __bit_array; friend struct _LIBCPP_VISIBLE hash; }; @@ -2699,6 +2700,7 @@ vector::operator=(vector&& __v) { __move_assign(__v, integral_constant()); + return *this; } template diff --git a/contrib/libc++/src/condition_variable.cpp b/contrib/libc++/src/condition_variable.cpp index b53b836bf..de0f6f47d 100644 --- a/contrib/libc++/src/condition_variable.cpp +++ b/contrib/libc++/src/condition_variable.cpp @@ -20,13 +20,13 @@ condition_variable::~condition_variable() } void -condition_variable::notify_one() +condition_variable::notify_one() _NOEXCEPT { pthread_cond_signal(&__cv_); } void -condition_variable::notify_all() +condition_variable::notify_all() _NOEXCEPT { pthread_cond_broadcast(&__cv_); } @@ -51,10 +51,22 @@ condition_variable::__do_timed_wait(unique_lock& lk, __throw_system_error(EPERM, "condition_variable::timed wait: mutex not locked"); nanoseconds d = tp.time_since_epoch(); + if (d > nanoseconds(0x59682F000000E941)) + d = nanoseconds(0x59682F000000E941); timespec ts; seconds s = duration_cast(d); - ts.tv_sec = static_cast(s.count()); - ts.tv_nsec = static_cast((d - s).count()); + typedef decltype(ts.tv_sec) ts_sec; + _LIBCPP_CONSTEXPR ts_sec ts_sec_max = numeric_limits::max(); + if (s.count() < ts_sec_max) + { + ts.tv_sec = static_cast(s.count()); + ts.tv_nsec = static_cast((d - s).count()); + } + else + { + ts.tv_sec = ts_sec_max; + ts.tv_nsec = giga::num - 1; + } int ec = pthread_cond_timedwait(&__cv_, lk.mutex()->native_handle(), &ts); if (ec != 0 && ec != ETIMEDOUT) __throw_system_error(ec, "condition_variable timed_wait failed"); diff --git a/contrib/libc++/src/debug.cpp b/contrib/libc++/src/debug.cpp index 406b247b7..b8af4dde7 100644 --- a/contrib/libc++/src/debug.cpp +++ b/contrib/libc++/src/debug.cpp @@ -146,7 +146,11 @@ __libcpp_db::__insert_c(void* __c) size_t nc = __next_prime(2*static_cast(__cend_ - __cbeg_) + 1); __c_node** cbeg = (__c_node**)calloc(nc, sizeof(void*)); if (cbeg == nullptr) +#ifndef _LIBCPP_NO_EXCEPTIONS throw bad_alloc(); +#else + abort(); +#endif for (__c_node** p = __cbeg_; p != __cend_; ++p) { __c_node* q = *p; @@ -167,7 +171,11 @@ __libcpp_db::__insert_c(void* __c) __c_node* p = __cbeg_[hc]; __c_node* r = __cbeg_[hc] = (__c_node*)malloc(sizeof(__c_node)); if (__cbeg_[hc] == nullptr) +#ifndef _LIBCPP_NO_EXCEPTIONS throw bad_alloc(); +#else + abort(); +#endif r->__c_ = __c; r->__next_ = p; ++__csz_; @@ -402,7 +410,11 @@ __c_node::__add(__i_node* i) nc = 1; __i_node** beg = (__i_node**)malloc(nc * sizeof(__i_node*)); if (beg == nullptr) +#ifndef _LIBCPP_NO_EXCEPTIONS throw bad_alloc(); +#else + abort(); +#endif if (nc > 1) memcpy(beg, beg_, nc/2*sizeof(__i_node*)); free(beg_); @@ -424,7 +436,11 @@ __libcpp_db::__insert_iterator(void* __i) size_t nc = __next_prime(2*static_cast(__iend_ - __ibeg_) + 1); __i_node** ibeg = (__i_node**)calloc(nc, sizeof(void*)); if (ibeg == nullptr) +#ifndef _LIBCPP_NO_EXCEPTIONS throw bad_alloc(); +#else + abort(); +#endif for (__i_node** p = __ibeg_; p != __iend_; ++p) { __i_node* q = *p; @@ -445,7 +461,11 @@ __libcpp_db::__insert_iterator(void* __i) __i_node* p = __ibeg_[hi]; __i_node* r = __ibeg_[hi] = (__i_node*)malloc(sizeof(__i_node)); if (r == nullptr) +#ifndef _LIBCPP_NO_EXCEPTIONS throw bad_alloc(); +#else + abort(); +#endif ::new(r) __i_node(__i, p, nullptr); ++__isz_; return r; diff --git a/contrib/libc++/src/exception.cpp b/contrib/libc++/src/exception.cpp index 6a5803d37..0dbb6604a 100644 --- a/contrib/libc++/src/exception.cpp +++ b/contrib/libc++/src/exception.cpp @@ -10,6 +10,10 @@ #include "exception" +#ifndef __has_include +#define __has_include(inc) 0 +#endif + #if __APPLE__ #include @@ -23,14 +27,16 @@ #define __terminate_handler __cxxabiapple::__cxa_terminate_handler #define __unexpected_handler __cxxabiapple::__cxa_unexpected_handler #endif // _LIBCPPABI_VERSION -#elif defined(LIBCXXRT) +#elif defined(LIBCXXRT) || __has_include() #include using namespace __cxxabiv1; - #define HAVE_DEPENDENT_EH_ABI 1 -#else // __APPLE__ + #if defined(LIBCXXRT) || defined(_LIBCPPABI_VERSION) + #define HAVE_DEPENDENT_EH_ABI 1 + #endif +#else // __has_include() static std::terminate_handler __terminate_handler; static std::unexpected_handler __unexpected_handler; -#endif // __APPLE__ +#endif // __has_include() namespace std { @@ -50,7 +56,7 @@ get_unexpected() _NOEXCEPT return __sync_fetch_and_add(&__unexpected_handler, (unexpected_handler)0); } -_ATTRIBUTE(noreturn) +_LIBCPP_NORETURN void unexpected() { @@ -71,7 +77,7 @@ get_terminate() _NOEXCEPT return __sync_fetch_and_add(&__terminate_handler, (terminate_handler)0); } -_ATTRIBUTE(noreturn) +_LIBCPP_NORETURN void terminate() _NOEXCEPT { @@ -96,12 +102,9 @@ terminate() _NOEXCEPT #ifndef LIBCXXRT bool uncaught_exception() _NOEXCEPT { -#if __APPLE__ +#if __APPLE__ || defined(_LIBCPPABI_VERSION) // on Darwin, there is a helper function so __cxa_get_globals is private return __cxa_uncaught_exception(); -#elif LIBCXXRT - __cxa_eh_globals * globals = __cxa_get_globals(); - return (globals->uncaughtExceptions != 0); #else // __APPLE__ #warning uncaught_exception not yet implemented ::abort(); @@ -181,7 +184,7 @@ nested_exception::~nested_exception() _NOEXCEPT { } -_ATTRIBUTE(noreturn) +_LIBCPP_NORETURN void nested_exception::rethrow_nested() const { @@ -206,7 +209,7 @@ exception_ptr current_exception() _NOEXCEPT #endif // __APPLE__ } -_ATTRIBUTE(noreturn) +_LIBCPP_NORETURN void rethrow_exception(exception_ptr p) { #if HAVE_DEPENDENT_EH_ABI diff --git a/contrib/libc++/src/future.cpp b/contrib/libc++/src/future.cpp index 29357112d..feb37e42d 100644 --- a/contrib/libc++/src/future.cpp +++ b/contrib/libc++/src/future.cpp @@ -47,7 +47,7 @@ __future_error_category::message(int ev) const } const error_category& -future_category() +future_category() _NOEXCEPT { static __future_error_category __f; return __f; diff --git a/contrib/libc++/src/ios.cpp b/contrib/libc++/src/ios.cpp index 80917a046..732a61bb2 100644 --- a/contrib/libc++/src/ios.cpp +++ b/contrib/libc++/src/ios.cpp @@ -401,7 +401,7 @@ ios_base::move(ios_base& rhs) } void -ios_base::swap(ios_base& rhs) +ios_base::swap(ios_base& rhs) _NOEXCEPT { _VSTD::swap(__fmtflags_, rhs.__fmtflags_); _VSTD::swap(__precision_, rhs.__precision_); diff --git a/contrib/libc++/src/iostream.cpp b/contrib/libc++/src/iostream.cpp index bfb1bfb85..f5b959b4b 100644 --- a/contrib/libc++/src/iostream.cpp +++ b/contrib/libc++/src/iostream.cpp @@ -13,21 +13,21 @@ _LIBCPP_BEGIN_NAMESPACE_STD -alignas (__stdinbuf ) static char __cin [sizeof(__stdinbuf )]; -alignas (__stdoutbuf) static char __cout[sizeof(__stdoutbuf)]; -alignas (__stdoutbuf) static char __cerr[sizeof(__stdoutbuf)]; -alignas (__stdinbuf ) static char __wcin [sizeof(__stdinbuf )]; -alignas (__stdoutbuf) static char __wcout[sizeof(__stdoutbuf)]; -alignas (__stdoutbuf) static char __wcerr[sizeof(__stdoutbuf)]; +_ALIGNAS_TYPE (__stdinbuf ) static char __cin [sizeof(__stdinbuf )]; +_ALIGNAS_TYPE (__stdoutbuf) static char __cout[sizeof(__stdoutbuf)]; +_ALIGNAS_TYPE (__stdoutbuf) static char __cerr[sizeof(__stdoutbuf)]; +_ALIGNAS_TYPE (__stdinbuf ) static char __wcin [sizeof(__stdinbuf )]; +_ALIGNAS_TYPE (__stdoutbuf) static char __wcout[sizeof(__stdoutbuf)]; +_ALIGNAS_TYPE (__stdoutbuf) static char __wcerr[sizeof(__stdoutbuf)]; -alignas (istream) char cin [sizeof(istream)]; -alignas (ostream) char cout[sizeof(ostream)]; -alignas (ostream) char cerr[sizeof(ostream)]; -alignas (ostream) char clog[sizeof(ostream)]; -alignas (wistream) char wcin [sizeof(wistream)]; -alignas (wostream) char wcout[sizeof(wostream)]; -alignas (wostream) char wcerr[sizeof(wostream)]; -alignas (wostream) char wclog[sizeof(wostream)]; +_ALIGNAS_TYPE (istream) char cin [sizeof(istream)]; +_ALIGNAS_TYPE (ostream) char cout[sizeof(ostream)]; +_ALIGNAS_TYPE (ostream) char cerr[sizeof(ostream)]; +_ALIGNAS_TYPE (ostream) char clog[sizeof(ostream)]; +_ALIGNAS_TYPE (wistream) char wcin [sizeof(wistream)]; +_ALIGNAS_TYPE (wostream) char wcout[sizeof(wostream)]; +_ALIGNAS_TYPE (wostream) char wcerr[sizeof(wostream)]; +_ALIGNAS_TYPE (wostream) char wclog[sizeof(wostream)]; ios_base::Init __start_std_streams; diff --git a/contrib/libc++/src/locale.cpp b/contrib/libc++/src/locale.cpp index fe994881d..542c0d7a2 100644 --- a/contrib/libc++/src/locale.cpp +++ b/contrib/libc++/src/locale.cpp @@ -1052,17 +1052,17 @@ ctype_byname::do_is(mask m, char_type c) const #ifdef _LIBCPP_WCTYPE_IS_MASK return static_cast(iswctype_l(c, m, __l)); #else - bool result = true; - if (m & space && !iswspace_l(c, __l)) result = false; - if (m & print && !iswprint_l(c, __l)) result = false; - if (m & cntrl && !iswcntrl_l(c, __l)) result = false; - if (m & upper && !iswupper_l(c, __l)) result = false; - if (m & lower && !iswlower_l(c, __l)) result = false; - if (m & alpha && !iswalpha_l(c, __l)) result = false; - if (m & digit && !iswdigit_l(c, __l)) result = false; - if (m & punct && !iswpunct_l(c, __l)) result = false; - if (m & xdigit && !iswxdigit_l(c, __l)) result = false; - if (m & blank && !iswblank_l(c, __l)) result = false; + bool result = false; + if (m & space) result |= (iswspace_l(c, __l) != 0); + if (m & print) result |= (iswprint_l(c, __l) != 0); + if (m & cntrl) result |= (iswcntrl_l(c, __l) != 0); + if (m & upper) result |= (iswupper_l(c, __l) != 0); + if (m & lower) result |= (iswlower_l(c, __l) != 0); + if (m & alpha) result |= (iswalpha_l(c, __l) != 0); + if (m & digit) result |= (iswdigit_l(c, __l) != 0); + if (m & punct) result |= (iswpunct_l(c, __l) != 0); + if (m & xdigit) result |= (iswxdigit_l(c, __l) != 0); + if (m & blank) result |= (iswblank_l(c, __l) != 0); return result; #endif } @@ -1109,17 +1109,16 @@ ctype_byname::do_scan_is(mask m, const char_type* low, const char_type* if (iswctype_l(*low, m, __l)) break; #else - if (m & space && !iswspace_l(*low, __l)) continue; - if (m & print && !iswprint_l(*low, __l)) continue; - if (m & cntrl && !iswcntrl_l(*low, __l)) continue; - if (m & upper && !iswupper_l(*low, __l)) continue; - if (m & lower && !iswlower_l(*low, __l)) continue; - if (m & alpha && !iswalpha_l(*low, __l)) continue; - if (m & digit && !iswdigit_l(*low, __l)) continue; - if (m & punct && !iswpunct_l(*low, __l)) continue; - if (m & xdigit && !iswxdigit_l(*low, __l)) continue; - if (m & blank && !iswblank_l(*low, __l)) continue; - break; + if (m & space && iswspace_l(*low, __l)) break; + if (m & print && iswprint_l(*low, __l)) break; + if (m & cntrl && iswcntrl_l(*low, __l)) break; + if (m & upper && iswupper_l(*low, __l)) break; + if (m & lower && iswlower_l(*low, __l)) break; + if (m & alpha && iswalpha_l(*low, __l)) break; + if (m & digit && iswdigit_l(*low, __l)) break; + if (m & punct && iswpunct_l(*low, __l)) break; + if (m & xdigit && iswxdigit_l(*low, __l)) break; + if (m & blank && iswblank_l(*low, __l)) break; #endif } return low; @@ -4865,7 +4864,7 @@ template <> void __time_get_storage::init(const ctype& ct) { - tm t; + tm t = {0}; char buf[100]; // __weeks_ for (int i = 0; i < 7; ++i) diff --git a/contrib/libc++/src/memory.cpp b/contrib/libc++/src/memory.cpp index a892e75c8..3884a2b3a 100644 --- a/contrib/libc++/src/memory.cpp +++ b/contrib/libc++/src/memory.cpp @@ -7,7 +7,10 @@ // //===----------------------------------------------------------------------===// +#define _LIBCPP_BUILDING_MEMORY #include "memory" +#include "mutex" +#include "thread" _LIBCPP_BEGIN_NAMESPACE_STD @@ -116,6 +119,53 @@ __shared_weak_count::__get_deleter(const type_info&) const _NOEXCEPT #endif // _LIBCPP_NO_RTTI +#if __has_feature(cxx_atomic) + +static const std::size_t __sp_mut_count = 16; +static mutex mut_back[__sp_mut_count]; + +_LIBCPP_CONSTEXPR __sp_mut::__sp_mut(void* p) _NOEXCEPT + : _(p) +{ +} + +void +__sp_mut::lock() _NOEXCEPT +{ + mutex& m = *static_cast(_); + unsigned count = 0; + while (!m.try_lock()) + { + if (++count > 16) + { + m.lock(); + break; + } + this_thread::yield(); + } +} + +void +__sp_mut::unlock() _NOEXCEPT +{ + static_cast(_)->unlock(); +} + +__sp_mut& +__get_sp_mut(const void* p) +{ + static __sp_mut muts[__sp_mut_count] + { + &mut_back[ 0], &mut_back[ 1], &mut_back[ 2], &mut_back[ 3], + &mut_back[ 4], &mut_back[ 5], &mut_back[ 6], &mut_back[ 7], + &mut_back[ 8], &mut_back[ 9], &mut_back[10], &mut_back[11], + &mut_back[12], &mut_back[13], &mut_back[14], &mut_back[15] + }; + return muts[hash()(p) & (__sp_mut_count-1)]; +} + +#endif // __has_feature(cxx_atomic) + void declare_reachable(void*) { diff --git a/contrib/libc++/src/mutex.cpp b/contrib/libc++/src/mutex.cpp index 9aa051be3..42195aa80 100644 --- a/contrib/libc++/src/mutex.cpp +++ b/contrib/libc++/src/mutex.cpp @@ -7,6 +7,7 @@ // //===----------------------------------------------------------------------===// +#define _LIBCPP_BUILDING_MUTEX #include "mutex" #include "limits" #include "system_error" @@ -32,13 +33,13 @@ mutex::lock() } bool -mutex::try_lock() +mutex::try_lock() _NOEXCEPT { return pthread_mutex_trylock(&__m_) == 0; } void -mutex::unlock() +mutex::unlock() _NOEXCEPT { int ec = pthread_mutex_unlock(&__m_); assert(ec == 0); @@ -90,14 +91,14 @@ recursive_mutex::lock() } void -recursive_mutex::unlock() +recursive_mutex::unlock() _NOEXCEPT { int e = pthread_mutex_unlock(&__m_); assert(e == 0); } bool -recursive_mutex::try_lock() +recursive_mutex::try_lock() _NOEXCEPT { return pthread_mutex_trylock(&__m_) == 0; } @@ -124,7 +125,7 @@ timed_mutex::lock() } bool -timed_mutex::try_lock() +timed_mutex::try_lock() _NOEXCEPT { unique_lock lk(__m_, try_to_lock); if (lk.owns_lock() && !__locked_) @@ -136,7 +137,7 @@ timed_mutex::try_lock() } void -timed_mutex::unlock() +timed_mutex::unlock() _NOEXCEPT { lock_guard _(__m_); __locked_ = false; @@ -175,7 +176,7 @@ recursive_timed_mutex::lock() } bool -recursive_timed_mutex::try_lock() +recursive_timed_mutex::try_lock() _NOEXCEPT { pthread_t id = pthread_self(); unique_lock lk(__m_, try_to_lock); @@ -191,7 +192,7 @@ recursive_timed_mutex::try_lock() } void -recursive_timed_mutex::unlock() +recursive_timed_mutex::unlock() _NOEXCEPT { unique_lock lk(__m_); if (--__count_ == 0) diff --git a/contrib/libc++/src/new.cpp b/contrib/libc++/src/new.cpp index 1fb4b2da4..3ad593a3c 100644 --- a/contrib/libc++/src/new.cpp +++ b/contrib/libc++/src/new.cpp @@ -11,6 +11,10 @@ #include "new" +#ifndef __has_include +#define __has_include(inc) 0 +#endif + #if __APPLE__ #include @@ -21,7 +25,12 @@ #define __new_handler __cxxabiapple::__cxa_new_handler #endif #else // __APPLE__ - static std::new_handler __new_handler; + #if defined(LIBCXXRT) || __has_include() + #include + #endif // __has_include() + #ifndef _LIBCPPABI_VERSION + static std::new_handler __new_handler; + #endif // _LIBCPPABI_VERSION #endif // Implement all new and delete operators as weak definitions diff --git a/contrib/libc++/src/random.cpp b/contrib/libc++/src/random.cpp index 6140b74ec..97a40c509 100644 --- a/contrib/libc++/src/random.cpp +++ b/contrib/libc++/src/random.cpp @@ -40,7 +40,7 @@ random_device::operator()() } double -random_device::entropy() const +random_device::entropy() const _NOEXCEPT { return 0; } diff --git a/contrib/libc++/src/stdexcept.cpp b/contrib/libc++/src/stdexcept.cpp index 9fa4f5931..660ebfe27 100644 --- a/contrib/libc++/src/stdexcept.cpp +++ b/contrib/libc++/src/stdexcept.cpp @@ -16,8 +16,13 @@ #include #include "system_error" -// Use to determine whether we're linking against libc++abi. -#if __has_include() +#ifndef __has_include +#define __has_include(inc) 0 +#endif + +#if __APPLE__ +#include +#elif defined(LIBCXXRT) || __has_include() #include #endif @@ -34,7 +39,7 @@ private: const char* str_; typedef std::size_t unused_t; - typedef std::int32_t count_t; + typedef std::ptrdiff_t count_t; static const std::ptrdiff_t offset = static_cast(2*sizeof(unused_t) + sizeof(count_t)); @@ -72,7 +77,7 @@ __libcpp_nmstr::operator=(const __libcpp_nmstr& s) const char* p = str_; str_ = s.str_; __sync_add_and_fetch(&count(), 1); - if (__sync_add_and_fetch((count_t*)(p-sizeof(count_t)), -1) < 0) + if (__sync_add_and_fetch((count_t*)(p-sizeof(count_t)), count_t(-1)) < 0) delete [] (p-offset); return *this; } @@ -80,7 +85,7 @@ __libcpp_nmstr::operator=(const __libcpp_nmstr& s) inline __libcpp_nmstr::~__libcpp_nmstr() { - if (__sync_add_and_fetch(&count(), -1) < 0) + if (__sync_add_and_fetch(&count(), count_t(-1)) < 0) delete [] (str_ - offset); } diff --git a/contrib/libc++/src/support/win32/locale_win32.cpp b/contrib/libc++/src/support/win32/locale_win32.cpp deleted file mode 100644 index 02b5874e2..000000000 --- a/contrib/libc++/src/support/win32/locale_win32.cpp +++ /dev/null @@ -1,94 +0,0 @@ -// -*- C++ -*- -//===-------------------- support/win32/locale_win32.cpp ------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include "support/win32/locale_win32.h" - -#include // va_start, va_end - -// FIXME: base currently unused. Needs manual work to construct the new locale -locale_t newlocale( int mask, const char * locale, locale_t /*base*/ ) -{ - return _create_locale( mask, locale ); -} -locale_t uselocale( locale_t newloc ) -{ - locale_t old_locale = _get_current_locale(); - // uselocale sets the thread's locale by definition, so unconditionally use thread-local locale - _configthreadlocale( _ENABLE_PER_THREAD_LOCALE ); - // uselocale sets all categories - setlocale( LC_ALL, newloc->locinfo->lc_category[LC_ALL].locale ); - // uselocale returns the old locale_t - return old_locale; -} -lconv *localeconv_l( locale_t loc ) -{ - __locale_raii __current( uselocale(loc), uselocale ); - return localeconv(); -} -size_t mbrlen_l( const char *__restrict__ s, size_t n, - mbstate_t *__restrict__ ps, locale_t loc ) -{ - __locale_raii __current( uselocale(loc), uselocale ); - return mbrlen( s, n, ps ); -} -size_t mbsrtowcs_l( wchar_t *__restrict__ dst, const char **__restrict__ src, - size_t len, mbstate_t *__restrict__ ps, locale_t loc ) -{ - __locale_raii __current( uselocale(loc), uselocale ); - return mbsrtowcs( dst, src, len, ps ); -} -size_t wcrtomb_l( char *__restrict__ s, wchar_t wc, mbstate_t *__restrict__ ps, - locale_t loc ) -{ - __locale_raii __current( uselocale(loc), uselocale ); - return wcrtomb( s, wc, ps ); -} -size_t mbrtowc_l( wchar_t *__restrict__ pwc, const char *__restrict__ s, - size_t n, mbstate_t *__restrict__ ps, locale_t loc ) -{ - __locale_raii __current( uselocale(loc), uselocale ); - return mbrtowc( pwc, s, n, ps ); -} -size_t mbsnrtowcs_l( wchar_t *__restrict__ dst, const char **__restrict__ src, - size_t nms, size_t len, mbstate_t *__restrict__ ps, locale_t loc ) -{ - __locale_raii __current( uselocale(loc), uselocale ); - return mbsnrtowcs( dst, src, nms, len, ps ); -} -size_t wcsnrtombs_l( char *__restrict__ dst, const wchar_t **__restrict__ src, - size_t nwc, size_t len, mbstate_t *__restrict__ ps, locale_t loc ) -{ - __locale_raii __current( uselocale(loc), uselocale ); - return wcsnrtombs( dst, src, nwc, len, ps ); -} -wint_t btowc_l( int c, locale_t loc ) -{ - __locale_raii __current( uselocale(loc), uselocale ); - return btowc( c ); -} -int wctob_l( wint_t c, locale_t loc ) -{ - __locale_raii __current( uselocale(loc), uselocale ); - return wctob( c ); -} - -int asprintf_l( char **ret, locale_t loc, const char *format, ... ) -{ - va_list ap; - va_start( ap, format ); - int result = vasprintf_l( ret, loc, format, ap ); - va_end(ap); - return result; -} -int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap ) -{ - __locale_raii __current( uselocale(loc), uselocale ); - return vasprintf( ret, format, ap ); -} diff --git a/contrib/libc++/src/support/win32/support.cpp b/contrib/libc++/src/support/win32/support.cpp deleted file mode 100644 index 9e85077a7..000000000 --- a/contrib/libc++/src/support/win32/support.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// -*- C++ -*- -//===----------------------- support/win32/support.h ----------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include // va_start, va_end -#include // size_t -#include // malloc -#include // vsprintf, vsnprintf -#include // strcpy, wcsncpy - -int asprintf(char **sptr, const char *__restrict fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - int result = vasprintf(sptr, fmt, ap); - va_end(ap); - return result; -} -int vasprintf( char **sptr, const char *__restrict fmt, va_list ap ) -{ - *sptr = NULL; - int count = vsnprintf( *sptr, 0, fmt, ap ); - if( (count >= 0) && ((*sptr = (char*)malloc(count+1)) != NULL) ) - { - vsprintf( *sptr, fmt, ap ); - sptr[count] = '\0'; - } - - return count; -} - -// FIXME: use wcrtomb and avoid copy -// use mbsrtowcs which is available, first copy first nwc elements of src -size_t mbsnrtowcs( wchar_t *__restrict dst, const char **__restrict src, - size_t nmc, size_t len, mbstate_t *__restrict ps ) -{ - char* local_src = new char[nmc+1]; - char* nmcsrc = local_src; - strncpy( nmcsrc, *src, nmc ); - nmcsrc[nmc] = '\0'; - const size_t result = mbsrtowcs( dst, const_cast(&nmcsrc), len, ps ); - // propagate error - if( nmcsrc == NULL ) - *src = NULL; - delete[] local_src; - return result; -} -// FIXME: use wcrtomb and avoid copy -// use wcsrtombs which is available, first copy first nwc elements of src -size_t wcsnrtombs( char *__restrict dst, const wchar_t **__restrict src, - size_t nwc, size_t len, mbstate_t *__restrict ps ) -{ - wchar_t* local_src = new wchar_t[nwc]; - wchar_t* nwcsrc = local_src; - wcsncpy(nwcsrc, *src, nwc); - nwcsrc[nwc] = '\0'; - const size_t result = wcsrtombs( dst, const_cast(&nwcsrc), len, ps ); - // propogate error - if( nwcsrc == NULL ) - *src = NULL; - delete[] nwcsrc; - return result; -} diff --git a/contrib/libc++/src/thread.cpp b/contrib/libc++/src/thread.cpp index f27136a53..8747adf0b 100644 --- a/contrib/libc++/src/thread.cpp +++ b/contrib/libc++/src/thread.cpp @@ -11,10 +11,15 @@ #include "exception" #include "vector" #include "future" +#include "limits" #include -#if !_WIN32 && !__sun__ +#if !_WIN32 +#if !__sun__ && !__linux__ #include -#endif // _WIN32 +#else +#include +#endif // !__sun__ && !__linux__ +#endif // !_WIN32 _LIBCPP_BEGIN_NAMESPACE_STD @@ -52,7 +57,7 @@ thread::detach() } unsigned -thread::hardware_concurrency() +thread::hardware_concurrency() _NOEXCEPT { #if defined(CTL_HW) && defined(HW_NCPU) unsigned n; @@ -60,6 +65,11 @@ thread::hardware_concurrency() std::size_t s = sizeof(n); sysctl(mib, 2, &n, &s, 0, 0); return n; +#elif defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) && defined(_SC_NPROCESSORS_ONLN) + long result = sysconf(_SC_NPROCESSORS_ONLN); + if (result < 0 || result > UINT_MAX) + result = 0; + return result; #else // defined(CTL_HW) && defined(HW_NCPU) // TODO: grovel through /proc or check cpuid on x86 and similar // instructions on other architectures. @@ -74,11 +84,22 @@ void sleep_for(const chrono::nanoseconds& ns) { using namespace chrono; - if (ns >= nanoseconds::zero()) + if (ns > nanoseconds::zero()) { + seconds s = duration_cast(ns); timespec ts; - ts.tv_sec = static_cast(duration_cast(ns).count()); - ts.tv_nsec = static_cast((ns - seconds(ts.tv_sec)).count()); + typedef decltype(ts.tv_sec) ts_sec; + _LIBCPP_CONSTEXPR ts_sec ts_sec_max = numeric_limits::max(); + if (s.count() < ts_sec_max) + { + ts.tv_sec = static_cast(s.count()); + ts.tv_nsec = static_cast((ns-s).count()); + } + else + { + ts.tv_sec = ts_sec_max; + ts.tv_nsec = giga::num - 1; + } nanosleep(&ts, 0); } } diff --git a/contrib/libc++/src/typeinfo.cpp b/contrib/libc++/src/typeinfo.cpp index cfc64ef57..6bab0771f 100644 --- a/contrib/libc++/src/typeinfo.cpp +++ b/contrib/libc++/src/typeinfo.cpp @@ -7,8 +7,15 @@ // //===----------------------------------------------------------------------===// #include + +#ifndef __has_include +#define __has_include(inc) 0 +#endif + #if __APPLE__ #include +#elif defined(LIBCXXRT) || __has_include() +#include #endif #include "typeinfo" -- 2.45.0