diff --git a/emcc b/emcc index fc580d0f90f82..c9bb4c3786f42 100755 --- a/emcc +++ b/emcc @@ -1102,7 +1102,6 @@ try: o_s = [] libc_files = [ 'dlmalloc.c', - os.path.join('libcxx', 'new.cpp'), os.path.join('libc', 'stdlib', 'getopt_long.c'), os.path.join('libc', 'gen', 'err.c'), os.path.join('libc', 'gen', 'errx.c'), @@ -1144,9 +1143,35 @@ try: def create_libcxx(): if DEBUG: print >> sys.stderr, 'emcc: building libcxx for cache' os = [] - for src in ['algorithm.cpp', 'condition_variable.cpp', 'future.cpp', 'iostream.cpp', 'memory.cpp', 'random.cpp', 'stdexcept.cpp', 'system_error.cpp', 'utility.cpp', 'bind.cpp', 'debug.cpp', 'hash.cpp', 'mutex.cpp', 'string.cpp', 'thread.cpp', 'valarray.cpp', 'chrono.cpp', 'exception.cpp', 'ios.cpp', 'locale.cpp', 'regex.cpp', 'strstream.cpp']: + libcxx_files = [ + 'algorithm.cpp', + 'condition_variable.cpp', + 'future.cpp', + 'iostream.cpp', + 'memory.cpp', + 'random.cpp', + 'stdexcept.cpp', + 'system_error.cpp', + 'utility.cpp', + 'bind.cpp', + 'debug.cpp', + 'hash.cpp', + 'mutex.cpp', + 'string.cpp', + 'thread.cpp', + 'valarray.cpp', + 'chrono.cpp', + 'exception.cpp', + 'ios.cpp', + 'locale.cpp', + 'regex.cpp', + 'strstream.cpp', + 'typeinfo.cpp' + ] + for src in libcxx_files: o = in_temp(src + '.o') - execute([shared.PYTHON, shared.EMXX, shared.path_from_root('system', 'lib', 'libcxx', src), '-o', o], stdout=stdout, stderr=stderr) + srcfile = shared.path_from_root('system', 'lib', 'libcxx', src) + execute([shared.PYTHON, shared.EMXX, srcfile, '-o', o, '-std=c++11'], stdout=stdout, stderr=stderr) os.append(o) shared.Building.link(os, in_temp('libcxx.bc')) return in_temp('libcxx.bc') @@ -1163,9 +1188,20 @@ try: def create_libcxxabi(): if DEBUG: print >> sys.stderr, 'emcc: building libcxxabi for cache' os = [] - for src in ['private_typeinfo.cpp', 'typeinfo.cpp']: + libcxxabi_files = [ + 'abort_message.cpp', + 'private_typeinfo.cpp', + 'typeinfo.cpp', + 'cxa_new_delete.cpp', + 'cxa_handlers.cpp', + 'stdexcept.cpp', + 'exception.cpp', + 'cxa_exception_storage.cpp']: + ] + for src in libcxxabi_files: o = in_temp(src + '.o') - execute([shared.PYTHON, shared.EMXX, shared.path_from_root('system', 'lib', 'libcxxabi', 'src', src), '-o', o], stdout=stdout, stderr=stderr) + srcfile = shared.path_from_root('system', 'lib', 'libcxxabi', 'src', src) + execute([shared.PYTHON, shared.EMXX, srcfile, '-o', o, '-std=c++11'], stdout=stdout, stderr=stderr) os.append(o) shared.Building.link(os, in_temp('libcxxabi.bc')) return in_temp('libcxxabi.bc') diff --git a/src/library.js b/src/library.js index f8ea67baa8ad6..166a015f1083e 100644 --- a/src/library.js +++ b/src/library.js @@ -5082,6 +5082,10 @@ LibraryManager.library = { _ZSt18uncaught_exceptionv: function() { // std::uncaught_exception() return !!__ZSt18uncaught_exceptionv.uncaught_exception; }, + __cxa_uncaught_exception__deps: ['_Zst18uncaught_exceptionv'], + __cxa_uncaught_exception: function() { + return !!__ZSt18uncaught_exceptionv.uncaught_exception; + }, __cxa_call_unexpected: function(exception) { Module.printErr('Unexpected exception thrown, this is not properly supported - aborting'); diff --git a/system/include/libcxx/CREDITS.TXT b/system/include/libcxx/CREDITS.TXT new file mode 100644 index 0000000000000..52948510846d2 --- /dev/null +++ b/system/include/libcxx/CREDITS.TXT @@ -0,0 +1,91 @@ +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: Saleem Abdulrasool +E: compnerd@compnerd.org +D: Minor patches and Linux fixes. + +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: Ruben Van Boxem +E: vanboxem dot ruben at gmail dot com +D: Initial Windows patches. + +N: David Chisnall +E: theraven at theravensnest dot org +D: FreeBSD and Solaris ports, libcxxrt support, some atomics work. + +N: Marshall Clow +E: mclow.lists@gmail.com +E: marshall@idio.com +D: Minor patches and bug fixes. + +N: Google Inc. +D: Copyright owner and contributor of the CityHash algorithm + +N: Howard Hinnant +E: hhinnant@apple.com +D: Architect and primary author of libc++ + +N: Hyeon-bin Jeong +E: tuhertz@gmail.com +D: Minor patches and bug fixes. + +N: Argyrios Kyrtzidis +E: kyrtzidis@apple.com +D: Bug fixes. + +N: Michel Morin +E: mimomorin@gmail.com +D: Minor patches to is_convertible. + +N: Andrew Morrow +E: andrew.c.morrow@gmail.com +D: Minor patches and Linux fixes. + +N: Arvid Picciani +E: aep at exys dot org +D: Minor patches and musl port. + +N: Bjorn Reese +E: breese@users.sourceforge.net +D: Initial regex prototype + +N: Jonathan Sauer +D: Minor patches, mostly related to constexpr + +N: Craig Silverstein +E: csilvers@google.com +D: Implemented Cityhash as the string hash function on 64-bit machines + +N: Richard Smith +D: Minor patches. + +N: Michael van der Westhuizen +E: r1mikey at gmail dot com + +N: Klaas de Vries +E: klaas at klaasgaaf dot nl +D: Minor bug fix. + +N: Zhang Xiongpang +E: zhangxiongpang@gmail.com +D: Minor patches and bug fixes. + +N: Jeffrey Yasskin +E: jyasskin@gmail.com +E: jyasskin@google.com +D: Linux fixes. diff --git a/system/include/libcxx/LICENSE.txt b/system/include/libcxx/LICENSE.txt index 926f067697acd..5ed8ec2248352 100644 --- a/system/include/libcxx/LICENSE.txt +++ b/system/include/libcxx/LICENSE.txt @@ -14,7 +14,7 @@ Full text of the relevant licenses is included below. University of Illinois/NCSA Open Source License -Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT +Copyright (c) 2009-2013 by the contributors listed in CREDITS.TXT All rights reserved. @@ -55,7 +55,7 @@ SOFTWARE. ============================================================================== -Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT +Copyright (c) 2009-2013 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 diff --git a/system/include/libcxx/__bit_reference b/system/include/libcxx/__bit_reference index 53d3c8604beb4..8180295bde316 100644 --- a/system/include/libcxx/__bit_reference +++ b/system/include/libcxx/__bit_reference @@ -14,12 +14,16 @@ #include <__config> #include +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD -template class __bit_iterator; -template class __bit_const_reference; +template class __bit_iterator; +template class __bit_const_reference; template struct __has_storage_type @@ -27,22 +31,22 @@ struct __has_storage_type static const bool value = false; }; -template ::value> +template ::value> class __bit_reference { - typedef typename _C::__storage_type __storage_type; - typedef typename _C::__storage_pointer __storage_pointer; + typedef typename _Cp::__storage_type __storage_type; + typedef typename _Cp::__storage_pointer __storage_pointer; __storage_pointer __seg_; __storage_type __mask_; #if defined(__clang__) - friend typename _C::__self; + friend typename _Cp::__self; #else - friend class _C::__self; + friend class _Cp::__self; #endif - friend class __bit_const_reference<_C>; - friend class __bit_iterator<_C, false>; + friend class __bit_const_reference<_Cp>; + friend class __bit_iterator<_Cp, false>; public: _LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT {return static_cast(*__seg_ & __mask_);} @@ -64,76 +68,77 @@ public: {return operator=(static_cast(__x));} _LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {*__seg_ ^= __mask_;} - _LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, false> operator&() const _NOEXCEPT - {return __bit_iterator<_C, false>(__seg_, static_cast(__ctz(__mask_)));} + _LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, false> operator&() const _NOEXCEPT + {return __bit_iterator<_Cp, false>(__seg_, static_cast(__ctz(__mask_)));} private: _LIBCPP_INLINE_VISIBILITY __bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT : __seg_(__s), __mask_(__m) {} }; -template -class __bit_reference<_C, false> +template +class __bit_reference<_Cp, false> { }; -template +template _LIBCPP_INLINE_VISIBILITY inline void -swap(__bit_reference<_C> __x, __bit_reference<_D> __y) _NOEXCEPT +swap(__bit_reference<_Cp> __x, __bit_reference<_Dp> __y) _NOEXCEPT { bool __t = __x; __x = __y; __y = __t; } -template +template _LIBCPP_INLINE_VISIBILITY inline void -swap(__bit_reference<_C> __x, bool& __y) _NOEXCEPT +swap(__bit_reference<_Cp> __x, bool& __y) _NOEXCEPT { bool __t = __x; __x = __y; __y = __t; } -template +template _LIBCPP_INLINE_VISIBILITY inline void -swap(bool& __x, __bit_reference<_C> __y) _NOEXCEPT +swap(bool& __x, __bit_reference<_Cp> __y) _NOEXCEPT { bool __t = __x; __x = __y; __y = __t; } -template +template class __bit_const_reference { - typedef typename _C::__storage_type __storage_type; - typedef typename _C::__const_storage_pointer __storage_pointer; + typedef typename _Cp::__storage_type __storage_type; + typedef typename _Cp::__const_storage_pointer __storage_pointer; __storage_pointer __seg_; __storage_type __mask_; #if defined(__clang__) - friend typename _C::__self; + friend typename _Cp::__self; #else - friend class _C::__self; + friend class _Cp::__self; #endif - friend class __bit_iterator<_C, true>; + friend class __bit_iterator<_Cp, true>; public: _LIBCPP_INLINE_VISIBILITY - __bit_const_reference(const __bit_reference<_C>& __x) _NOEXCEPT + __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<_C, true> operator&() const _NOEXCEPT - {return __bit_iterator<_C, true>(__seg_, static_cast(__ctz(__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) {} @@ -142,11 +147,11 @@ private: // find -template -__bit_iterator<_C, false> -__find_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n) +template +__bit_iterator<_Cp, _IsConst> +__find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) { - typedef __bit_iterator<_C, 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 @@ -176,11 +181,11 @@ __find_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n) return _It(__first.__seg_, static_cast(__n)); } -template -__bit_iterator<_C, false> -__find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n) +template +__bit_iterator<_Cp, _IsConst> +__find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) { - typedef __bit_iterator<_C, 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 @@ -189,7 +194,7 @@ __find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n) __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; @@ -206,30 +211,30 @@ __find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n) 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<_C, false> -find(__bit_iterator<_C, false> __first, __bit_iterator<_C, 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)); - return __find_bool_false(__first, static_cast(__last - __first)); + if (static_cast(__value_)) + return __find_bool_true(__first, static_cast(__last - __first)); + return __find_bool_false(__first, static_cast(__last - __first)); } // count -template -typename __bit_iterator<_C, false>::difference_type -__count_bool_true(__bit_iterator<_C, false> __first, typename _C::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<_C, 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; @@ -256,11 +261,11 @@ __count_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n) return __r; } -template -typename __bit_iterator<_C, false>::difference_type -__count_bool_false(__bit_iterator<_C, false> __first, typename _C::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<_C, 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; @@ -271,7 +276,7 @@ __count_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n __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_; } @@ -282,28 +287,28 @@ __count_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n 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<_C, false>::difference_type -count(__bit_iterator<_C, false> __first, __bit_iterator<_C, 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)); - return __count_bool_false(__first, static_cast(__last - __first)); + if (static_cast(__value_)) + return __count_bool_true(__first, static_cast(__last - __first)); + return __count_bool_false(__first, static_cast(__last - __first)); } // fill_n -template +template void -__fill_n_false(__bit_iterator<_C, false> __first, typename _C::size_type __n) +__fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) { - typedef __bit_iterator<_C, false> _It; + typedef __bit_iterator<_Cp, false> _It; typedef typename _It::__storage_type __storage_type; static const unsigned __bits_per_word = _It::__bits_per_word; // do first partial word @@ -329,11 +334,11 @@ __fill_n_false(__bit_iterator<_C, false> __first, typename _C::size_type __n) } } -template +template void -__fill_n_true(__bit_iterator<_C, false> __first, typename _C::size_type __n) +__fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) { - typedef __bit_iterator<_C, false> _It; + typedef __bit_iterator<_Cp, false> _It; typedef typename _It::__storage_type __storage_type; static const unsigned __bits_per_word = _It::__bits_per_word; // do first partial word @@ -359,14 +364,14 @@ __fill_n_true(__bit_iterator<_C, false> __first, typename _C::size_type __n) } } -template +template _LIBCPP_INLINE_VISIBILITY inline void -fill_n(__bit_iterator<_C, false> __first, typename _C::size_type __n, bool __value) +fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __value_) { if (__n > 0) { - if (__value) + if (__value_) __fill_n_true(__first, __n); else __fill_n_false(__first, __n); @@ -375,22 +380,22 @@ fill_n(__bit_iterator<_C, false> __first, typename _C::size_type __n, bool __val // fill -template +template inline _LIBCPP_INLINE_VISIBILITY void -fill(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, bool __value) +fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value_) { - _VSTD::fill_n(__first, static_cast(__last - __first), __value); + _VSTD::fill_n(__first, static_cast(__last - __first), __value_); } // copy -template -__bit_iterator<_C, false> -__copy_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, - __bit_iterator<_C, false> __result) +template +__bit_iterator<_Cp, false> +__copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, + __bit_iterator<_Cp, false> __result) { - typedef __bit_iterator<_C, _IsConst> _In; + typedef __bit_iterator<_Cp, _IsConst> _In; typedef typename _In::difference_type difference_type; typedef typename _In::__storage_type __storage_type; static const unsigned __bits_per_word = _In::__bits_per_word; @@ -432,12 +437,12 @@ __copy_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst return __result; } -template -__bit_iterator<_C, false> -__copy_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, - __bit_iterator<_C, false> __result) +template +__bit_iterator<_Cp, false> +__copy_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, + __bit_iterator<_Cp, false> __result) { - typedef __bit_iterator<_C, _IsConst> _In; + typedef __bit_iterator<_Cp, _IsConst> _In; typedef typename _In::difference_type difference_type; typedef typename _In::__storage_type __storage_type; static const unsigned __bits_per_word = _In::__bits_per_word; @@ -510,10 +515,10 @@ __copy_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsCon return __result; } -template +template inline _LIBCPP_INLINE_VISIBILITY -__bit_iterator<_C, false> -copy(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result) +__bit_iterator<_Cp, false> +copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) { if (__first.__ctz_ == __result.__ctz_) return __copy_aligned(__first, __last, __result); @@ -522,12 +527,12 @@ copy(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, // copy_backward -template -__bit_iterator<_C, false> -__copy_backward_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, - __bit_iterator<_C, false> __result) +template +__bit_iterator<_Cp, false> +__copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, + __bit_iterator<_Cp, false> __result) { - typedef __bit_iterator<_C, _IsConst> _In; + typedef __bit_iterator<_Cp, _IsConst> _In; typedef typename _In::difference_type difference_type; typedef typename _In::__storage_type __storage_type; static const unsigned __bits_per_word = _In::__bits_per_word; @@ -569,12 +574,12 @@ __copy_backward_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, return __result; } -template -__bit_iterator<_C, false> -__copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, - __bit_iterator<_C, false> __result) +template +__bit_iterator<_Cp, false> +__copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, + __bit_iterator<_Cp, false> __result) { - typedef __bit_iterator<_C, _IsConst> _In; + typedef __bit_iterator<_Cp, _IsConst> _In; typedef typename _In::difference_type difference_type; typedef typename _In::__storage_type __storage_type; static const unsigned __bits_per_word = _In::__bits_per_word; @@ -633,7 +638,7 @@ __copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_ { __m = ~__storage_type(0) << (__bits_per_word - __n); __storage_type __b = *--__last.__seg_ & __m; - unsigned __clz_r = __bits_per_word - __result.__ctz_; + __clz_r = __bits_per_word - __result.__ctz_; __storage_type __dn = _VSTD::min(__n, static_cast(__result.__ctz_)); __m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r); *__result.__seg_ &= ~__m; @@ -655,10 +660,10 @@ __copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_ return __result; } -template +template inline _LIBCPP_INLINE_VISIBILITY -__bit_iterator<_C, false> -copy_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result) +__bit_iterator<_Cp, false> +copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) { if (__last.__ctz_ == __result.__ctz_) return __copy_backward_aligned(__first, __last, __result); @@ -667,20 +672,20 @@ copy_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> // move -template +template inline _LIBCPP_INLINE_VISIBILITY -__bit_iterator<_C, false> -move(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result) +__bit_iterator<_Cp, false> +move(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) { return _VSTD::copy(__first, __last, __result); } // move_backward -template +template inline _LIBCPP_INLINE_VISIBILITY -__bit_iterator<_C, false> -move_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result) +__bit_iterator<_Cp, false> +move_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) { return _VSTD::copy(__first, __last, __result); } @@ -850,34 +855,33 @@ swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __ // rotate -template +template struct __bit_array { - typedef typename _C::difference_type difference_type; - typedef typename _C::__storage_type __storage_type; - typedef typename _C::iterator iterator; - static const unsigned __bits_per_word = _C::__bits_per_word; - static const unsigned _N = 4; + typedef typename _Cp::difference_type difference_type; + typedef typename _Cp::__storage_type __storage_type; + typedef typename _Cp::iterator iterator; + static const unsigned __bits_per_word = _Cp::__bits_per_word; + static const unsigned _Np = 4; difference_type __size_; - __storage_type __word_[_N]; + __storage_type __word_[_Np]; _LIBCPP_INLINE_VISIBILITY static difference_type capacity() - {return static_cast(_N * __bits_per_word);} + {return static_cast(_Np * __bits_per_word);} _LIBCPP_INLINE_VISIBILITY explicit __bit_array(difference_type __s) : __size_(__s) {} _LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__word_, 0);} _LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(__word_ + __size_ / __bits_per_word, static_cast(__size_ % __bits_per_word));} }; -template -__bit_iterator<_C, false> -rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __bit_iterator<_C, false> __last) +template +__bit_iterator<_Cp, false> +rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle, __bit_iterator<_Cp, false> __last) { - typedef __bit_iterator<_C, false> _I1; + typedef __bit_iterator<_Cp, false> _I1; typedef typename _I1::difference_type difference_type; typedef typename _I1::__storage_type __storage_type; - static const unsigned __bits_per_word = _I1::__bits_per_word; difference_type __d1 = __middle - __first; difference_type __d2 = __last - __middle; _I1 __r = __first + __d2; @@ -885,16 +889,16 @@ rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __ { if (__d1 <= __d2) { - if (__d1 <= __bit_array<_C>::capacity()) + if (__d1 <= __bit_array<_Cp>::capacity()) { - __bit_array<_C> __b(__d1); + __bit_array<_Cp> __b(__d1); _VSTD::copy(__first, __middle, __b.begin()); _VSTD::copy(__b.begin(), __b.end(), _VSTD::copy(__middle, __last, __first)); break; } else { - __bit_iterator<_C, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle); + __bit_iterator<_Cp, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle); __first = __middle; __middle = __mp; __d2 -= __d1; @@ -902,16 +906,16 @@ rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __ } else { - if (__d2 <= __bit_array<_C>::capacity()) + if (__d2 <= __bit_array<_Cp>::capacity()) { - __bit_array<_C> __b(__d2); + __bit_array<_Cp> __b(__d2); _VSTD::copy(__middle, __last, __b.begin()); _VSTD::copy_backward(__b.begin(), __b.end(), _VSTD::copy_backward(__first, __middle, __last)); break; } else { - __bit_iterator<_C, false> __mp = __first + __d2; + __bit_iterator<_Cp, false> __mp = __first + __d2; _VSTD::swap_ranges(__first, __mp, __middle); __first = __mp; __d1 -= __d2; @@ -923,12 +927,12 @@ rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __ // equal -template +template bool -__equal_unaligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __last1, - __bit_iterator<_C, true> __first2) +__equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, + __bit_iterator<_Cp, _IC2> __first2) { - typedef __bit_iterator<_C, 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; @@ -947,11 +951,15 @@ __equal_unaligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __ __storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r); __m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn)); if (__first2.__ctz_ > __first1.__ctz_) + { if ((*__first2.__seg_ & __m) != (__b << (__first2.__ctz_ - __first1.__ctz_))) return false; + } else + { if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ - __first2.__ctz_))) return false; + } __first2.__seg_ += (__ddn + __first2.__ctz_) / __bits_per_word; __first2.__ctz_ = static_cast((__ddn + __first2.__ctz_) % __bits_per_word); __dn -= __ddn; @@ -1001,12 +1009,12 @@ __equal_unaligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __ return true; } -template +template bool -__equal_aligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __last1, - __bit_iterator<_C, true> __first2) +__equal_aligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, + __bit_iterator<_Cp, _IC2> __first2) { - typedef __bit_iterator<_C, 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; @@ -1044,31 +1052,32 @@ __equal_aligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __la return true; } -template +template inline _LIBCPP_INLINE_VISIBILITY bool -equal(__bit_iterator<_C, _IC1> __first1, __bit_iterator<_C, _IC1> __last1, __bit_iterator<_C, _IC2> __first2) +equal(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __bit_iterator<_Cp, _IC2> __first2) { if (__first1.__ctz_ == __first2.__ctz_) return __equal_aligned(__first1, __last1, __first2); return __equal_unaligned(__first1, __last1, __first2); } -template +template class __bit_iterator { public: - typedef typename _C::difference_type difference_type; + typedef typename _Cp::difference_type difference_type; typedef bool value_type; typedef __bit_iterator pointer; - typedef typename conditional<_IsConst, __bit_const_reference<_C>, __bit_reference<_C> >::type reference; + typedef typename conditional<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >::type reference; typedef random_access_iterator_tag iterator_category; private: - typedef typename _C::__storage_type __storage_type; - typedef typename conditional<_IsConst, typename _C::__const_storage_pointer, - typename _C::__storage_pointer>::type __storage_pointer; - static const unsigned __bits_per_word = _C::__bits_per_word; + typedef typename _Cp::__storage_type __storage_type; + typedef typename conditional<_IsConst, typename _Cp::__const_storage_pointer, + typename _Cp::__storage_pointer>::type __storage_pointer; + static const unsigned __bits_per_word = _Cp::__bits_per_word; __storage_pointer __seg_; unsigned __ctz_; @@ -1077,7 +1086,7 @@ public: _LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY - __bit_iterator(const __bit_iterator<_C, false>& __it) _NOEXCEPT + __bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT : __seg_(__it.__seg_), __ctz_(__it.__ctz_) {} _LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT @@ -1185,34 +1194,34 @@ private: : __seg_(__s), __ctz_(__ctz) {} #if defined(__clang__) - friend typename _C::__self; + friend typename _Cp::__self; #else - friend class _C::__self; + friend class _Cp::__self; #endif - friend class __bit_reference<_C>; - friend class __bit_const_reference<_C>; - friend class __bit_iterator<_C, true>; - template friend struct __bit_array; - template friend void __fill_n_false(__bit_iterator<_D, false> __first, typename _D::size_type __n); - template friend void __fill_n_true(__bit_iterator<_D, false> __first, typename _D::size_type __n); - template friend __bit_iterator<_D, false> __copy_aligned(__bit_iterator<_D, _IC> __first, - __bit_iterator<_D, _IC> __last, - __bit_iterator<_D, false> __result); - template friend __bit_iterator<_D, false> __copy_unaligned(__bit_iterator<_D, _IC> __first, - __bit_iterator<_D, _IC> __last, - __bit_iterator<_D, false> __result); - template friend __bit_iterator<_D, false> copy(__bit_iterator<_D, _IC> __first, - __bit_iterator<_D, _IC> __last, - __bit_iterator<_D, false> __result); - template friend __bit_iterator<_D, false> __copy_backward_aligned(__bit_iterator<_D, _IC> __first, - __bit_iterator<_D, _IC> __last, - __bit_iterator<_D, false> __result); - template friend __bit_iterator<_D, false> __copy_backward_unaligned(__bit_iterator<_D, _IC> __first, - __bit_iterator<_D, _IC> __last, - __bit_iterator<_D, false> __result); - template friend __bit_iterator<_D, false> copy_backward(__bit_iterator<_D, _IC> __first, - __bit_iterator<_D, _IC> __last, - __bit_iterator<_D, false> __result); + friend class __bit_reference<_Cp>; + friend class __bit_const_reference<_Cp>; + friend class __bit_iterator<_Cp, true>; + template friend struct __bit_array; + template friend void __fill_n_false(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n); + template friend void __fill_n_true(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n); + template friend __bit_iterator<_Dp, false> __copy_aligned(__bit_iterator<_Dp, _IC> __first, + __bit_iterator<_Dp, _IC> __last, + __bit_iterator<_Dp, false> __result); + template friend __bit_iterator<_Dp, false> __copy_unaligned(__bit_iterator<_Dp, _IC> __first, + __bit_iterator<_Dp, _IC> __last, + __bit_iterator<_Dp, false> __result); + template friend __bit_iterator<_Dp, false> copy(__bit_iterator<_Dp, _IC> __first, + __bit_iterator<_Dp, _IC> __last, + __bit_iterator<_Dp, false> __result); + template friend __bit_iterator<_Dp, false> __copy_backward_aligned(__bit_iterator<_Dp, _IC> __first, + __bit_iterator<_Dp, _IC> __last, + __bit_iterator<_Dp, false> __result); + template friend __bit_iterator<_Dp, false> __copy_backward_unaligned(__bit_iterator<_Dp, _IC> __first, + __bit_iterator<_Dp, _IC> __last, + __bit_iterator<_Dp, false> __result); + template friend __bit_iterator<_Dp, false> copy_backward(__bit_iterator<_Dp, _IC> __first, + __bit_iterator<_Dp, _IC> __last, + __bit_iterator<_Dp, false> __result); template friend __bit_iterator<__C2, false> __swap_ranges_aligned(__bit_iterator<__C1, false>, __bit_iterator<__C1, false>, __bit_iterator<__C2, false>); @@ -1222,22 +1231,26 @@ private: template friend __bit_iterator<__C2, false> swap_ranges(__bit_iterator<__C1, false>, __bit_iterator<__C1, false>, __bit_iterator<__C2, false>); - template friend __bit_iterator<_D, false> rotate(__bit_iterator<_D, false>, - __bit_iterator<_D, false>, - __bit_iterator<_D, false>); - template friend bool __equal_aligned(__bit_iterator<_D, true>, - __bit_iterator<_D, true>, - __bit_iterator<_D, true>); - template friend bool __equal_unaligned(__bit_iterator<_D, true>, - __bit_iterator<_D, true>, - __bit_iterator<_D, true>); - template friend bool equal(__bit_iterator<_D, _IC1>, - __bit_iterator<_D, _IC1>, - __bit_iterator<_D, _IC2>); - template friend __bit_iterator<_D, false> __find_bool_true(__bit_iterator<_D, false>, - typename _D::size_type); - template friend __bit_iterator<_D, false> __find_bool_false(__bit_iterator<_D, false>, - typename _D::size_type); + 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, _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, _IC> __find_bool_true(__bit_iterator<_Dp, _IC>, + typename _Dp::size_type); + 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/system/include/libcxx/__config b/system/include/libcxx/__config index 6f983223a588d..8617b86684244 100644 --- a/system/include/libcxx/__config +++ b/system/include/libcxx/__config @@ -11,9 +11,15 @@ #ifndef _LIBCPP_CONFIG #define _LIBCPP_CONFIG +#if !_MSC_VER // explicit macro necessary because it is only defined below in this file #pragma GCC system_header +#endif + +#ifdef __GNUC__ +#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__) +#endif -#define _LIBCPP_VERSION 1001 +#define _LIBCPP_VERSION 1101 #define _LIBCPP_ABI_VERSION 1 @@ -45,17 +51,38 @@ # define _LIBCPP_LITTLE_ENDIAN 0 # define _LIBCPP_BIG_ENDIAN 1 # endif // _BYTE_ORDER == _LITTLE_ENDIAN +# ifndef __LONG_LONG_SUPPORTED +# define _LIBCPP_HAS_NO_LONG_LONG +# endif // __LONG_LONG_SUPPORTED #endif // __FreeBSD__ #ifdef _WIN32 # 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 +#ifdef __linux__ +# if defined(__GNUC__) && _GNUC_VER >= 403 +# define _LIBCP_HAS_IS_BASE_OF +# endif +#endif + +#ifdef __sun__ +# include +# ifdef _LITTLE_ENDIAN +# define _LIBCPP_LITTLE_ENDIAN 1 +# define _LIBCPP_BIG_ENDIAN 0 +# else +# define _LIBCPP_LITTLE_ENDIAN 0 +# define _LIBCPP_BIG_ENDIAN 1 +# endif +#endif // __sun__ + #if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) # include # if __BYTE_ORDER == __LITTLE_ENDIAN @@ -69,17 +96,49 @@ # endif #endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) -#ifndef _LIBCPP_VISIBILITY_TAG -#define _LIBCPP_VISIBILITY_TAG 1 +#if _WIN32 + +// only really useful for a DLL +#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally... +# ifdef cxx_EXPORTS +# define _LIBCPP_HIDDEN +# define _LIBCPP_VISIBLE __declspec(dllexport) +# else +# define _LIBCPP_HIDDEN +# define _LIBCPP_VISIBLE __declspec(dllimport) +# endif +#else +# define _LIBCPP_HIDDEN +# define _LIBCPP_VISIBLE +#endif + +#ifndef _LIBCPP_INLINE_VISIBILITY +# if _MSC_VER +# define _LIBCPP_INLINE_VISIBILITY __forceinline +# else // MinGW GCC and Clang +# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__)) +# endif +#endif + +#ifndef _LIBCPP_EXCEPTION_ABI +#define _LIBCPP_EXCEPTION_ABI _LIBCPP_VISIBLE +#endif + +#ifndef _LIBCPP_ALWAYS_INLINE +# if _MSC_VER +# define _LIBCPP_ALWAYS_INLINE __forceinline +# endif #endif -#if _LIBCPP_VISIBILITY_TAG +#endif // _WIN32 + +#ifndef _LIBCPP_HIDDEN #define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) +#endif + +#ifndef _LIBCPP_VISIBLE #define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default"))) -#else // _LIBCPP_VISIBILITY_TAG -#define _LIBCPP_HIDDEN -#define _LIBCPP_VISIBLE -#endif // _LIBCPP_VISIBILITY_TAG +#endif #ifndef _LIBCPP_INLINE_VISIBILITY #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) @@ -89,12 +148,24 @@ #define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) #endif +#ifndef _LIBCPP_CANTTHROW #define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__)) +#endif +#ifndef _LIBCPP_ALWAYS_INLINE #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__)) +#endif #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 + #if !__has_feature(cxx_alias_templates) #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES #endif @@ -116,14 +187,18 @@ typedef __char32_t char32_t; #define _LIBCPP_NO_RTTI #endif +#if !(__has_feature(cxx_strong_enums)) +#define _LIBCPP_HAS_NO_STRONG_ENUMS +#endif + #if !(__has_feature(cxx_decltype)) #define _LIBCPP_HAS_NO_DECLTYPE #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 @@ -179,22 +254,18 @@ typedef __char32_t char32_t; #if __has_feature(objc_arc_weak) #define _LIBCPP_HAS_OBJC_ARC_WEAK +#define _LIBCPP_HAS_NO_STRONG_ENUMS #endif -// Inline namespaces are available in Clang regardless of C++ dialect. -#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE { -#define _LIBCPP_END_NAMESPACE_STD } } -#define _VSTD std::_LIBCPP_NAMESPACE - -namespace std { - inline namespace _LIBCPP_NAMESPACE { - } -} - #if !(__has_feature(cxx_constexpr)) #define _LIBCPP_HAS_NO_CONSTEXPR #endif +#if __FreeBSD__ && (__ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L) +#define _LIBCPP_HAS_QUICK_EXIT +#define _LIBCPP_HAS_C11_FEATURES +#endif + #if (__has_feature(cxx_noexcept)) # define _NOEXCEPT noexcept # define _NOEXCEPT_(x) noexcept(x) @@ -207,11 +278,22 @@ namespace std { # define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T) #endif -// end defined(__clang__) +// Inline namespaces are available in Clang regardless of C++ dialect. +#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE { +#define _LIBCPP_END_NAMESPACE_STD } } +#define _VSTD std::_LIBCPP_NAMESPACE + +namespace std { + inline namespace _LIBCPP_NAMESPACE { + } +} #elif defined(__GNUC__) -#define _ATTRIBUTE(x) __attribute__((x)) +#define _ALIGNAS(x) __attribute__((__aligned__(x))) +#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) + +#define _LIBCPP_NORETURN __attribute__((noreturn)) #if !__EXCEPTIONS #define _LIBCPP_NO_EXCEPTIONS @@ -241,15 +323,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 @@ -257,9 +339,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 @@ -275,7 +357,29 @@ namespace _LIBCPP_NAMESPACE { using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); } -#endif // defined(__GNUC__) +#elif defined(_MSC_VER) + +#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER +#define _LIBCPP_HAS_NO_CONSTEXPR +#define _LIBCPP_HAS_NO_UNICODE_CHARS +#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS +#define __alignof__ __alignof +#define _LIBCPP_NORETURN __declspec(noreturn) +#define _ALIGNAS(x) __declspec(align(x)) +#define _LIBCPP_HAS_NO_VARIADICS + +#define _NOEXCEPT throw() +#define _NOEXCEPT_(x) + +#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { +#define _LIBCPP_END_NAMESPACE_STD } +#define _VSTD std + +namespace std { +} + +#endif // __clang__ || __GNUC___ || _MSC_VER #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS typedef unsigned short char16_t; @@ -298,22 +402,56 @@ template struct __static_assert_check {}; #endif #ifdef _LIBCPP_HAS_NO_CONSTEXPR -#define constexpr const +#define _LIBCPP_CONSTEXPR +#else +#define _LIBCPP_CONSTEXPR constexpr +#endif + +#ifdef __GNUC__ +#define _NOALIAS __attribute__((malloc)) +#else +#define _NOALIAS #endif #ifndef __has_feature #define __has_feature(__x) 0 #endif -#if __APPLE__ || __FreeBSD__ -#define _LIBCPP_LOCALE__L_EXTENSIONS 1 +#if __has_feature(cxx_explicit_conversions) +# define _LIBCPP_EXPLICIT explicit +#else +# define _LIBCPP_EXPLICIT #endif -#ifdef __APPLE__ -#define _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS +#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_VISIBLE x { enum __lx +#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \ + __lx __v_; \ + _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \ + _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \ + _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \ + }; +#else // _LIBCPP_HAS_NO_STRONG_ENUMS +#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_VISIBLE x +#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) +#endif // _LIBCPP_HAS_NO_STRONG_ENUMS + +#ifndef _LIBCPP_EXTERN_TEMPLATE +#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__; +#endif + +#if __APPLE__ || __FreeBSD__ || _WIN32 || __sun__ +#define _LIBCPP_LOCALE__L_EXTENSIONS 1 +#endif +#if __FreeBSD__ +#define _DECLARE_C99_LDBL_MATH 1 #endif #if __APPLE__ || __FreeBSD__ +#define _LIBCPP_HAS_DEFAULTRUNELOCALE +#endif + +#if __APPLE__ || __FreeBSD__ || __sun__ #define _LIBCPP_WCTYPE_IS_MASK #endif diff --git a/system/include/libcxx/__debug b/system/include/libcxx/__debug index e807fa5a41b48..4a0e3cecbb620 100644 --- a/system/include/libcxx/__debug +++ b/system/include/libcxx/__debug @@ -60,7 +60,7 @@ struct _LIBCPP_VISIBLE __c_node virtual bool __addable(const void*, ptrdiff_t) const = 0; virtual bool __subscriptable(const void*, ptrdiff_t) const = 0; - _LIBCPP_HIDDEN void __add(__i_node* __i); + void __add(__i_node* __i); _LIBCPP_HIDDEN void __remove(__i_node* __i); }; @@ -83,8 +83,8 @@ _C_node<_Cont>::__dereferenceable(const void* __i) const { typedef typename _Cont::const_iterator iterator; const iterator* __j = static_cast(__i); - _Cont* _C = static_cast<_Cont*>(__c_); - return _C->__dereferenceable(__j); + _Cont* _Cp = static_cast<_Cont*>(__c_); + return _Cp->__dereferenceable(__j); } template @@ -93,8 +93,8 @@ _C_node<_Cont>::__decrementable(const void* __i) const { typedef typename _Cont::const_iterator iterator; const iterator* __j = static_cast(__i); - _Cont* _C = static_cast<_Cont*>(__c_); - return _C->__decrementable(__j); + _Cont* _Cp = static_cast<_Cont*>(__c_); + return _Cp->__decrementable(__j); } template @@ -103,8 +103,8 @@ _C_node<_Cont>::__addable(const void* __i, ptrdiff_t __n) const { typedef typename _Cont::const_iterator iterator; const iterator* __j = static_cast(__i); - _Cont* _C = static_cast<_Cont*>(__c_); - return _C->__addable(__j, __n); + _Cont* _Cp = static_cast<_Cont*>(__c_); + return _Cp->__addable(__j, __n); } template @@ -113,8 +113,8 @@ _C_node<_Cont>::__subscriptable(const void* __i, ptrdiff_t __n) const { typedef typename _Cont::const_iterator iterator; const iterator* __j = static_cast(__i); - _Cont* _C = static_cast<_Cont*>(__c_); - return _C->__subscriptable(__j, __n); + _Cont* _Cp = static_cast<_Cont*>(__c_); + return _Cp->__subscriptable(__j, __n); } class _LIBCPP_VISIBLE __libcpp_db @@ -159,6 +159,7 @@ public: void* __find_c_from_i(void* __i) const; void __invalidate_all(void* __c); __c_node* __find_c_and_lock(void* __c) const; + __c_node* __find_c(void* __c) const; void unlock() const; void swap(void* __c1, void* __c2); diff --git a/system/include/libcxx/__functional_03 b/system/include/libcxx/__functional_03 index e48bb6856de49..3a5397d809d11 100644 --- a/system/include/libcxx/__functional_03 +++ b/system/include/libcxx/__functional_03 @@ -13,7 +13,9 @@ // manual variadic expansion for +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif template class __mem_fn @@ -58,140 +60,140 @@ public: } }; -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R _T::*> -mem_fn(_R _T::* __pm) +__mem_fn<_Rp _Tp::*> +mem_fn(_Rp _Tp::* __pm) { - return __mem_fn<_R _T::*>(__pm); + return __mem_fn<_Rp _Tp::*>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)()> -mem_fn(_R (_T::* __pm)()) +__mem_fn<_Rp (_Tp::*)()> +mem_fn(_Rp (_Tp::* __pm)()) { - return __mem_fn<_R (_T::*)()>(__pm); + return __mem_fn<_Rp (_Tp::*)()>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)(_A0)> -mem_fn(_R (_T::* __pm)(_A0)) +__mem_fn<_Rp (_Tp::*)(_A0)> +mem_fn(_Rp (_Tp::* __pm)(_A0)) { - return __mem_fn<_R (_T::*)(_A0)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)(_A0, _A1)> -mem_fn(_R (_T::* __pm)(_A0, _A1)) +__mem_fn<_Rp (_Tp::*)(_A0, _A1)> +mem_fn(_Rp (_Tp::* __pm)(_A0, _A1)) { - return __mem_fn<_R (_T::*)(_A0, _A1)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)(_A0, _A1, _A2)> -mem_fn(_R (_T::* __pm)(_A0, _A1, _A2)) +__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)> +mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2)) { - return __mem_fn<_R (_T::*)(_A0, _A1, _A2)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)()> -mem_fn(_R (_T::* __pm)() const) +__mem_fn<_Rp (_Tp::*)()> +mem_fn(_Rp (_Tp::* __pm)() const) { - return __mem_fn<_R (_T::*)()>(__pm); + return __mem_fn<_Rp (_Tp::*)()>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)(_A0)> -mem_fn(_R (_T::* __pm)(_A0) const) +__mem_fn<_Rp (_Tp::*)(_A0)> +mem_fn(_Rp (_Tp::* __pm)(_A0) const) { - return __mem_fn<_R (_T::*)(_A0)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)(_A0, _A1)> -mem_fn(_R (_T::* __pm)(_A0, _A1) const) +__mem_fn<_Rp (_Tp::*)(_A0, _A1)> +mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const) { - return __mem_fn<_R (_T::*)(_A0, _A1)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)(_A0, _A1, _A2)> -mem_fn(_R (_T::* __pm)(_A0, _A1, _A2) const) +__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)> +mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const) { - return __mem_fn<_R (_T::*)(_A0, _A1, _A2)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)()> -mem_fn(_R (_T::* __pm)() volatile) +__mem_fn<_Rp (_Tp::*)()> +mem_fn(_Rp (_Tp::* __pm)() volatile) { - return __mem_fn<_R (_T::*)()>(__pm); + return __mem_fn<_Rp (_Tp::*)()>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)(_A0)> -mem_fn(_R (_T::* __pm)(_A0) volatile) +__mem_fn<_Rp (_Tp::*)(_A0)> +mem_fn(_Rp (_Tp::* __pm)(_A0) volatile) { - return __mem_fn<_R (_T::*)(_A0)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)(_A0, _A1)> -mem_fn(_R (_T::* __pm)(_A0, _A1) volatile) +__mem_fn<_Rp (_Tp::*)(_A0, _A1)> +mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) volatile) { - return __mem_fn<_R (_T::*)(_A0, _A1)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)(_A0, _A1, _A2)> -mem_fn(_R (_T::* __pm)(_A0, _A1, _A2) volatile) +__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)> +mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) volatile) { - return __mem_fn<_R (_T::*)(_A0, _A1, _A2)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)()> -mem_fn(_R (_T::* __pm)() const volatile) +__mem_fn<_Rp (_Tp::*)()> +mem_fn(_Rp (_Tp::* __pm)() const volatile) { - return __mem_fn<_R (_T::*)()>(__pm); + return __mem_fn<_Rp (_Tp::*)()>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)(_A0)> -mem_fn(_R (_T::* __pm)(_A0) const volatile) +__mem_fn<_Rp (_Tp::*)(_A0)> +mem_fn(_Rp (_Tp::* __pm)(_A0) const volatile) { - return __mem_fn<_R (_T::*)(_A0)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)(_A0, _A1)> -mem_fn(_R (_T::* __pm)(_A0, _A1) const volatile) +__mem_fn<_Rp (_Tp::*)(_A0, _A1)> +mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const volatile) { - return __mem_fn<_R (_T::*)(_A0, _A1)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)(_A0, _A1, _A2)> -mem_fn(_R (_T::* __pm)(_A0, _A1, _A2) const volatile) +__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)> +mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const volatile) { - return __mem_fn<_R (_T::*)(_A0, _A1, _A2)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm); } // bad_function_call @@ -206,32 +208,32 @@ template class _LIBCPP_VISIBLE function; // undefined namespace __function { -template +template struct __maybe_derive_from_unary_function { }; -template -struct __maybe_derive_from_unary_function<_R(_A1)> - : public unary_function<_A1, _R> +template +struct __maybe_derive_from_unary_function<_Rp(_A1)> + : public unary_function<_A1, _Rp> { }; -template +template struct __maybe_derive_from_binary_function { }; -template -struct __maybe_derive_from_binary_function<_R(_A1, _A2)> - : public binary_function<_A1, _A2, _R> +template +struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)> + : public binary_function<_A1, _A2, _Rp> { }; template class __base; -template -class __base<_R()> +template +class __base<_Rp()> { __base(const __base&); __base& operator=(const __base&); @@ -242,15 +244,15 @@ public: virtual void __clone(__base*) const = 0; virtual void destroy() = 0; virtual void destroy_deallocate() = 0; - virtual _R operator()() = 0; + virtual _Rp operator()() = 0; #ifndef _LIBCPP_NO_RTTI virtual const void* target(const type_info&) const = 0; virtual const std::type_info& target_type() const = 0; #endif // _LIBCPP_NO_RTTI }; -template -class __base<_R(_A0)> +template +class __base<_Rp(_A0)> { __base(const __base&); __base& operator=(const __base&); @@ -261,15 +263,15 @@ public: virtual void __clone(__base*) const = 0; virtual void destroy() = 0; virtual void destroy_deallocate() = 0; - virtual _R operator()(_A0) = 0; + virtual _Rp operator()(_A0) = 0; #ifndef _LIBCPP_NO_RTTI virtual const void* target(const type_info&) const = 0; virtual const std::type_info& target_type() const = 0; #endif // _LIBCPP_NO_RTTI }; -template -class __base<_R(_A0, _A1)> +template +class __base<_Rp(_A0, _A1)> { __base(const __base&); __base& operator=(const __base&); @@ -280,15 +282,15 @@ public: virtual void __clone(__base*) const = 0; virtual void destroy() = 0; virtual void destroy_deallocate() = 0; - virtual _R operator()(_A0, _A1) = 0; + virtual _Rp operator()(_A0, _A1) = 0; #ifndef _LIBCPP_NO_RTTI virtual const void* target(const type_info&) const = 0; virtual const std::type_info& target_type() const = 0; #endif // _LIBCPP_NO_RTTI }; -template -class __base<_R(_A0, _A1, _A2)> +template +class __base<_Rp(_A0, _A1, _A2)> { __base(const __base&); __base& operator=(const __base&); @@ -299,7 +301,7 @@ public: virtual void __clone(__base*) const = 0; virtual void destroy() = 0; virtual void destroy_deallocate() = 0; - virtual _R operator()(_A0, _A1, _A2) = 0; + virtual _Rp operator()(_A0, _A1, _A2) = 0; #ifndef _LIBCPP_NO_RTTI virtual const void* target(const type_info&) const = 0; virtual const std::type_info& target_type() const = 0; @@ -308,360 +310,360 @@ public: template class __func; -template -class __func<_F, _Alloc, _R()> - : public __base<_R()> +template +class __func<_Fp, _Alloc, _Rp()> + : public __base<_Rp()> { - __compressed_pair<_F, _Alloc> __f_; + __compressed_pair<_Fp, _Alloc> __f_; public: - explicit __func(_F __f) : __f_(_VSTD::move(__f)) {} - explicit __func(_F __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {} - virtual __base<_R()>* __clone() const; - virtual void __clone(__base<_R()>*) const; + explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {} + explicit __func(_Fp __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {} + virtual __base<_Rp()>* __clone() const; + virtual void __clone(__base<_Rp()>*) const; virtual void destroy(); virtual void destroy_deallocate(); - virtual _R operator()(); + virtual _Rp operator()(); #ifndef _LIBCPP_NO_RTTI virtual const void* target(const type_info&) const; virtual const std::type_info& target_type() const; #endif // _LIBCPP_NO_RTTI }; -template -__base<_R()>* -__func<_F, _Alloc, _R()>::__clone() const +template +__base<_Rp()>* +__func<_Fp, _Alloc, _Rp()>::__clone() const { - typedef typename _Alloc::template rebind<__func>::other _A; - _A __a(__f_.second()); - typedef __allocator_destructor<_A> _D; - unique_ptr<__func, _D> __hold(__a.allocate(1), _D(__a, 1)); + typedef typename _Alloc::template rebind<__func>::other _Ap; + _Ap __a(__f_.second()); + typedef __allocator_destructor<_Ap> _Dp; + unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); ::new (__hold.get()) __func(__f_.first(), _Alloc(__a)); return __hold.release(); } -template +template void -__func<_F, _Alloc, _R()>::__clone(__base<_R()>* __p) const +__func<_Fp, _Alloc, _Rp()>::__clone(__base<_Rp()>* __p) const { ::new (__p) __func(__f_.first(), __f_.second()); } -template +template void -__func<_F, _Alloc, _R()>::destroy() +__func<_Fp, _Alloc, _Rp()>::destroy() { - __f_.~__compressed_pair<_F, _Alloc>(); + __f_.~__compressed_pair<_Fp, _Alloc>(); } -template +template void -__func<_F, _Alloc, _R()>::destroy_deallocate() +__func<_Fp, _Alloc, _Rp()>::destroy_deallocate() { - typedef typename _Alloc::template rebind<__func>::other _A; - _A __a(__f_.second()); - __f_.~__compressed_pair<_F, _Alloc>(); + typedef typename _Alloc::template rebind<__func>::other _Ap; + _Ap __a(__f_.second()); + __f_.~__compressed_pair<_Fp, _Alloc>(); __a.deallocate(this, 1); } -template -_R -__func<_F, _Alloc, _R()>::operator()() +template +_Rp +__func<_Fp, _Alloc, _Rp()>::operator()() { return __invoke(__f_.first()); } #ifndef _LIBCPP_NO_RTTI -template +template const void* -__func<_F, _Alloc, _R()>::target(const type_info& __ti) const +__func<_Fp, _Alloc, _Rp()>::target(const type_info& __ti) const { - if (__ti == typeid(_F)) + if (__ti == typeid(_Fp)) return &__f_.first(); return (const void*)0; } -template +template const std::type_info& -__func<_F, _Alloc, _R()>::target_type() const +__func<_Fp, _Alloc, _Rp()>::target_type() const { - return typeid(_F); + return typeid(_Fp); } #endif // _LIBCPP_NO_RTTI -template -class __func<_F, _Alloc, _R(_A0)> - : public __base<_R(_A0)> +template +class __func<_Fp, _Alloc, _Rp(_A0)> + : public __base<_Rp(_A0)> { - __compressed_pair<_F, _Alloc> __f_; + __compressed_pair<_Fp, _Alloc> __f_; public: - _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_VSTD::move(__f)) {} - _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f, _Alloc __a) + _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {} + _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {} - virtual __base<_R(_A0)>* __clone() const; - virtual void __clone(__base<_R(_A0)>*) const; + virtual __base<_Rp(_A0)>* __clone() const; + virtual void __clone(__base<_Rp(_A0)>*) const; virtual void destroy(); virtual void destroy_deallocate(); - virtual _R operator()(_A0); + virtual _Rp operator()(_A0); #ifndef _LIBCPP_NO_RTTI virtual const void* target(const type_info&) const; virtual const std::type_info& target_type() const; #endif // _LIBCPP_NO_RTTI }; -template -__base<_R(_A0)>* -__func<_F, _Alloc, _R(_A0)>::__clone() const +template +__base<_Rp(_A0)>* +__func<_Fp, _Alloc, _Rp(_A0)>::__clone() const { - typedef typename _Alloc::template rebind<__func>::other _A; - _A __a(__f_.second()); - typedef __allocator_destructor<_A> _D; - unique_ptr<__func, _D> __hold(__a.allocate(1), _D(__a, 1)); + typedef typename _Alloc::template rebind<__func>::other _Ap; + _Ap __a(__f_.second()); + typedef __allocator_destructor<_Ap> _Dp; + unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); ::new (__hold.get()) __func(__f_.first(), _Alloc(__a)); return __hold.release(); } -template +template void -__func<_F, _Alloc, _R(_A0)>::__clone(__base<_R(_A0)>* __p) const +__func<_Fp, _Alloc, _Rp(_A0)>::__clone(__base<_Rp(_A0)>* __p) const { ::new (__p) __func(__f_.first(), __f_.second()); } -template +template void -__func<_F, _Alloc, _R(_A0)>::destroy() +__func<_Fp, _Alloc, _Rp(_A0)>::destroy() { - __f_.~__compressed_pair<_F, _Alloc>(); + __f_.~__compressed_pair<_Fp, _Alloc>(); } -template +template void -__func<_F, _Alloc, _R(_A0)>::destroy_deallocate() +__func<_Fp, _Alloc, _Rp(_A0)>::destroy_deallocate() { - typedef typename _Alloc::template rebind<__func>::other _A; - _A __a(__f_.second()); - __f_.~__compressed_pair<_F, _Alloc>(); + typedef typename _Alloc::template rebind<__func>::other _Ap; + _Ap __a(__f_.second()); + __f_.~__compressed_pair<_Fp, _Alloc>(); __a.deallocate(this, 1); } -template -_R -__func<_F, _Alloc, _R(_A0)>::operator()(_A0 __a0) +template +_Rp +__func<_Fp, _Alloc, _Rp(_A0)>::operator()(_A0 __a0) { return __invoke(__f_.first(), __a0); } #ifndef _LIBCPP_NO_RTTI -template +template const void* -__func<_F, _Alloc, _R(_A0)>::target(const type_info& __ti) const +__func<_Fp, _Alloc, _Rp(_A0)>::target(const type_info& __ti) const { - if (__ti == typeid(_F)) + if (__ti == typeid(_Fp)) return &__f_.first(); return (const void*)0; } -template +template const std::type_info& -__func<_F, _Alloc, _R(_A0)>::target_type() const +__func<_Fp, _Alloc, _Rp(_A0)>::target_type() const { - return typeid(_F); + return typeid(_Fp); } #endif // _LIBCPP_NO_RTTI -template -class __func<_F, _Alloc, _R(_A0, _A1)> - : public __base<_R(_A0, _A1)> +template +class __func<_Fp, _Alloc, _Rp(_A0, _A1)> + : public __base<_Rp(_A0, _A1)> { - __compressed_pair<_F, _Alloc> __f_; + __compressed_pair<_Fp, _Alloc> __f_; public: - _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_VSTD::move(__f)) {} - _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f, _Alloc __a) + _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {} + _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {} - virtual __base<_R(_A0, _A1)>* __clone() const; - virtual void __clone(__base<_R(_A0, _A1)>*) const; + virtual __base<_Rp(_A0, _A1)>* __clone() const; + virtual void __clone(__base<_Rp(_A0, _A1)>*) const; virtual void destroy(); virtual void destroy_deallocate(); - virtual _R operator()(_A0, _A1); + virtual _Rp operator()(_A0, _A1); #ifndef _LIBCPP_NO_RTTI virtual const void* target(const type_info&) const; virtual const std::type_info& target_type() const; #endif // _LIBCPP_NO_RTTI }; -template -__base<_R(_A0, _A1)>* -__func<_F, _Alloc, _R(_A0, _A1)>::__clone() const +template +__base<_Rp(_A0, _A1)>* +__func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone() const { - typedef typename _Alloc::template rebind<__func>::other _A; - _A __a(__f_.second()); - typedef __allocator_destructor<_A> _D; - unique_ptr<__func, _D> __hold(__a.allocate(1), _D(__a, 1)); + typedef typename _Alloc::template rebind<__func>::other _Ap; + _Ap __a(__f_.second()); + typedef __allocator_destructor<_Ap> _Dp; + unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); ::new (__hold.get()) __func(__f_.first(), _Alloc(__a)); return __hold.release(); } -template +template void -__func<_F, _Alloc, _R(_A0, _A1)>::__clone(__base<_R(_A0, _A1)>* __p) const +__func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone(__base<_Rp(_A0, _A1)>* __p) const { ::new (__p) __func(__f_.first(), __f_.second()); } -template +template void -__func<_F, _Alloc, _R(_A0, _A1)>::destroy() +__func<_Fp, _Alloc, _Rp(_A0, _A1)>::destroy() { - __f_.~__compressed_pair<_F, _Alloc>(); + __f_.~__compressed_pair<_Fp, _Alloc>(); } -template +template void -__func<_F, _Alloc, _R(_A0, _A1)>::destroy_deallocate() +__func<_Fp, _Alloc, _Rp(_A0, _A1)>::destroy_deallocate() { - typedef typename _Alloc::template rebind<__func>::other _A; - _A __a(__f_.second()); - __f_.~__compressed_pair<_F, _Alloc>(); + typedef typename _Alloc::template rebind<__func>::other _Ap; + _Ap __a(__f_.second()); + __f_.~__compressed_pair<_Fp, _Alloc>(); __a.deallocate(this, 1); } -template -_R -__func<_F, _Alloc, _R(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1) +template +_Rp +__func<_Fp, _Alloc, _Rp(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1) { return __invoke(__f_.first(), __a0, __a1); } #ifndef _LIBCPP_NO_RTTI -template +template const void* -__func<_F, _Alloc, _R(_A0, _A1)>::target(const type_info& __ti) const +__func<_Fp, _Alloc, _Rp(_A0, _A1)>::target(const type_info& __ti) const { - if (__ti == typeid(_F)) + if (__ti == typeid(_Fp)) return &__f_.first(); return (const void*)0; } -template +template const std::type_info& -__func<_F, _Alloc, _R(_A0, _A1)>::target_type() const +__func<_Fp, _Alloc, _Rp(_A0, _A1)>::target_type() const { - return typeid(_F); + return typeid(_Fp); } #endif // _LIBCPP_NO_RTTI -template -class __func<_F, _Alloc, _R(_A0, _A1, _A2)> - : public __base<_R(_A0, _A1, _A2)> +template +class __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)> + : public __base<_Rp(_A0, _A1, _A2)> { - __compressed_pair<_F, _Alloc> __f_; + __compressed_pair<_Fp, _Alloc> __f_; public: - _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_VSTD::move(__f)) {} - _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f, _Alloc __a) + _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {} + _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {} - virtual __base<_R(_A0, _A1, _A2)>* __clone() const; - virtual void __clone(__base<_R(_A0, _A1, _A2)>*) const; + virtual __base<_Rp(_A0, _A1, _A2)>* __clone() const; + virtual void __clone(__base<_Rp(_A0, _A1, _A2)>*) const; virtual void destroy(); virtual void destroy_deallocate(); - virtual _R operator()(_A0, _A1, _A2); + virtual _Rp operator()(_A0, _A1, _A2); #ifndef _LIBCPP_NO_RTTI virtual const void* target(const type_info&) const; virtual const std::type_info& target_type() const; #endif // _LIBCPP_NO_RTTI }; -template -__base<_R(_A0, _A1, _A2)>* -__func<_F, _Alloc, _R(_A0, _A1, _A2)>::__clone() const +template +__base<_Rp(_A0, _A1, _A2)>* +__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone() const { - typedef typename _Alloc::template rebind<__func>::other _A; - _A __a(__f_.second()); - typedef __allocator_destructor<_A> _D; - unique_ptr<__func, _D> __hold(__a.allocate(1), _D(__a, 1)); + typedef typename _Alloc::template rebind<__func>::other _Ap; + _Ap __a(__f_.second()); + typedef __allocator_destructor<_Ap> _Dp; + unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); ::new (__hold.get()) __func(__f_.first(), _Alloc(__a)); return __hold.release(); } -template +template void -__func<_F, _Alloc, _R(_A0, _A1, _A2)>::__clone(__base<_R(_A0, _A1, _A2)>* __p) const +__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone(__base<_Rp(_A0, _A1, _A2)>* __p) const { ::new (__p) __func(__f_.first(), __f_.second()); } -template +template void -__func<_F, _Alloc, _R(_A0, _A1, _A2)>::destroy() +__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::destroy() { - __f_.~__compressed_pair<_F, _Alloc>(); + __f_.~__compressed_pair<_Fp, _Alloc>(); } -template +template void -__func<_F, _Alloc, _R(_A0, _A1, _A2)>::destroy_deallocate() +__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::destroy_deallocate() { - typedef typename _Alloc::template rebind<__func>::other _A; - _A __a(__f_.second()); - __f_.~__compressed_pair<_F, _Alloc>(); + typedef typename _Alloc::template rebind<__func>::other _Ap; + _Ap __a(__f_.second()); + __f_.~__compressed_pair<_Fp, _Alloc>(); __a.deallocate(this, 1); } -template -_R -__func<_F, _Alloc, _R(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2) +template +_Rp +__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2) { return __invoke(__f_.first(), __a0, __a1, __a2); } #ifndef _LIBCPP_NO_RTTI -template +template const void* -__func<_F, _Alloc, _R(_A0, _A1, _A2)>::target(const type_info& __ti) const +__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::target(const type_info& __ti) const { - if (__ti == typeid(_F)) + if (__ti == typeid(_Fp)) return &__f_.first(); return (const void*)0; } -template +template const std::type_info& -__func<_F, _Alloc, _R(_A0, _A1, _A2)>::target_type() const +__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::target_type() const { - return typeid(_F); + return typeid(_Fp); } #endif // _LIBCPP_NO_RTTI } // __function -template -class _LIBCPP_VISIBLE function<_R()> +template +class _LIBCPP_VISIBLE function<_Rp()> { - typedef __function::__base<_R()> __base; + typedef __function::__base<_Rp()> __base; aligned_storage<3*sizeof(void*)>::type __buf_; __base* __f_; - template - static bool __not_null(const _F&) {return true;} + template + static bool __not_null(const _Fp&) {return true;} template - static bool __not_null(const function<_R()>& __p) {return __p;} + static bool __not_null(const function<_Rp()>& __p) {return __p;} public: - typedef _R result_type; + typedef _Rp result_type; // 20.7.16.2.1, construct/copy/destroy: _LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {} _LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {} function(const function&); - template - function(_F, - typename enable_if::value>::type* = 0); + template + function(_Fp, + typename enable_if::value>::type* = 0); template _LIBCPP_INLINE_VISIBILITY @@ -671,27 +673,27 @@ public: function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {} template function(allocator_arg_t, const _Alloc&, const function&); - template - function(allocator_arg_t, const _Alloc& __a, _F __f, - typename enable_if::value>::type* = 0); + template + function(allocator_arg_t, const _Alloc& __a, _Fp __f, + typename enable_if::value>::type* = 0); function& operator=(const function&); function& operator=(nullptr_t); - template + template typename enable_if < - !is_integral<_F>::value, + !is_integral<_Fp>::value, function& >::type - operator=(_F); + operator=(_Fp); ~function(); // 20.7.16.2.2, function modifiers: void swap(function&); - template + template _LIBCPP_INLINE_VISIBILITY - void assign(_F __f, const _Alloc& __a) + void assign(_Fp __f, const _Alloc& __a) {function(allocator_arg, __a, __f).swap(*this);} // 20.7.16.2.3, function capacity: @@ -705,18 +707,18 @@ private: bool operator!=(const function<_R2()>&) const;// = delete; public: // 20.7.16.2.4, function invocation: - _R operator()() const; + _Rp operator()() const; #ifndef _LIBCPP_NO_RTTI // 20.7.16.2.5, function target access: const std::type_info& target_type() const; - template _T* target(); - template const _T* target() const; + template _Tp* target(); + template const _Tp* target() const; #endif // _LIBCPP_NO_RTTI }; -template -function<_R()>::function(const function& __f) +template +function<_Rp()>::function(const function& __f) { if (__f.__f_ == 0) __f_ = 0; @@ -729,9 +731,9 @@ function<_R()>::function(const function& __f) __f_ = __f.__f_->__clone(); } -template +template template -function<_R()>::function(allocator_arg_t, const _Alloc&, const function& __f) +function<_Rp()>::function(allocator_arg_t, const _Alloc&, const function& __f) { if (__f.__f_ == 0) __f_ = 0; @@ -744,15 +746,15 @@ function<_R()>::function(allocator_arg_t, const _Alloc&, const function& __f) __f_ = __f.__f_->__clone(); } -template -template -function<_R()>::function(_F __f, - typename enable_if::value>::type*) +template +template +function<_Rp()>::function(_Fp __f, + typename enable_if::value>::type*) : __f_(0) { if (__not_null(__f)) { - typedef __function::__func<_F, allocator<_F>, _R()> _FF; + typedef __function::__func<_Fp, allocator<_Fp>, _Rp()> _FF; if (sizeof(_FF) <= sizeof(__buf_)) { __f_ = (__base*)&__buf_; @@ -760,26 +762,26 @@ function<_R()>::function(_F __f, } else { - typedef allocator<_FF> _A; - _A __a; - typedef __allocator_destructor<_A> _D; - unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1)); - ::new (__hold.get()) _FF(__f, allocator<_F>(__a)); + typedef allocator<_FF> _Ap; + _Ap __a; + typedef __allocator_destructor<_Ap> _Dp; + unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); + ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a)); __f_ = __hold.release(); } } } -template -template -function<_R()>::function(allocator_arg_t, const _Alloc& __a0, _F __f, - typename enable_if::value>::type*) +template +template +function<_Rp()>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f, + typename enable_if::value>::type*) : __f_(0) { typedef allocator_traits<_Alloc> __alloc_traits; if (__not_null(__f)) { - typedef __function::__func<_F, _Alloc, _R()> _FF; + typedef __function::__func<_Fp, _Alloc, _Rp()> _FF; if (sizeof(_FF) <= sizeof(__buf_)) { __f_ = (__base*)&__buf_; @@ -793,27 +795,27 @@ function<_R()>::function(allocator_arg_t, const _Alloc& __a0, _F __f, #else rebind_alloc<_FF>::other #endif - _A; - _A __a(__a0); - typedef __allocator_destructor<_A> _D; - unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1)); + _Ap; + _Ap __a(__a0); + typedef __allocator_destructor<_Ap> _Dp; + unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); ::new (__hold.get()) _FF(__f, _Alloc(__a)); __f_ = __hold.release(); } } } -template -function<_R()>& -function<_R()>::operator=(const function& __f) +template +function<_Rp()>& +function<_Rp()>::operator=(const function& __f) { function(__f).swap(*this); return *this; } -template -function<_R()>& -function<_R()>::operator=(nullptr_t) +template +function<_Rp()>& +function<_Rp()>::operator=(nullptr_t) { if (__f_ == (__base*)&__buf_) __f_->destroy(); @@ -822,21 +824,21 @@ function<_R()>::operator=(nullptr_t) __f_ = 0; } -template -template +template +template typename enable_if < - !is_integral<_F>::value, - function<_R()>& + !is_integral<_Fp>::value, + function<_Rp()>& >::type -function<_R()>::operator=(_F __f) +function<_Rp()>::operator=(_Fp __f) { function(_VSTD::move(__f)).swap(*this); return *this; } -template -function<_R()>::~function() +template +function<_Rp()>::~function() { if (__f_ == (__base*)&__buf_) __f_->destroy(); @@ -844,9 +846,9 @@ function<_R()>::~function() __f_->destroy_deallocate(); } -template +template void -function<_R()>::swap(function& __f) +function<_Rp()>::swap(function& __f) { if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_) { @@ -881,9 +883,9 @@ function<_R()>::swap(function& __f) _VSTD::swap(__f_, __f.__f_); } -template -_R -function<_R()>::operator()() const +template +_Rp +function<_Rp()>::operator()() const { #ifndef _LIBCPP_NO_EXCEPTIONS if (__f_ == 0) @@ -894,76 +896,76 @@ function<_R()>::operator()() const #ifndef _LIBCPP_NO_RTTI -template +template const std::type_info& -function<_R()>::target_type() const +function<_Rp()>::target_type() const { if (__f_ == 0) return typeid(void); return __f_->target_type(); } -template -template -_T* -function<_R()>::target() +template +template +_Tp* +function<_Rp()>::target() { if (__f_ == 0) - return (_T*)0; - return (_T*)__f_->target(typeid(_T)); + return (_Tp*)0; + return (_Tp*)__f_->target(typeid(_Tp)); } -template -template -const _T* -function<_R()>::target() const +template +template +const _Tp* +function<_Rp()>::target() const { if (__f_ == 0) - return (const _T*)0; - return (const _T*)__f_->target(typeid(_T)); + return (const _Tp*)0; + return (const _Tp*)__f_->target(typeid(_Tp)); } #endif // _LIBCPP_NO_RTTI -template -class _LIBCPP_VISIBLE function<_R(_A0)> - : public unary_function<_A0, _R> +template +class _LIBCPP_VISIBLE function<_Rp(_A0)> + : public unary_function<_A0, _Rp> { - typedef __function::__base<_R(_A0)> __base; + typedef __function::__base<_Rp(_A0)> __base; aligned_storage<3*sizeof(void*)>::type __buf_; __base* __f_; - template + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const _F&) {return true;} + static bool __not_null(const _Fp&) {return true;} template _LIBCPP_INLINE_VISIBILITY static bool __not_null(_R2 (*__p)(_B0)) {return __p;} - template + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_C::*__p)()) {return __p;} - template + static bool __not_null(_R2 (_Cp::*__p)()) {return __p;} + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_C::*__p)() const) {return __p;} - template + static bool __not_null(_R2 (_Cp::*__p)() const) {return __p;} + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_C::*__p)() volatile) {return __p;} - template + static bool __not_null(_R2 (_Cp::*__p)() volatile) {return __p;} + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_C::*__p)() const volatile) {return __p;} + static bool __not_null(_R2 (_Cp::*__p)() const volatile) {return __p;} template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const function<_R(_B0)>& __p) {return __p;} + static bool __not_null(const function<_Rp(_B0)>& __p) {return __p;} public: - typedef _R result_type; + typedef _Rp result_type; // 20.7.16.2.1, construct/copy/destroy: _LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {} _LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {} function(const function&); - template - function(_F, - typename enable_if::value>::type* = 0); + template + function(_Fp, + typename enable_if::value>::type* = 0); template _LIBCPP_INLINE_VISIBILITY @@ -973,27 +975,27 @@ public: function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {} template function(allocator_arg_t, const _Alloc&, const function&); - template - function(allocator_arg_t, const _Alloc& __a, _F __f, - typename enable_if::value>::type* = 0); + template + function(allocator_arg_t, const _Alloc& __a, _Fp __f, + typename enable_if::value>::type* = 0); function& operator=(const function&); function& operator=(nullptr_t); - template + template typename enable_if < - !is_integral<_F>::value, + !is_integral<_Fp>::value, function& >::type - operator=(_F); + operator=(_Fp); ~function(); // 20.7.16.2.2, function modifiers: void swap(function&); - template + template _LIBCPP_INLINE_VISIBILITY - void assign(_F __f, const _Alloc& __a) + void assign(_Fp __f, const _Alloc& __a) {function(allocator_arg, __a, __f).swap(*this);} // 20.7.16.2.3, function capacity: @@ -1007,18 +1009,18 @@ private: bool operator!=(const function<_R2(_B0)>&) const;// = delete; public: // 20.7.16.2.4, function invocation: - _R operator()(_A0) const; + _Rp operator()(_A0) const; #ifndef _LIBCPP_NO_RTTI // 20.7.16.2.5, function target access: const std::type_info& target_type() const; - template _T* target(); - template const _T* target() const; + template _Tp* target(); + template const _Tp* target() const; #endif // _LIBCPP_NO_RTTI }; -template -function<_R(_A0)>::function(const function& __f) +template +function<_Rp(_A0)>::function(const function& __f) { if (__f.__f_ == 0) __f_ = 0; @@ -1031,9 +1033,9 @@ function<_R(_A0)>::function(const function& __f) __f_ = __f.__f_->__clone(); } -template +template template -function<_R(_A0)>::function(allocator_arg_t, const _Alloc&, const function& __f) +function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc&, const function& __f) { if (__f.__f_ == 0) __f_ = 0; @@ -1046,15 +1048,15 @@ function<_R(_A0)>::function(allocator_arg_t, const _Alloc&, const function& __f) __f_ = __f.__f_->__clone(); } -template -template -function<_R(_A0)>::function(_F __f, - typename enable_if::value>::type*) +template +template +function<_Rp(_A0)>::function(_Fp __f, + typename enable_if::value>::type*) : __f_(0) { if (__not_null(__f)) { - typedef __function::__func<_F, allocator<_F>, _R(_A0)> _FF; + typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) { __f_ = (__base*)&__buf_; @@ -1062,26 +1064,26 @@ function<_R(_A0)>::function(_F __f, } else { - typedef allocator<_FF> _A; - _A __a; - typedef __allocator_destructor<_A> _D; - unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1)); - ::new (__hold.get()) _FF(__f, allocator<_F>(__a)); + typedef allocator<_FF> _Ap; + _Ap __a; + typedef __allocator_destructor<_Ap> _Dp; + unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); + ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a)); __f_ = __hold.release(); } } } -template -template -function<_R(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _F __f, - typename enable_if::value>::type*) +template +template +function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f, + typename enable_if::value>::type*) : __f_(0) { typedef allocator_traits<_Alloc> __alloc_traits; if (__not_null(__f)) { - typedef __function::__func<_F, _Alloc, _R(_A0)> _FF; + typedef __function::__func<_Fp, _Alloc, _Rp(_A0)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) { __f_ = (__base*)&__buf_; @@ -1095,27 +1097,27 @@ function<_R(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _F __f, #else rebind_alloc<_FF>::other #endif - _A; - _A __a(__a0); - typedef __allocator_destructor<_A> _D; - unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1)); + _Ap; + _Ap __a(__a0); + typedef __allocator_destructor<_Ap> _Dp; + unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); ::new (__hold.get()) _FF(__f, _Alloc(__a)); __f_ = __hold.release(); } } } -template -function<_R(_A0)>& -function<_R(_A0)>::operator=(const function& __f) +template +function<_Rp(_A0)>& +function<_Rp(_A0)>::operator=(const function& __f) { function(__f).swap(*this); return *this; } -template -function<_R(_A0)>& -function<_R(_A0)>::operator=(nullptr_t) +template +function<_Rp(_A0)>& +function<_Rp(_A0)>::operator=(nullptr_t) { if (__f_ == (__base*)&__buf_) __f_->destroy(); @@ -1124,21 +1126,21 @@ function<_R(_A0)>::operator=(nullptr_t) __f_ = 0; } -template -template +template +template typename enable_if < - !is_integral<_F>::value, - function<_R(_A0)>& + !is_integral<_Fp>::value, + function<_Rp(_A0)>& >::type -function<_R(_A0)>::operator=(_F __f) +function<_Rp(_A0)>::operator=(_Fp __f) { function(_VSTD::move(__f)).swap(*this); return *this; } -template -function<_R(_A0)>::~function() +template +function<_Rp(_A0)>::~function() { if (__f_ == (__base*)&__buf_) __f_->destroy(); @@ -1146,9 +1148,9 @@ function<_R(_A0)>::~function() __f_->destroy_deallocate(); } -template +template void -function<_R(_A0)>::swap(function& __f) +function<_Rp(_A0)>::swap(function& __f) { if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_) { @@ -1183,9 +1185,9 @@ function<_R(_A0)>::swap(function& __f) _VSTD::swap(__f_, __f.__f_); } -template -_R -function<_R(_A0)>::operator()(_A0 __a0) const +template +_Rp +function<_Rp(_A0)>::operator()(_A0 __a0) const { #ifndef _LIBCPP_NO_EXCEPTIONS if (__f_ == 0) @@ -1196,76 +1198,76 @@ function<_R(_A0)>::operator()(_A0 __a0) const #ifndef _LIBCPP_NO_RTTI -template +template const std::type_info& -function<_R(_A0)>::target_type() const +function<_Rp(_A0)>::target_type() const { if (__f_ == 0) return typeid(void); return __f_->target_type(); } -template -template -_T* -function<_R(_A0)>::target() +template +template +_Tp* +function<_Rp(_A0)>::target() { if (__f_ == 0) - return (_T*)0; - return (_T*)__f_->target(typeid(_T)); + return (_Tp*)0; + return (_Tp*)__f_->target(typeid(_Tp)); } -template -template -const _T* -function<_R(_A0)>::target() const +template +template +const _Tp* +function<_Rp(_A0)>::target() const { if (__f_ == 0) - return (const _T*)0; - return (const _T*)__f_->target(typeid(_T)); + return (const _Tp*)0; + return (const _Tp*)__f_->target(typeid(_Tp)); } #endif // _LIBCPP_NO_RTTI -template -class _LIBCPP_VISIBLE function<_R(_A0, _A1)> - : public binary_function<_A0, _A1, _R> +template +class _LIBCPP_VISIBLE function<_Rp(_A0, _A1)> + : public binary_function<_A0, _A1, _Rp> { - typedef __function::__base<_R(_A0, _A1)> __base; + typedef __function::__base<_Rp(_A0, _A1)> __base; aligned_storage<3*sizeof(void*)>::type __buf_; __base* __f_; - template + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const _F&) {return true;} + static bool __not_null(const _Fp&) {return true;} template _LIBCPP_INLINE_VISIBILITY static bool __not_null(_R2 (*__p)(_B0, _B1)) {return __p;} - template + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_C::*__p)(_B1)) {return __p;} - template + static bool __not_null(_R2 (_Cp::*__p)(_B1)) {return __p;} + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_C::*__p)(_B1) const) {return __p;} - template + static bool __not_null(_R2 (_Cp::*__p)(_B1) const) {return __p;} + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_C::*__p)(_B1) volatile) {return __p;} - template + static bool __not_null(_R2 (_Cp::*__p)(_B1) volatile) {return __p;} + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_C::*__p)(_B1) const volatile) {return __p;} + static bool __not_null(_R2 (_Cp::*__p)(_B1) const volatile) {return __p;} template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const function<_R(_B0, _B1)>& __p) {return __p;} + static bool __not_null(const function<_Rp(_B0, _B1)>& __p) {return __p;} public: - typedef _R result_type; + typedef _Rp result_type; // 20.7.16.2.1, construct/copy/destroy: _LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {} _LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {} function(const function&); - template - function(_F, - typename enable_if::value>::type* = 0); + template + function(_Fp, + typename enable_if::value>::type* = 0); template _LIBCPP_INLINE_VISIBILITY @@ -1275,27 +1277,27 @@ public: function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {} template function(allocator_arg_t, const _Alloc&, const function&); - template - function(allocator_arg_t, const _Alloc& __a, _F __f, - typename enable_if::value>::type* = 0); + template + function(allocator_arg_t, const _Alloc& __a, _Fp __f, + typename enable_if::value>::type* = 0); function& operator=(const function&); function& operator=(nullptr_t); - template + template typename enable_if < - !is_integral<_F>::value, + !is_integral<_Fp>::value, function& >::type - operator=(_F); + operator=(_Fp); ~function(); // 20.7.16.2.2, function modifiers: void swap(function&); - template + template _LIBCPP_INLINE_VISIBILITY - void assign(_F __f, const _Alloc& __a) + void assign(_Fp __f, const _Alloc& __a) {function(allocator_arg, __a, __f).swap(*this);} // 20.7.16.2.3, function capacity: @@ -1309,18 +1311,18 @@ private: bool operator!=(const function<_R2(_B0, _B1)>&) const;// = delete; public: // 20.7.16.2.4, function invocation: - _R operator()(_A0, _A1) const; + _Rp operator()(_A0, _A1) const; #ifndef _LIBCPP_NO_RTTI // 20.7.16.2.5, function target access: const std::type_info& target_type() const; - template _T* target(); - template const _T* target() const; + template _Tp* target(); + template const _Tp* target() const; #endif // _LIBCPP_NO_RTTI }; -template -function<_R(_A0, _A1)>::function(const function& __f) +template +function<_Rp(_A0, _A1)>::function(const function& __f) { if (__f.__f_ == 0) __f_ = 0; @@ -1333,9 +1335,9 @@ function<_R(_A0, _A1)>::function(const function& __f) __f_ = __f.__f_->__clone(); } -template +template template -function<_R(_A0, _A1)>::function(allocator_arg_t, const _Alloc&, const function& __f) +function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc&, const function& __f) { if (__f.__f_ == 0) __f_ = 0; @@ -1348,15 +1350,15 @@ function<_R(_A0, _A1)>::function(allocator_arg_t, const _Alloc&, const function& __f_ = __f.__f_->__clone(); } -template -template -function<_R(_A0, _A1)>::function(_F __f, - typename enable_if::value>::type*) +template +template +function<_Rp(_A0, _A1)>::function(_Fp __f, + typename enable_if::value>::type*) : __f_(0) { if (__not_null(__f)) { - typedef __function::__func<_F, allocator<_F>, _R(_A0, _A1)> _FF; + typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) { __f_ = (__base*)&__buf_; @@ -1364,26 +1366,26 @@ function<_R(_A0, _A1)>::function(_F __f, } else { - typedef allocator<_FF> _A; - _A __a; - typedef __allocator_destructor<_A> _D; - unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1)); - ::new (__hold.get()) _FF(__f, allocator<_F>(__a)); + typedef allocator<_FF> _Ap; + _Ap __a; + typedef __allocator_destructor<_Ap> _Dp; + unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); + ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a)); __f_ = __hold.release(); } } } -template -template -function<_R(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _F __f, - typename enable_if::value>::type*) +template +template +function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f, + typename enable_if::value>::type*) : __f_(0) { typedef allocator_traits<_Alloc> __alloc_traits; if (__not_null(__f)) { - typedef __function::__func<_F, _Alloc, _R(_A0, _A1)> _FF; + typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) { __f_ = (__base*)&__buf_; @@ -1397,27 +1399,27 @@ function<_R(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _F __f, #else rebind_alloc<_FF>::other #endif - _A; - _A __a(__a0); - typedef __allocator_destructor<_A> _D; - unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1)); + _Ap; + _Ap __a(__a0); + typedef __allocator_destructor<_Ap> _Dp; + unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); ::new (__hold.get()) _FF(__f, _Alloc(__a)); __f_ = __hold.release(); } } } -template -function<_R(_A0, _A1)>& -function<_R(_A0, _A1)>::operator=(const function& __f) +template +function<_Rp(_A0, _A1)>& +function<_Rp(_A0, _A1)>::operator=(const function& __f) { function(__f).swap(*this); return *this; } -template -function<_R(_A0, _A1)>& -function<_R(_A0, _A1)>::operator=(nullptr_t) +template +function<_Rp(_A0, _A1)>& +function<_Rp(_A0, _A1)>::operator=(nullptr_t) { if (__f_ == (__base*)&__buf_) __f_->destroy(); @@ -1426,21 +1428,21 @@ function<_R(_A0, _A1)>::operator=(nullptr_t) __f_ = 0; } -template -template +template +template typename enable_if < - !is_integral<_F>::value, - function<_R(_A0, _A1)>& + !is_integral<_Fp>::value, + function<_Rp(_A0, _A1)>& >::type -function<_R(_A0, _A1)>::operator=(_F __f) +function<_Rp(_A0, _A1)>::operator=(_Fp __f) { function(_VSTD::move(__f)).swap(*this); return *this; } -template -function<_R(_A0, _A1)>::~function() +template +function<_Rp(_A0, _A1)>::~function() { if (__f_ == (__base*)&__buf_) __f_->destroy(); @@ -1448,9 +1450,9 @@ function<_R(_A0, _A1)>::~function() __f_->destroy_deallocate(); } -template +template void -function<_R(_A0, _A1)>::swap(function& __f) +function<_Rp(_A0, _A1)>::swap(function& __f) { if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_) { @@ -1485,9 +1487,9 @@ function<_R(_A0, _A1)>::swap(function& __f) _VSTD::swap(__f_, __f.__f_); } -template -_R -function<_R(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1) const +template +_Rp +function<_Rp(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1) const { #ifndef _LIBCPP_NO_EXCEPTIONS if (__f_ == 0) @@ -1498,75 +1500,75 @@ function<_R(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1) const #ifndef _LIBCPP_NO_RTTI -template +template const std::type_info& -function<_R(_A0, _A1)>::target_type() const +function<_Rp(_A0, _A1)>::target_type() const { if (__f_ == 0) return typeid(void); return __f_->target_type(); } -template -template -_T* -function<_R(_A0, _A1)>::target() +template +template +_Tp* +function<_Rp(_A0, _A1)>::target() { if (__f_ == 0) - return (_T*)0; - return (_T*)__f_->target(typeid(_T)); + return (_Tp*)0; + return (_Tp*)__f_->target(typeid(_Tp)); } -template -template -const _T* -function<_R(_A0, _A1)>::target() const +template +template +const _Tp* +function<_Rp(_A0, _A1)>::target() const { if (__f_ == 0) - return (const _T*)0; - return (const _T*)__f_->target(typeid(_T)); + return (const _Tp*)0; + return (const _Tp*)__f_->target(typeid(_Tp)); } #endif // _LIBCPP_NO_RTTI -template -class _LIBCPP_VISIBLE function<_R(_A0, _A1, _A2)> +template +class _LIBCPP_VISIBLE function<_Rp(_A0, _A1, _A2)> { - typedef __function::__base<_R(_A0, _A1, _A2)> __base; + typedef __function::__base<_Rp(_A0, _A1, _A2)> __base; aligned_storage<3*sizeof(void*)>::type __buf_; __base* __f_; - template + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const _F&) {return true;} + static bool __not_null(const _Fp&) {return true;} template _LIBCPP_INLINE_VISIBILITY static bool __not_null(_R2 (*__p)(_B0, _B1, _B2)) {return __p;} - template + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_C::*__p)(_B1, _B2)) {return __p;} - template + static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2)) {return __p;} + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_C::*__p)(_B1, _B2) const) {return __p;} - template + static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) const) {return __p;} + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_C::*__p)(_B1, _B2) volatile) {return __p;} - template + static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) volatile) {return __p;} + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_C::*__p)(_B1, _B2) const volatile) {return __p;} + static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) const volatile) {return __p;} template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const function<_R(_B0, _B1, _B2)>& __p) {return __p;} + static bool __not_null(const function<_Rp(_B0, _B1, _B2)>& __p) {return __p;} public: - typedef _R result_type; + typedef _Rp result_type; // 20.7.16.2.1, construct/copy/destroy: _LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {} _LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {} function(const function&); - template - function(_F, - typename enable_if::value>::type* = 0); + template + function(_Fp, + typename enable_if::value>::type* = 0); template _LIBCPP_INLINE_VISIBILITY @@ -1576,27 +1578,27 @@ public: function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {} template function(allocator_arg_t, const _Alloc&, const function&); - template - function(allocator_arg_t, const _Alloc& __a, _F __f, - typename enable_if::value>::type* = 0); + template + function(allocator_arg_t, const _Alloc& __a, _Fp __f, + typename enable_if::value>::type* = 0); function& operator=(const function&); function& operator=(nullptr_t); - template + template typename enable_if < - !is_integral<_F>::value, + !is_integral<_Fp>::value, function& >::type - operator=(_F); + operator=(_Fp); ~function(); // 20.7.16.2.2, function modifiers: void swap(function&); - template + template _LIBCPP_INLINE_VISIBILITY - void assign(_F __f, const _Alloc& __a) + void assign(_Fp __f, const _Alloc& __a) {function(allocator_arg, __a, __f).swap(*this);} // 20.7.16.2.3, function capacity: @@ -1610,18 +1612,18 @@ private: bool operator!=(const function<_R2(_B0, _B1, _B2)>&) const;// = delete; public: // 20.7.16.2.4, function invocation: - _R operator()(_A0, _A1, _A2) const; + _Rp operator()(_A0, _A1, _A2) const; #ifndef _LIBCPP_NO_RTTI // 20.7.16.2.5, function target access: const std::type_info& target_type() const; - template _T* target(); - template const _T* target() const; + template _Tp* target(); + template const _Tp* target() const; #endif // _LIBCPP_NO_RTTI }; -template -function<_R(_A0, _A1, _A2)>::function(const function& __f) +template +function<_Rp(_A0, _A1, _A2)>::function(const function& __f) { if (__f.__f_ == 0) __f_ = 0; @@ -1634,9 +1636,9 @@ function<_R(_A0, _A1, _A2)>::function(const function& __f) __f_ = __f.__f_->__clone(); } -template +template template -function<_R(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc&, +function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc&, const function& __f) { if (__f.__f_ == 0) @@ -1650,15 +1652,15 @@ function<_R(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc&, __f_ = __f.__f_->__clone(); } -template -template -function<_R(_A0, _A1, _A2)>::function(_F __f, - typename enable_if::value>::type*) +template +template +function<_Rp(_A0, _A1, _A2)>::function(_Fp __f, + typename enable_if::value>::type*) : __f_(0) { if (__not_null(__f)) { - typedef __function::__func<_F, allocator<_F>, _R(_A0, _A1, _A2)> _FF; + typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1, _A2)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) { __f_ = (__base*)&__buf_; @@ -1666,26 +1668,26 @@ function<_R(_A0, _A1, _A2)>::function(_F __f, } else { - typedef allocator<_FF> _A; - _A __a; - typedef __allocator_destructor<_A> _D; - unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1)); - ::new (__hold.get()) _FF(__f, allocator<_F>(__a)); + typedef allocator<_FF> _Ap; + _Ap __a; + typedef __allocator_destructor<_Ap> _Dp; + unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); + ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a)); __f_ = __hold.release(); } } } -template -template -function<_R(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _F __f, - typename enable_if::value>::type*) +template +template +function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f, + typename enable_if::value>::type*) : __f_(0) { typedef allocator_traits<_Alloc> __alloc_traits; if (__not_null(__f)) { - typedef __function::__func<_F, _Alloc, _R(_A0, _A1, _A2)> _FF; + typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) { __f_ = (__base*)&__buf_; @@ -1699,27 +1701,27 @@ function<_R(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _F __ #else rebind_alloc<_FF>::other #endif - _A; - _A __a(__a0); - typedef __allocator_destructor<_A> _D; - unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1)); + _Ap; + _Ap __a(__a0); + typedef __allocator_destructor<_Ap> _Dp; + unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); ::new (__hold.get()) _FF(__f, _Alloc(__a)); __f_ = __hold.release(); } } } -template -function<_R(_A0, _A1, _A2)>& -function<_R(_A0, _A1, _A2)>::operator=(const function& __f) +template +function<_Rp(_A0, _A1, _A2)>& +function<_Rp(_A0, _A1, _A2)>::operator=(const function& __f) { function(__f).swap(*this); return *this; } -template -function<_R(_A0, _A1, _A2)>& -function<_R(_A0, _A1, _A2)>::operator=(nullptr_t) +template +function<_Rp(_A0, _A1, _A2)>& +function<_Rp(_A0, _A1, _A2)>::operator=(nullptr_t) { if (__f_ == (__base*)&__buf_) __f_->destroy(); @@ -1728,21 +1730,21 @@ function<_R(_A0, _A1, _A2)>::operator=(nullptr_t) __f_ = 0; } -template -template +template +template typename enable_if < - !is_integral<_F>::value, - function<_R(_A0, _A1, _A2)>& + !is_integral<_Fp>::value, + function<_Rp(_A0, _A1, _A2)>& >::type -function<_R(_A0, _A1, _A2)>::operator=(_F __f) +function<_Rp(_A0, _A1, _A2)>::operator=(_Fp __f) { function(_VSTD::move(__f)).swap(*this); return *this; } -template -function<_R(_A0, _A1, _A2)>::~function() +template +function<_Rp(_A0, _A1, _A2)>::~function() { if (__f_ == (__base*)&__buf_) __f_->destroy(); @@ -1750,9 +1752,9 @@ function<_R(_A0, _A1, _A2)>::~function() __f_->destroy_deallocate(); } -template +template void -function<_R(_A0, _A1, _A2)>::swap(function& __f) +function<_Rp(_A0, _A1, _A2)>::swap(function& __f) { if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_) { @@ -1787,9 +1789,9 @@ function<_R(_A0, _A1, _A2)>::swap(function& __f) _VSTD::swap(__f_, __f.__f_); } -template -_R -function<_R(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2) const +template +_Rp +function<_Rp(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2) const { #ifndef _LIBCPP_NO_EXCEPTIONS if (__f_ == 0) @@ -1800,61 +1802,61 @@ function<_R(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2) const #ifndef _LIBCPP_NO_RTTI -template +template const std::type_info& -function<_R(_A0, _A1, _A2)>::target_type() const +function<_Rp(_A0, _A1, _A2)>::target_type() const { if (__f_ == 0) return typeid(void); return __f_->target_type(); } -template -template -_T* -function<_R(_A0, _A1, _A2)>::target() +template +template +_Tp* +function<_Rp(_A0, _A1, _A2)>::target() { if (__f_ == 0) - return (_T*)0; - return (_T*)__f_->target(typeid(_T)); + return (_Tp*)0; + return (_Tp*)__f_->target(typeid(_Tp)); } -template -template -const _T* -function<_R(_A0, _A1, _A2)>::target() const +template +template +const _Tp* +function<_Rp(_A0, _A1, _A2)>::target() const { if (__f_ == 0) - return (const _T*)0; - return (const _T*)__f_->target(typeid(_T)); + return (const _Tp*)0; + return (const _Tp*)__f_->target(typeid(_Tp)); } #endif // _LIBCPP_NO_RTTI -template +template inline _LIBCPP_INLINE_VISIBILITY bool -operator==(const function<_F>& __f, nullptr_t) {return !__f;} +operator==(const function<_Fp>& __f, nullptr_t) {return !__f;} -template +template inline _LIBCPP_INLINE_VISIBILITY bool -operator==(nullptr_t, const function<_F>& __f) {return !__f;} +operator==(nullptr_t, const function<_Fp>& __f) {return !__f;} -template +template inline _LIBCPP_INLINE_VISIBILITY bool -operator!=(const function<_F>& __f, nullptr_t) {return (bool)__f;} +operator!=(const function<_Fp>& __f, nullptr_t) {return (bool)__f;} -template +template inline _LIBCPP_INLINE_VISIBILITY bool -operator!=(nullptr_t, const function<_F>& __f) {return (bool)__f;} +operator!=(nullptr_t, const function<_Fp>& __f) {return (bool)__f;} -template +template inline _LIBCPP_INLINE_VISIBILITY void -swap(function<_F>& __x, function<_F>& __y) +swap(function<_Fp>& __x, function<_Fp>& __y) {return __x.swap(__y);} template struct __is_bind_expression : public false_type {}; @@ -1868,7 +1870,7 @@ template struct _LIBCPP_VISIBLE is_placeholder namespace placeholders { -template struct __ph {}; +template struct __ph {}; extern __ph<1> _1; extern __ph<2> _2; @@ -1883,9 +1885,9 @@ extern __ph<10> _10; } // placeholders -template -struct __is_placeholder > - : public integral_constant {}; +template +struct __is_placeholder > + : public integral_constant {}; template inline _LIBCPP_INLINE_VISIBILITY @@ -2001,15 +2003,15 @@ struct __mu_return, _TupleUj> typedef _Ti& type; }; -template +template struct __bind_return; -template -struct __bind_return<_F, tuple<_BoundArgs...>, _TupleUj> +template +struct __bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj> { typedef typename __ref_return < - _F&, + _Fp&, typename __mu_return < _BoundArgs, @@ -2018,12 +2020,12 @@ struct __bind_return<_F, tuple<_BoundArgs...>, _TupleUj> >::type type; }; -template -struct __bind_return<_F, const tuple<_BoundArgs...>, _TupleUj> +template +struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj> { typedef typename __ref_return < - _F&, + _Fp&, typename __mu_return < const _BoundArgs, @@ -2032,30 +2034,30 @@ struct __bind_return<_F, const tuple<_BoundArgs...>, _TupleUj> >::type type; }; -template +template inline _LIBCPP_INLINE_VISIBILITY -typename __bind_return<_F, _BoundArgs, _Args>::type -__apply_functor(_F& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, +typename __bind_return<_Fp, _BoundArgs, _Args>::type +__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, _Args&& __args) { return __invoke(__f, __mu(get<_Indx>(__bound_args), __args)...); } -template +template class __bind { - _F __f_; + _Fp __f_; tuple<_BoundArgs...> __bound_args_; typedef typename __make_tuple_indices::type __indices; public: - template - explicit __bind(_G&& __f, _BA&& ...__bound_args) - : __f_(_VSTD::forward<_G>(__f)), + template + explicit __bind(_Gp&& __f, _BA&& ...__bound_args) + : __f_(_VSTD::forward<_Gp>(__f)), __bound_args_(_VSTD::forward<_BA>(__bound_args)...) {} template - typename __bind_return<_F, tuple<_BoundArgs...>, tuple<_Args&&...> >::type + typename __bind_return<_Fp, tuple<_BoundArgs...>, tuple<_Args&&...> >::type operator()(_Args&& ...__args) { // compiler bug workaround @@ -2064,7 +2066,7 @@ public: } template - typename __bind_return<_F, tuple<_BoundArgs...>, tuple<_Args&&...> >::type + typename __bind_return<_Fp, tuple<_BoundArgs...>, tuple<_Args&&...> >::type operator()(_Args&& ...__args) const { return __apply_functor(__f_, __bound_args_, __indices(), @@ -2072,20 +2074,20 @@ public: } }; -template -struct __is_bind_expression<__bind<_F, _BoundArgs...> > : public true_type {}; +template +struct __is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {}; -template +template class __bind_r - : public __bind<_F, _BoundArgs...> + : public __bind<_Fp, _BoundArgs...> { - typedef __bind<_F, _BoundArgs...> base; + typedef __bind<_Fp, _BoundArgs...> base; public: - typedef _R result_type; + typedef _Rp result_type; - template - explicit __bind_r(_G&& __f, _BA&& ...__bound_args) - : base(_VSTD::forward<_G>(__f), + template + explicit __bind_r(_Gp&& __f, _BA&& ...__bound_args) + : base(_VSTD::forward<_Gp>(__f), _VSTD::forward<_BA>(__bound_args)...) {} template @@ -2103,25 +2105,25 @@ public: } }; -template -struct __is_bind_expression<__bind_r<_R, _F, _BoundArgs...> > : public true_type {}; +template +struct __is_bind_expression<__bind_r<_Rp, _Fp, _BoundArgs...> > : public true_type {}; -template +template inline _LIBCPP_INLINE_VISIBILITY -__bind::type, typename decay<_BoundArgs>::type...> -bind(_F&& __f, _BoundArgs&&... __bound_args) +__bind::type, typename decay<_BoundArgs>::type...> +bind(_Fp&& __f, _BoundArgs&&... __bound_args) { - typedef __bind::type, typename decay<_BoundArgs>::type...> type; - return type(_VSTD::forward<_F>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...); + typedef __bind::type, typename decay<_BoundArgs>::type...> type; + return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__bind_r<_R, typename decay<_F>::type, typename decay<_BoundArgs>::type...> -bind(_F&& __f, _BoundArgs&&... __bound_args) +__bind_r<_Rp, typename decay<_Fp>::type, typename decay<_BoundArgs>::type...> +bind(_Fp&& __f, _BoundArgs&&... __bound_args) { - typedef __bind_r<_R, typename decay<_F>::type, typename decay<_BoundArgs>::type...> type; - return type(_VSTD::forward<_F>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...); + typedef __bind_r<_Rp, typename decay<_Fp>::type, typename decay<_BoundArgs>::type...> type; + return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...); } */ diff --git a/system/include/libcxx/__functional_base b/system/include/libcxx/__functional_base index 441ab4f5d0b65..2385459c38c58 100644 --- a/system/include/libcxx/__functional_base +++ b/system/include/libcxx/__functional_base @@ -16,7 +16,9 @@ #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -41,13 +43,20 @@ template struct __has_result_type { private: - struct __two {char _; char __;}; + struct __two {char __lx; char __lxx;}; template static __two __test(...); template static char __test(typename _Up::result_type* = 0); public: static const bool value = sizeof(__test<_Tp>(0)) == 1; }; +template +struct _LIBCPP_VISIBLE less : binary_function<_Tp, _Tp, bool> +{ + _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const + {return __x < __y;} +}; + #ifdef _LIBCPP_HAS_NO_VARIADICS #include <__functional_base_03> @@ -60,11 +69,11 @@ template struct __derives_from_unary_function { private: - struct __two {char _; char __;}; + struct __two {char __lx; char __lxx;}; static __two __test(...); - template - static unary_function<_A, _R> - __test(const volatile unary_function<_A, _R>*); + template + static unary_function<_Ap, _Rp> + __test(const volatile unary_function<_Ap, _Rp>*); public: static const bool value = !is_same::value; typedef decltype(__test((_Tp*)0)) type; @@ -74,11 +83,11 @@ template struct __derives_from_binary_function { private: - struct __two {char _; char __;}; + struct __two {char __lx; char __lxx;}; static __two __test(...); - template - static binary_function<_A1, _A2, _R> - __test(const volatile binary_function<_A1, _A2, _R>*); + template + static binary_function<_A1, _A2, _Rp> + __test(const volatile binary_function<_A1, _A2, _Rp>*); public: static const bool value = !is_same::value; typedef decltype(__test((_Tp*)0)) type; @@ -129,173 +138,173 @@ struct __weak_result_type // 0 argument case -template -struct __weak_result_type<_R ()> +template +struct __weak_result_type<_Rp ()> { - typedef _R result_type; + typedef _Rp result_type; }; -template -struct __weak_result_type<_R (&)()> +template +struct __weak_result_type<_Rp (&)()> { - typedef _R result_type; + typedef _Rp result_type; }; -template -struct __weak_result_type<_R (*)()> +template +struct __weak_result_type<_Rp (*)()> { - typedef _R result_type; + typedef _Rp result_type; }; // 1 argument case -template -struct __weak_result_type<_R (_A1)> - : public unary_function<_A1, _R> +template +struct __weak_result_type<_Rp (_A1)> + : public unary_function<_A1, _Rp> { }; -template -struct __weak_result_type<_R (&)(_A1)> - : public unary_function<_A1, _R> +template +struct __weak_result_type<_Rp (&)(_A1)> + : public unary_function<_A1, _Rp> { }; -template -struct __weak_result_type<_R (*)(_A1)> - : public unary_function<_A1, _R> +template +struct __weak_result_type<_Rp (*)(_A1)> + : public unary_function<_A1, _Rp> { }; -template -struct __weak_result_type<_R (_C::*)()> - : public unary_function<_C*, _R> +template +struct __weak_result_type<_Rp (_Cp::*)()> + : public unary_function<_Cp*, _Rp> { }; -template -struct __weak_result_type<_R (_C::*)() const> - : public unary_function +template +struct __weak_result_type<_Rp (_Cp::*)() const> + : public unary_function { }; -template -struct __weak_result_type<_R (_C::*)() volatile> - : public unary_function +template +struct __weak_result_type<_Rp (_Cp::*)() volatile> + : public unary_function { }; -template -struct __weak_result_type<_R (_C::*)() const volatile> - : public unary_function +template +struct __weak_result_type<_Rp (_Cp::*)() const volatile> + : public unary_function { }; // 2 argument case -template -struct __weak_result_type<_R (_A1, _A2)> - : public binary_function<_A1, _A2, _R> +template +struct __weak_result_type<_Rp (_A1, _A2)> + : public binary_function<_A1, _A2, _Rp> { }; -template -struct __weak_result_type<_R (*)(_A1, _A2)> - : public binary_function<_A1, _A2, _R> +template +struct __weak_result_type<_Rp (*)(_A1, _A2)> + : public binary_function<_A1, _A2, _Rp> { }; -template -struct __weak_result_type<_R (&)(_A1, _A2)> - : public binary_function<_A1, _A2, _R> +template +struct __weak_result_type<_Rp (&)(_A1, _A2)> + : public binary_function<_A1, _A2, _Rp> { }; -template -struct __weak_result_type<_R (_C::*)(_A1)> - : public binary_function<_C*, _A1, _R> +template +struct __weak_result_type<_Rp (_Cp::*)(_A1)> + : public binary_function<_Cp*, _A1, _Rp> { }; -template -struct __weak_result_type<_R (_C::*)(_A1) const> - : public binary_function +template +struct __weak_result_type<_Rp (_Cp::*)(_A1) const> + : public binary_function { }; -template -struct __weak_result_type<_R (_C::*)(_A1) volatile> - : public binary_function +template +struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile> + : public binary_function { }; -template -struct __weak_result_type<_R (_C::*)(_A1) const volatile> - : public binary_function +template +struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile> + : public binary_function { }; // 3 or more arguments -template -struct __weak_result_type<_R (_A1, _A2, _A3, _A4...)> +template +struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)> { - typedef _R result_type; + typedef _Rp result_type; }; -template -struct __weak_result_type<_R (&)(_A1, _A2, _A3, _A4...)> +template +struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)> { - typedef _R result_type; + typedef _Rp result_type; }; -template -struct __weak_result_type<_R (*)(_A1, _A2, _A3, _A4...)> +template +struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)> { - typedef _R result_type; + typedef _Rp result_type; }; -template -struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...)> +template +struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)> { - typedef _R result_type; + typedef _Rp result_type; }; -template -struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const> +template +struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const> { - typedef _R result_type; + typedef _Rp result_type; }; -template -struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) volatile> +template +struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile> { - typedef _R result_type; + typedef _Rp result_type; }; -template -struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const volatile> +template +struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile> { - typedef _R result_type; + typedef _Rp result_type; }; // __invoke // bullets 1 and 2 -template +template inline _LIBCPP_INLINE_VISIBILITY auto -__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args) +__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...)) { return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...); } -template +template inline _LIBCPP_INLINE_VISIBILITY auto -__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args) +__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...)) { return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...); @@ -303,19 +312,19 @@ __invoke(_F&& __f, _A0&& __a0, _Args&& ...__args) // bullets 3 and 4 -template +template inline _LIBCPP_INLINE_VISIBILITY auto -__invoke(_F&& __f, _A0&& __a0) +__invoke(_Fp&& __f, _A0&& __a0) -> decltype(_VSTD::forward<_A0>(__a0).*__f) { return _VSTD::forward<_A0>(__a0).*__f; } -template +template inline _LIBCPP_INLINE_VISIBILITY auto -__invoke(_F&& __f, _A0&& __a0) +__invoke(_Fp&& __f, _A0&& __a0) -> decltype((*_VSTD::forward<_A0>(__a0)).*__f) { return (*_VSTD::forward<_A0>(__a0)).*__f; @@ -323,13 +332,13 @@ __invoke(_F&& __f, _A0&& __a0) // bullet 5 -template +template inline _LIBCPP_INLINE_VISIBILITY auto -__invoke(_F&& __f, _Args&& ...__args) - -> decltype(_VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...)) +__invoke(_Fp&& __f, _Args&& ...__args) + -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)) { - return _VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...); + return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...); } template @@ -409,13 +418,13 @@ cref(reference_wrapper<_Tp> __t) _NOEXCEPT #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS -template void ref(const _Tp&& __t) = delete; -template void cref(const _Tp&& __t) = delete; +template void ref(const _Tp&&) = delete; +template void cref(const _Tp&&) = delete; #else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS -template void ref(const _Tp&& __t);// = delete; -template void cref(const _Tp&& __t);// = delete; +template void ref(const _Tp&&);// = delete; +template void cref(const _Tp&&);// = delete; #endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS diff --git a/system/include/libcxx/__functional_base_03 b/system/include/libcxx/__functional_base_03 index fabda5bc3d4b7..a1005bf78f547 100644 --- a/system/include/libcxx/__functional_base_03 +++ b/system/include/libcxx/__functional_base_03 @@ -19,11 +19,11 @@ template struct __derives_from_unary_function { private: - struct __two {char _; char __;}; + struct __two {char __lx; char __lxx;}; static __two __test(...); - template - static unary_function<_A, _R> - __test(const volatile unary_function<_A, _R>*); + template + static unary_function<_Ap, _Rp> + __test(const volatile unary_function<_Ap, _Rp>*); public: static const bool value = !is_same::value; typedef decltype(__test((_Tp*)0)) type; @@ -33,11 +33,11 @@ template struct __derives_from_binary_function { private: - struct __two {char _; char __;}; + struct __two {char __lx; char __lxx;}; static __two __test(...); - template - static binary_function<_A1, _A2, _R> - __test(const volatile binary_function<_A1, _A2, _R>*); + template + static binary_function<_A1, _A2, _Rp> + __test(const volatile binary_function<_A1, _A2, _Rp>*); public: static const bool value = !is_same::value; typedef decltype(__test((_Tp*)0)) type; @@ -88,148 +88,148 @@ struct __weak_result_type // 0 argument case -template -struct __weak_result_type<_R ()> +template +struct __weak_result_type<_Rp ()> { - typedef _R result_type; + typedef _Rp result_type; }; -template -struct __weak_result_type<_R (&)()> +template +struct __weak_result_type<_Rp (&)()> { - typedef _R result_type; + typedef _Rp result_type; }; -template -struct __weak_result_type<_R (*)()> +template +struct __weak_result_type<_Rp (*)()> { - typedef _R result_type; + typedef _Rp result_type; }; // 1 argument case -template -struct __weak_result_type<_R (_A1)> - : public unary_function<_A1, _R> +template +struct __weak_result_type<_Rp (_A1)> + : public unary_function<_A1, _Rp> { }; -template -struct __weak_result_type<_R (&)(_A1)> - : public unary_function<_A1, _R> +template +struct __weak_result_type<_Rp (&)(_A1)> + : public unary_function<_A1, _Rp> { }; -template -struct __weak_result_type<_R (*)(_A1)> - : public unary_function<_A1, _R> +template +struct __weak_result_type<_Rp (*)(_A1)> + : public unary_function<_A1, _Rp> { }; -template -struct __weak_result_type<_R (_C::*)()> - : public unary_function<_C*, _R> +template +struct __weak_result_type<_Rp (_Cp::*)()> + : public unary_function<_Cp*, _Rp> { }; -template -struct __weak_result_type<_R (_C::*)() const> - : public unary_function +template +struct __weak_result_type<_Rp (_Cp::*)() const> + : public unary_function { }; -template -struct __weak_result_type<_R (_C::*)() volatile> - : public unary_function +template +struct __weak_result_type<_Rp (_Cp::*)() volatile> + : public unary_function { }; -template -struct __weak_result_type<_R (_C::*)() const volatile> - : public unary_function +template +struct __weak_result_type<_Rp (_Cp::*)() const volatile> + : public unary_function { }; // 2 argument case -template -struct __weak_result_type<_R (_A1, _A2)> - : public binary_function<_A1, _A2, _R> +template +struct __weak_result_type<_Rp (_A1, _A2)> + : public binary_function<_A1, _A2, _Rp> { }; -template -struct __weak_result_type<_R (*)(_A1, _A2)> - : public binary_function<_A1, _A2, _R> +template +struct __weak_result_type<_Rp (*)(_A1, _A2)> + : public binary_function<_A1, _A2, _Rp> { }; -template -struct __weak_result_type<_R (&)(_A1, _A2)> - : public binary_function<_A1, _A2, _R> +template +struct __weak_result_type<_Rp (&)(_A1, _A2)> + : public binary_function<_A1, _A2, _Rp> { }; -template -struct __weak_result_type<_R (_C::*)(_A1)> - : public binary_function<_C*, _A1, _R> +template +struct __weak_result_type<_Rp (_Cp::*)(_A1)> + : public binary_function<_Cp*, _A1, _Rp> { }; -template -struct __weak_result_type<_R (_C::*)(_A1) const> - : public binary_function +template +struct __weak_result_type<_Rp (_Cp::*)(_A1) const> + : public binary_function { }; -template -struct __weak_result_type<_R (_C::*)(_A1) volatile> - : public binary_function +template +struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile> + : public binary_function { }; -template -struct __weak_result_type<_R (_C::*)(_A1) const volatile> - : public binary_function +template +struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile> + : public binary_function { }; // 3 or more arguments -template -struct __weak_result_type<_R (_A1, _A2, _A3)> +template +struct __weak_result_type<_Rp (_A1, _A2, _A3)> { - typedef _R result_type; + typedef _Rp result_type; }; -template -struct __weak_result_type<_R (&)(_A1, _A2, _A3)> +template +struct __weak_result_type<_Rp (&)(_A1, _A2, _A3)> { - typedef _R result_type; + typedef _Rp result_type; }; -template -struct __weak_result_type<_R (*)(_A1, _A2, _A3)> +template +struct __weak_result_type<_Rp (*)(_A1, _A2, _A3)> { - typedef _R result_type; + typedef _Rp result_type; }; -template -struct __weak_result_type<_R (_C::*)(_A1, _A2)> +template +struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2)> { - typedef _R result_type; + typedef _Rp result_type; }; -template -struct __weak_result_type<_R (_C::*)(_A1, _A2) const> +template +struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2) const> { - typedef _R result_type; + typedef _Rp result_type; }; -template -struct __weak_result_type<_R (_C::*)(_A1, _A2) volatile> +template +struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2) volatile> { - typedef _R result_type; + typedef _Rp result_type; }; // __invoke @@ -297,26 +297,26 @@ struct __weak_result_type<_R (_C::*)(_A1, _A2) volatile> // template // struct __ref_return1_member_data1; // -// template -// struct __ref_return1_member_data1<_R _C::*, _A0, true> +// template +// struct __ref_return1_member_data1<_Rp _Cp::*, _A0, true> // { -// typedef typename __apply_cv<_A0, _R>::type& type; +// typedef typename __apply_cv<_A0, _Rp>::type& type; // }; // -// template -// struct __ref_return1_member_data1<_R _C::*, _A0, false> +// template +// struct __ref_return1_member_data1<_Rp _Cp::*, _A0, false> // { // static _A0 __a; -// typedef typename __apply_cv::type& type; +// typedef typename __apply_cv::type& type; // }; // // template // struct __ref_return1_member_data; // -// template -// struct __ref_return1_member_data<_R _C::*, _A0> -// : public __ref_return1_member_data1<_R _C::*, _A0, -// is_same::type, +// template +// struct __ref_return1_member_data<_Rp _Cp::*, _A0> +// : public __ref_return1_member_data1<_Rp _Cp::*, _A0, +// is_same::type, // typename remove_cv::type>::type>::value> // { // }; @@ -413,528 +413,528 @@ struct __weak_result_type<_R (_C::*)(_A1, _A2) volatile> // first bullet -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(), _T1& __t1) +__invoke(_Rp (_Tp::*__f)(), _T1& __t1) { return (__t1.*__f)(); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0), _T1& __t1, _A0& __a0) +__invoke(_Rp (_Tp::*__f)(_A0), _T1& __t1, _A0& __a0) { return (__t1.*__f)(__a0); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0, _A1), _T1& __t1, _A0& __a0, _A1& __a1) +__invoke(_Rp (_Tp::*__f)(_A0, _A1), _T1& __t1, _A0& __a0, _A1& __a1) { return (__t1.*__f)(__a0, __a1); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0, _A1, _A2), _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) +__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2), _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) { return (__t1.*__f)(__a0, __a1, __a2); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)() const, _T1& __t1) +__invoke(_Rp (_Tp::*__f)() const, _T1& __t1) { return (__t1.*__f)(); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0) const, _T1& __t1, _A0& __a0) +__invoke(_Rp (_Tp::*__f)(_A0) const, _T1& __t1, _A0& __a0) { return (__t1.*__f)(__a0); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0, _A1) const, _T1& __t1, _A0& __a0, _A1& __a1) +__invoke(_Rp (_Tp::*__f)(_A0, _A1) const, _T1& __t1, _A0& __a0, _A1& __a1) { return (__t1.*__f)(__a0, __a1); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0, _A1, _A2) const, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) +__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) { return (__t1.*__f)(__a0, __a1, __a2); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)() volatile, _T1& __t1) +__invoke(_Rp (_Tp::*__f)() volatile, _T1& __t1) { return (__t1.*__f)(); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0) volatile, _T1& __t1, _A0& __a0) +__invoke(_Rp (_Tp::*__f)(_A0) volatile, _T1& __t1, _A0& __a0) { return (__t1.*__f)(__a0); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0, _A1) volatile, _T1& __t1, _A0& __a0, _A1& __a1) +__invoke(_Rp (_Tp::*__f)(_A0, _A1) volatile, _T1& __t1, _A0& __a0, _A1& __a1) { return (__t1.*__f)(__a0, __a1); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0, _A1, _A2) volatile, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) +__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) volatile, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) { return (__t1.*__f)(__a0, __a1, __a2); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)() const volatile, _T1& __t1) +__invoke(_Rp (_Tp::*__f)() const volatile, _T1& __t1) { return (__t1.*__f)(); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0) const volatile, _T1& __t1, _A0& __a0) +__invoke(_Rp (_Tp::*__f)(_A0) const volatile, _T1& __t1, _A0& __a0) { return (__t1.*__f)(__a0); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0, _A1) const volatile, _T1& __t1, _A0& __a0, _A1& __a1) +__invoke(_Rp (_Tp::*__f)(_A0, _A1) const volatile, _T1& __t1, _A0& __a0, _A1& __a1) { return (__t1.*__f)(__a0, __a1); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0, _A1, _A2) const volatile, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) +__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const volatile, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) { return (__t1.*__f)(__a0, __a1, __a2); } // second bullet -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - !is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + !is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(), _T1 __t1) +__invoke(_Rp (_Tp::*__f)(), _T1 __t1) { return ((*__t1).*__f)(); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - !is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + !is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0), _T1 __t1, _A0& __a0) +__invoke(_Rp (_Tp::*__f)(_A0), _T1 __t1, _A0& __a0) { return ((*__t1).*__f)(__a0); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - !is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + !is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0, _A1), _T1 __t1, _A0& __a0, _A1& __a1) +__invoke(_Rp (_Tp::*__f)(_A0, _A1), _T1 __t1, _A0& __a0, _A1& __a1) { return ((*__t1).*__f)(__a0, __a1); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - !is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + !is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0, _A1, _A2), _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2) +__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2), _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2) { return ((*__t1).*__f)(__a0, __a1, __a2); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - !is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + !is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)() const, _T1 __t1) +__invoke(_Rp (_Tp::*__f)() const, _T1 __t1) { return ((*__t1).*__f)(); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - !is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + !is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0) const, _T1 __t1, _A0& __a0) +__invoke(_Rp (_Tp::*__f)(_A0) const, _T1 __t1, _A0& __a0) { return ((*__t1).*__f)(__a0); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - !is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + !is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0, _A1) const, _T1 __t1, _A0& __a0, _A1& __a1) +__invoke(_Rp (_Tp::*__f)(_A0, _A1) const, _T1 __t1, _A0& __a0, _A1& __a1) { return ((*__t1).*__f)(__a0, __a1); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - !is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + !is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0, _A1, _A2) const, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2) +__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2) { return ((*__t1).*__f)(__a0, __a1, __a2); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - !is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + !is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)() volatile, _T1 __t1) +__invoke(_Rp (_Tp::*__f)() volatile, _T1 __t1) { return ((*__t1).*__f)(); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - !is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + !is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0) volatile, _T1 __t1, _A0& __a0) +__invoke(_Rp (_Tp::*__f)(_A0) volatile, _T1 __t1, _A0& __a0) { return ((*__t1).*__f)(__a0); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - !is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + !is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0, _A1) volatile, _T1 __t1, _A0& __a0, _A1& __a1) +__invoke(_Rp (_Tp::*__f)(_A0, _A1) volatile, _T1 __t1, _A0& __a0, _A1& __a1) { return ((*__t1).*__f)(__a0, __a1); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - !is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + !is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0, _A1, _A2) volatile, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2) +__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) volatile, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2) { return ((*__t1).*__f)(__a0, __a1, __a2); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - !is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + !is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)() const volatile, _T1 __t1) +__invoke(_Rp (_Tp::*__f)() const volatile, _T1 __t1) { return ((*__t1).*__f)(); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - !is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + !is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0) const volatile, _T1 __t1, _A0& __a0) +__invoke(_Rp (_Tp::*__f)(_A0) const volatile, _T1 __t1, _A0& __a0) { return ((*__t1).*__f)(__a0); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - !is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + !is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0, _A1) const volatile, _T1 __t1, _A0& __a0, _A1& __a1) +__invoke(_Rp (_Tp::*__f)(_A0, _A1) const volatile, _T1 __t1, _A0& __a0, _A1& __a1) { return ((*__t1).*__f)(__a0, __a1); } -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - !is_base_of<_T, typename remove_reference<_T1>::type>::value, - _R + !is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + _Rp >::type -__invoke(_R (_T::*__f)(_A0, _A1, _A2) const volatile, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2) +__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const volatile, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2) { return ((*__t1).*__f)(__a0, __a1, __a2); } // third bullet -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - is_base_of<_T, typename remove_reference<_T1>::type>::value, - typename __apply_cv<_T1, _R>::type& + is_base_of<_Tp, typename remove_reference<_T1>::type>::value, + typename __apply_cv<_T1, _Rp>::type& >::type -__invoke(_R _T::* __f, _T1& __t1) +__invoke(_Rp _Tp::* __f, _T1& __t1) { return __t1.*__f; } -template +template inline _LIBCPP_INLINE_VISIBILITY void -__invoke(_R _T::*) +__invoke(_Rp _Tp::*) { } -// template +// template // inline _LIBCPP_INLINE_VISIBILITY // typename enable_if // < -// is_base_of<_T, typename remove_reference<_T1>::type>::value, -// typename __ref_return1<_R _T::*, _T1>::type +// is_base_of<_Tp, typename remove_reference<_T1>::type>::value, +// typename __ref_return1<_Rp _Tp::*, _T1>::type // >::type -// __invoke(_R _T::* __f, _T1& __t1) +// __invoke(_Rp _Tp::* __f, _T1& __t1) // { // return __t1.*__f; // } // forth bullet -template +template struct __4th_helper { }; -template -struct __4th_helper<_T1, _R, true> +template +struct __4th_helper<_T1, _Rp, true> { - typedef typename __apply_cv()), _R>::type type; + typedef typename __apply_cv()), _Rp>::type type; }; -template +template inline _LIBCPP_INLINE_VISIBILITY -typename __4th_helper<_T1, _R, - !is_base_of<_T, +typename __4th_helper<_T1, _Rp, + !is_base_of<_Tp, typename remove_reference<_T1>::type >::value >::type& -__invoke(_R _T::* __f, _T1& __t1) +__invoke(_Rp _Tp::* __f, _T1& __t1) { return (*__t1).*__f; } -// template +// template // inline _LIBCPP_INLINE_VISIBILITY // typename enable_if // < -// !is_base_of<_T, typename remove_reference<_T1>::type>::value, -// typename __ref_return1<_R _T::*, _T1>::type +// !is_base_of<_Tp, typename remove_reference<_T1>::type>::value, +// typename __ref_return1<_Rp _Tp::*, _T1>::type // >::type -// __invoke(_R _T::* __f, _T1 __t1) +// __invoke(_Rp _Tp::* __f, _T1 __t1) // { // return (*__t1).*__f; // } // fifth bullet -template +template inline _LIBCPP_INLINE_VISIBILITY -decltype(declval<_F>()()) -__invoke(_F __f) +decltype(declval<_Fp>()()) +__invoke(_Fp __f) { return __f(); } -template +template inline _LIBCPP_INLINE_VISIBILITY -decltype(declval<_F>()(declval<_A0&>())) -__invoke(_F __f, _A0& __a0) +decltype(declval<_Fp>()(declval<_A0&>())) +__invoke(_Fp __f, _A0& __a0) { return __f(__a0); } -template +template inline _LIBCPP_INLINE_VISIBILITY -decltype(declval<_F>()(declval<_A0&>(), declval<_A1&>())) -__invoke(_F __f, _A0& __a0, _A1& __a1) +decltype(declval<_Fp>()(declval<_A0&>(), declval<_A1&>())) +__invoke(_Fp __f, _A0& __a0, _A1& __a1) { return __f(__a0, __a1); } -template +template inline _LIBCPP_INLINE_VISIBILITY -decltype(declval<_F>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>())) -__invoke(_F __f, _A0& __a0, _A1& __a1, _A2& __a2) +decltype(declval<_Fp>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>())) +__invoke(_Fp __f, _A0& __a0, _A1& __a1, _A2& __a2) { return __f(__a0, __a1, __a2); } -// template +// template // inline _LIBCPP_INLINE_VISIBILITY -// _R -// __invoke(_F& __f) +// _Rp +// __invoke(_Fp& __f) // { // return __f(); // } // -// template +// template // inline _LIBCPP_INLINE_VISIBILITY // typename enable_if // < -// !is_member_pointer<_F>::value, -// _R +// !is_member_pointer<_Fp>::value, +// _Rp // >::type -// __invoke(_F& __f, _A0& __a0) +// __invoke(_Fp& __f, _A0& __a0) // { // return __f(__a0); // } // -// template +// template // inline _LIBCPP_INLINE_VISIBILITY -// _R -// __invoke(_F& __f, _A0& __a0, _A1& __a1) +// _Rp +// __invoke(_Fp& __f, _A0& __a0, _A1& __a1) // { // return __f(__a0, __a1); // } // -// template +// template // inline _LIBCPP_INLINE_VISIBILITY -// _R -// __invoke(_F& __f, _A0& __a0, _A1& __a1, _A2& __a2) +// _Rp +// __invoke(_Fp& __f, _A0& __a0, _A1& __a1, _A2& __a2) // { // return __f(__a0, __a1, __a2); // } @@ -943,23 +943,23 @@ template struct __has_type { private: - struct __two {char _; char __;}; + struct __two {char __lx; char __lxx;}; template static __two __test(...); template static char __test(typename _Up::type* = 0); public: static const bool value = sizeof(__test<_Tp>(0)) == 1; }; -template >::value> +template >::value> struct __invoke_return { - typedef typename __weak_result_type<_F>::result_type type; + typedef typename __weak_result_type<_Fp>::result_type type; }; -template -struct __invoke_return<_F, false> +template +struct __invoke_return<_Fp, false> { - typedef decltype(__invoke(_VSTD::declval<_F>())) type; + typedef decltype(__invoke(_VSTD::declval<_Fp>())) type; }; template @@ -968,16 +968,16 @@ struct __invoke_return0 typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_A0>())) type; }; -template -struct __invoke_return0<_R _T::*, _A0> +template +struct __invoke_return0<_Rp _Tp::*, _A0> { - typedef typename __apply_cv<_A0, _R>::type& type; + typedef typename __apply_cv<_A0, _Rp>::type& type; }; -template -struct __invoke_return0<_R _T::*, _A0*> +template +struct __invoke_return0<_Rp _Tp::*, _A0*> { - typedef typename __apply_cv<_A0, _R>::type& type; + typedef typename __apply_cv<_A0, _Rp>::type& type; }; template diff --git a/system/include/libcxx/__hash_table b/system/include/libcxx/__hash_table index f9578fa2d2dd8..ba04b3e546a48 100644 --- a/system/include/libcxx/__hash_table +++ b/system/include/libcxx/__hash_table @@ -18,7 +18,11 @@ #include #include +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -54,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; @@ -236,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; } @@ -326,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; } @@ -471,7 +496,6 @@ public: public: // Create __node typedef __hash_node __node; - typedef typename __node::__first_node __first_node; typedef typename __alloc_traits::template #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES rebind_alloc<__node> @@ -482,6 +506,7 @@ public: typedef allocator_traits<__node_allocator> __node_traits; typedef typename __node_traits::pointer __node_pointer; typedef typename __node_traits::const_pointer __node_const_pointer; + typedef __hash_node_base<__node_pointer> __first_node; private: @@ -600,15 +625,15 @@ public: pair __insert_unique(const value_type& __x); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template - pair __insert_unique(_P&& __x); + template + pair __insert_unique(_Pp&& __x); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template - iterator __insert_multi(_P&& __x); - template - iterator __insert_multi(const_iterator __p, _P&& __x); + template + iterator __insert_multi(_Pp&& __x); + template + iterator __insert_multi(const_iterator __p, _Pp&& __x); #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES iterator __insert_multi(const value_type& __x); iterator __insert_multi(const_iterator __p, const value_type& __x); @@ -633,15 +658,15 @@ 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); template const_iterator find(const _Key& __x) const; - typedef __hash_node_destructor<__node_allocator> _D; - typedef unique_ptr<__node, _D> __node_holder; + typedef __hash_node_destructor<__node_allocator> _Dp; + typedef unique_ptr<__node, _Dp> __node_holder; iterator erase(const_iterator __p); iterator erase(const_iterator __first, const_iterator __last); @@ -719,7 +744,7 @@ private: __node_traits::propagate_on_container_copy_assignment::value>());} void __copy_assign_alloc(const __hash_table& __u, true_type); _LIBCPP_INLINE_VISIBILITY - void __copy_assign_alloc(const __hash_table& __u, false_type) {} + void __copy_assign_alloc(const __hash_table&, false_type) {} void __move_assign(__hash_table& __u, false_type); void __move_assign(__hash_table& __u, true_type) @@ -748,37 +773,37 @@ private: _LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {} - template + template _LIBCPP_INLINE_VISIBILITY static void - __swap_alloc(_A& __x, _A& __y) + __swap_alloc(_Ap& __x, _Ap& __y) _NOEXCEPT_( - !allocator_traits<_A>::propagate_on_container_swap::value || - __is_nothrow_swappable<_A>::value) + !allocator_traits<_Ap>::propagate_on_container_swap::value || + __is_nothrow_swappable<_Ap>::value) { __swap_alloc(__x, __y, integral_constant::propagate_on_container_swap::value + allocator_traits<_Ap>::propagate_on_container_swap::value >()); } - template + template _LIBCPP_INLINE_VISIBILITY static void - __swap_alloc(_A& __x, _A& __y, true_type) - _NOEXCEPT_(__is_nothrow_swappable<_A>::value) + __swap_alloc(_Ap& __x, _Ap& __y, true_type) + _NOEXCEPT_(__is_nothrow_swappable<_Ap>::value) { using _VSTD::swap; swap(__x, __y); } - template + template _LIBCPP_INLINE_VISIBILITY static void - __swap_alloc(_A& __x, _A& __y, false_type) _NOEXCEPT {} + __swap_alloc(_Ap&, _Ap&, false_type) _NOEXCEPT {} void __deallocate(__node_pointer __np) _NOEXCEPT; __node_pointer __detach() _NOEXCEPT; @@ -867,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; @@ -891,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; @@ -988,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; @@ -1186,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_)) @@ -1202,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]; @@ -1217,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 { @@ -1241,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) { @@ -1255,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 @@ -1281,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; } @@ -1302,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_; @@ -1329,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)) @@ -1346,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]; @@ -1361,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 { @@ -1418,11 +1443,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi( #endif // _LIBCPP_HAS_NO_VARIADICS template -template +template pair::iterator, bool> -__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_P&& __x) +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_Pp&& __x) { - __node_holder __h = __construct_node(_VSTD::forward<_P>(__x)); + __node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x)); pair __r = __node_insert_unique(__h.get()); if (__r.second) __h.release(); @@ -1434,23 +1459,23 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_P&& __x) #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template -template +template typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator -__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(_P&& __x) +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(_Pp&& __x) { - __node_holder __h = __construct_node(_VSTD::forward<_P>(__x)); + __node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x)); iterator __r = __node_insert_multi(__h.get()); __h.release(); return __r; } template -template +template typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const_iterator __p, - _P&& __x) + _Pp&& __x) { - __node_holder __h = __construct_node(_VSTD::forward<_P>(__x)); + __node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x)); iterator __r = __node_insert_multi(__p, __h.get()); __h.release(); return __r; @@ -1485,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); @@ -1517,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 @@ -1561,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)) @@ -1586,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)) @@ -1612,7 +1641,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(_Args&& ...__args) { __node_allocator& __na = __node_alloc(); - __node_holder __h(__node_traits::allocate(__na, 1), _D(__na)); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...); __h.get_deleter().__value_constructed = true; __h->__hash_ = hash_function()(__h->__value_); @@ -1628,7 +1657,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(value_type&& __v, size_t __hash) { __node_allocator& __na = __node_alloc(); - __node_holder __h(__node_traits::allocate(__na, 1), _D(__na)); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::move(__v)); __h.get_deleter().__value_constructed = true; __h->__hash_ = __hash; @@ -1643,7 +1672,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v) { __node_allocator& __na = __node_alloc(); - __node_holder __h(__node_traits::allocate(__na, 1), _D(__na)); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v); __h.get_deleter().__value_constructed = true; __h->__hash_ = hash_function()(__h->__value_); @@ -1659,7 +1688,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v size_t __hash) { __node_allocator& __na = __node_alloc(); - __node_holder __h(__node_traits::allocate(__na, 1), _D(__na)); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v); __h.get_deleter().__value_constructed = true; __h->__hash_ = __hash; @@ -1730,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_) @@ -1738,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; } @@ -1754,7 +1783,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT __pn->__next_ = __cn->__next_; __cn->__next_ = nullptr; --size(); - return __node_holder(__cn, _D(__node_alloc(), true)); + return __node_holder(__cn, _Dp(__node_alloc(), true)); } template @@ -1877,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())); } @@ -1894,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/system/include/libcxx/__locale b/system/include/libcxx/__locale index 7b7cfcd7fc137..0805ad8685459 100644 --- a/system/include/libcxx/__locale +++ b/system/include/libcxx/__locale @@ -20,26 +20,35 @@ #include #include #if _WIN32 -# include -#else // _WIN32 +# include +#elif (__GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || EMSCRIPTEN) # include -#endif // _WIN32 +#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD__ || EMSCRIPTEN +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _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 @@ -117,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; @@ -231,22 +240,22 @@ collate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1, template long -collate<_CharT>::do_hash(const char_type* lo, const char_type* hi) const +collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const { - size_t h = 0; - const size_t sr = __CHAR_BIT__ * sizeof(size_t) - 8; - const size_t mask = size_t(0xF) << (sr + 4); - for(const char_type* p = lo; p != hi; ++p) + size_t __h = 0; + const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8; + const size_t __mask = size_t(0xF) << (__sr + 4); + for(const char_type* __p = __lo; __p != __hi; ++__p) { - h = (h << 4) + *p; - size_t g = h & mask; - h ^= g | (g >> sr); + __h = (__h << 4) + static_cast(*__p); + size_t __g = __h & __mask; + __h ^= __g | (__g >> __sr); } - return static_cast(h); + return static_cast(__h); } -extern template class _LIBCPP_VISIBLE collate; -extern template class _LIBCPP_VISIBLE collate; +_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_VISIBLE collate) +_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_VISIBLE collate) // template class collate_byname; @@ -319,7 +328,7 @@ public: static const mask xdigit = _ISxdigit; static const mask blank = _ISblank; #elif _WIN32 - typedef unsigned __int32 mask; + typedef unsigned short mask; static const mask space = _SPACE; static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT; static const mask cntrl = _CONTROL; @@ -330,24 +339,13 @@ public: static const mask punct = _PUNCT; static const mask xdigit = _HEX; static const mask blank = _BLANK; -#elif defined( EMSCRIPTEN ) - #define _ISbit(bit) ((bit) < 8 ? ((1 << (bit)) << 8) : ((1 << (bit)) >> 8)) - typedef __uint16_t mask; - static const mask upper = _ISbit( 0 ); - static const mask lower = _ISbit( 1 ); - static const mask alpha = _ISbit( 2 ); - static const mask digit = _ISbit( 3 ); - static const mask xdigit = _ISbit( 4 ); - static const mask space = _ISbit( 5 ); - static const mask print = _ISbit( 6 ); - static const mask blank = _ISbit( 8 ); - static const mask cntrl = _ISbit( 9 ); - static const mask punct = _ISbit( 10 ); -#else // __GLIBC__ || _WIN32 -#if defined(__APPLE__) +#elif (__APPLE__ || __FreeBSD__ || EMSCRIPTEN) +#if __APPLE__ typedef __uint32_t mask; #elif __FreeBSD__ typedef unsigned long mask; +#elif EMSCRIPTEN + typedef unsigned short mask; #endif static const mask space = _CTYPE_S; static const mask print = _CTYPE_R; @@ -359,7 +357,31 @@ public: static const mask punct = _CTYPE_P; static const mask xdigit = _CTYPE_X; static const mask blank = _CTYPE_B; -#endif // __GLIBC__ || _WIN32 +#elif __sun__ + typedef unsigned int mask; + static const mask space = _ISSPACE; + static const mask print = _ISPRINT; + static const mask cntrl = _ISCNTRL; + static const mask upper = _ISUPPER; + static const mask lower = _ISLOWER; + static const mask alpha = _ISALPHA; + static const mask digit = _ISDIGIT; + static const mask punct = _ISPUNCT; + static const mask xdigit = _ISXDIGIT; + static const mask blank = _ISBLANK; +#else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__ || EMSCRIPTEN || __sun__ + typedef unsigned long mask; + static const mask space = 1<<0; + static const mask print = 1<<1; + static const mask cntrl = 1<<2; + static const mask upper = 1<<3; + static const mask lower = 1<<4; + static const mask alpha = 1<<5; + static const mask digit = 1<<6; + static const mask punct = 1<<7; + static const mask xdigit = 1<<8; + static const mask blank = 1<<9; +#endif // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__ static const mask alnum = alpha | digit; static const mask graph = alnum | punct; @@ -484,14 +506,14 @@ public: _LIBCPP_ALWAYS_INLINE bool is(mask __m, char_type __c) const { - return isascii(__c) ? __tab_[__c] & __m : false; + return isascii(__c) ? __tab_[static_cast(__c)] & __m : false; } _LIBCPP_ALWAYS_INLINE const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const { for (; __low != __high; ++__low, ++__vec) - *__vec = isascii(*__low) ? __tab_[*__low] : 0; + *__vec = isascii(*__low) ? __tab_[static_cast(*__low)] : 0; return __low; } @@ -499,7 +521,7 @@ public: const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const { for (; __low != __high; ++__low) - if (isascii(*__low) && (__tab_[*__low] & __m)) + if (isascii(*__low) && (__tab_[static_cast(*__low)] & __m)) break; return __low; } @@ -508,7 +530,7 @@ public: const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const { for (; __low != __high; ++__low) - if (!(isascii(*__low) && (__tab_[*__low] & __m))) + if (!(isascii(*__low) && (__tab_[static_cast(*__low)] & __m))) break; return __low; } @@ -570,7 +592,7 @@ public: #endif _LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;} static const mask* classic_table() _NOEXCEPT; -#ifndef _LIBCPP_STABLE_APPLE_ABI +#if defined(__GLIBC__) || defined(EMSCRIPTEN) static const int* __classic_upper_table() _NOEXCEPT; static const int* __classic_lower_table() _NOEXCEPT; #endif @@ -1115,14 +1137,14 @@ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname() { } -extern template class codecvt_byname; -extern template class codecvt_byname; -extern template class codecvt_byname; -extern template class codecvt_byname; +_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname) +_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname) +_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname) +_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname) _LIBCPP_VISIBLE void __throw_runtime_error(const char*); -template +template struct __narrow_to_utf8 { template @@ -1212,7 +1234,7 @@ struct __narrow_to_utf8<32> } }; -template +template struct __widen_from_utf8 { template diff --git a/system/include/libcxx/__mutex_base b/system/include/libcxx/__mutex_base index 9e472fcc267a0..e936ad3057bb8 100644 --- a/system/include/libcxx/__mutex_base +++ b/system/include/libcxx/__mutex_base @@ -16,7 +16,9 @@ #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif #ifdef _LIBCPP_SHARED_LOCK @@ -36,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: @@ -45,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_;} @@ -56,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; + +#else -//constexpr -extern const -try_to_lock_t try_to_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(); -//constexpr -extern const -adopt_lock_t adopt_lock; +#endif template class _LIBCPP_VISIBLE lock_guard @@ -104,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) @@ -139,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(); @@ -188,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; @@ -203,12 +211,12 @@ public: } _LIBCPP_INLINE_VISIBILITY - bool owns_lock() const {return __owns_;} + bool owns_lock() const _NOEXCEPT {return __owns_;} _LIBCPP_INLINE_VISIBILITY -// explicit - operator bool () const {return __owns_;} + _LIBCPP_EXPLICIT + operator bool () const _NOEXCEPT {return __owns_;} _LIBCPP_INLINE_VISIBILITY - mutex_type* mutex() const {return __m_;} + mutex_type* mutex() const _NOEXCEPT {return __m_;} }; template @@ -274,18 +282,19 @@ 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 { - enum _ { + enum __lx { no_timeout, timeout }; - _ __v_; + __lx __v_; - _LIBCPP_INLINE_VISIBILITY cv_status(_ __v) : __v_(__v) {} + _LIBCPP_INLINE_VISIBILITY cv_status(__lx __v) : __v_(__v) {} _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;} }; @@ -295,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: @@ -303,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, @@ -369,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; } @@ -414,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/system/include/libcxx/__split_buffer b/system/include/libcxx/__split_buffer index d5b8f0a3ee2c2..e0aa13b898832 100644 --- a/system/include/libcxx/__split_buffer +++ b/system/include/libcxx/__split_buffer @@ -6,7 +6,11 @@ #include #include +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -91,7 +95,7 @@ public: void reserve(size_type __n); void shrink_to_fit() _NOEXCEPT; void push_front(const_reference __x); - void push_back(const_reference __x); + _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) void push_front(value_type&& __x); void push_back(value_type&& __x); @@ -129,8 +133,10 @@ public: _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last) _NOEXCEPT - {__destruct_at_end(__new_last, is_trivially_destructible());} + {__destruct_at_end(__new_last, false_type());} + _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT; void swap(__split_buffer& __x) @@ -148,7 +154,7 @@ private: } _LIBCPP_INLINE_VISIBILITY - void __move_assign_alloc(__split_buffer& __c, false_type) _NOEXCEPT + void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY @@ -167,7 +173,7 @@ private: } _LIBCPP_INLINE_VISIBILITY - static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type) _NOEXCEPT + static void __swap_alloc(__alloc_rr&, __alloc_rr&, false_type) _NOEXCEPT {} }; @@ -283,7 +289,7 @@ _LIBCPP_INLINE_VISIBILITY inline void __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type) { - while (__begin_ < __new_begin) + while (__begin_ != __new_begin) __alloc_traits::destroy(__alloc(), __begin_++); } @@ -300,7 +306,7 @@ _LIBCPP_INLINE_VISIBILITY inline void __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT { - while (__new_last < __end_) + while (__new_last != __end_) __alloc_traits::destroy(__alloc(), --__end_); } @@ -388,8 +394,8 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __al __first_ = __alloc_traits::allocate(__alloc(), __cap); __begin_ = __end_ = __first_; __end_cap() = __first_ + __cap; - typedef move_iterator _I; - __construct_at_end(_I(__c.begin()), _I(__c.end())); + typedef move_iterator _Ip; + __construct_at_end(_Ip(__c.begin()), _Ip(__c.end())); } } @@ -486,7 +492,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x) } else { - size_type __c = max(2 * (__end_cap() - __first_), 1); + size_type __c = max(2 * static_cast(__end_cap() - __first_), 1); __split_buffer __t(__c, (__c + 3) / 4, __alloc()); __t.__construct_at_end(move_iterator(__begin_), move_iterator(__end_)); @@ -517,7 +523,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x) } else { - size_type __c = max(2 * (__end_cap() - __first_), 1); + size_type __c = max(2 * static_cast(__end_cap() - __first_), 1); __split_buffer __t(__c, (__c + 3) / 4, __alloc()); __t.__construct_at_end(move_iterator(__begin_), move_iterator(__end_)); @@ -550,7 +556,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x) } else { - size_type __c = max(2 * (__end_cap() - __first_), 1); + size_type __c = max(2 * static_cast(__end_cap() - __first_), 1); __split_buffer __t(__c, __c / 4, __alloc()); __t.__construct_at_end(move_iterator(__begin_), move_iterator(__end_)); @@ -581,7 +587,7 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x) } else { - size_type __c = max(2 * (__end_cap() - __first_), 1); + size_type __c = max(2 * static_cast(__end_cap() - __first_), 1); __split_buffer __t(__c, __c / 4, __alloc()); __t.__construct_at_end(move_iterator(__begin_), move_iterator(__end_)); @@ -614,7 +620,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args) } else { - size_type __c = max(2 * (__end_cap() - __first_), 1); + size_type __c = max(2 * static_cast(__end_cap() - __first_), 1); __split_buffer __t(__c, __c / 4, __alloc()); __t.__construct_at_end(move_iterator(__begin_), move_iterator(__end_)); diff --git a/system/include/libcxx/__sso_allocator b/system/include/libcxx/__sso_allocator index d25fc484d3883..7240072cafdf6 100644 --- a/system/include/libcxx/__sso_allocator +++ b/system/include/libcxx/__sso_allocator @@ -15,24 +15,26 @@ #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD -template class _LIBCPP_HIDDEN __sso_allocator; +template class _LIBCPP_HIDDEN __sso_allocator; -template -class _LIBCPP_HIDDEN __sso_allocator +template +class _LIBCPP_HIDDEN __sso_allocator { public: typedef const void* const_pointer; typedef void value_type; }; -template +template class _LIBCPP_HIDDEN __sso_allocator { - typename aligned_storage::type buf_; + typename aligned_storage::type buf_; bool __allocated_; public: typedef size_t size_type; @@ -41,14 +43,14 @@ public: _LIBCPP_INLINE_VISIBILITY __sso_allocator() throw() : __allocated_(false) {} _LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator&) throw() : __allocated_(false) {} - template _LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator<_Up, _N>&) throw() + template _LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator<_Up, _Np>&) throw() : __allocated_(false) {} private: __sso_allocator& operator=(const __sso_allocator&); public: - _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator::const_pointer = 0) + _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator::const_pointer = 0) { - if (!__allocated_ && __n <= _N) + if (!__allocated_ && __n <= _Np) { __allocated_ = true; return (pointer)&buf_; diff --git a/system/include/libcxx/__std_stream b/system/include/libcxx/__std_stream index 6ab0fd6077d25..e562e2c473049 100644 --- a/system/include/libcxx/__std_stream +++ b/system/include/libcxx/__std_stream @@ -17,11 +17,15 @@ #include <__locale> #include +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD -static const unsigned __limit = 8; +static const int __limit = 8; // __stdinbuf @@ -100,7 +104,7 @@ __stdinbuf<_CharT>::__getchar(bool __consume) int __nread = _VSTD::max(1, __encoding_); for (int __i = 0; __i < __nread; ++__i) { - char __c = getc(__file_); + int __c = getc(__file_); if (__c == EOF) return traits_type::eof(); __extbuf[__i] = static_cast(__c); @@ -127,7 +131,7 @@ __stdinbuf<_CharT>::__getchar(bool __consume) if (__nread == sizeof(__extbuf)) return traits_type::eof(); { - char __c = getc(__file_); + int __c = getc(__file_); if (__c == EOF) return traits_type::eof(); __extbuf[__nread] = static_cast(__c); @@ -264,7 +268,7 @@ __stdoutbuf<_CharT>::overflow(int_type __c) if (__r == codecvt_base::partial) { this->setp((char_type*)__e, this->pptr()); - this->pbump(this->epptr() - this->pbase()); + this->pbump(static_cast(this->epptr() - this->pbase())); } } else diff --git a/system/include/libcxx/__tree b/system/include/libcxx/__tree index 6c4b6e60ae787..bd38b4f2b32a8 100644 --- a/system/include/libcxx/__tree +++ b/system/include/libcxx/__tree @@ -17,7 +17,9 @@ #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -612,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 @@ -930,14 +932,14 @@ public: __emplace_hint_multi(const_iterator __p, _Args&&... __args); #endif // _LIBCPP_HAS_NO_VARIADICS - template - pair __insert_unique(_V&& __v); - template - iterator __insert_unique(const_iterator __p, _V&& __v); - template - iterator __insert_multi(_V&& __v); - template - iterator __insert_multi(const_iterator __p, _V&& __v); + template + pair __insert_unique(_Vp&& __v); + template + iterator __insert_unique(const_iterator __p, _Vp&& __v); + template + iterator __insert_multi(_Vp&& __v); + template + iterator __insert_multi(const_iterator __p, _Vp&& __v); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES pair __insert_unique(const value_type& __v); @@ -1019,8 +1021,8 @@ public: pair __equal_range_multi(const _Key& __k) const; - typedef __tree_node_destructor<__node_allocator> _D; - typedef unique_ptr<__node, _D> __node_holder; + typedef __tree_node_destructor<__node_allocator> _Dp; + typedef unique_ptr<__node, _Dp> __node_holder; __node_holder remove(const_iterator __p) _NOEXCEPT; private: @@ -1709,7 +1711,7 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args) { __node_allocator& __na = __node_alloc(); - __node_holder __h(__node_traits::allocate(__na, 1), _D(__na)); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...); __h.get_deleter().__value_constructed = true; return __h; @@ -1779,11 +1781,11 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p, #endif // _LIBCPP_HAS_NO_VARIADICS template -template +template pair::iterator, bool> -__tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v) +__tree<_Tp, _Compare, _Allocator>::__insert_unique(_Vp&& __v) { - __node_holder __h = __construct_node(_VSTD::forward<_V>(__v)); + __node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v)); pair __r = __node_insert_unique(__h.get()); if (__r.second) __h.release(); @@ -1791,11 +1793,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v) } template -template +template typename __tree<_Tp, _Compare, _Allocator>::iterator -__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v) +__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _Vp&& __v) { - __node_holder __h = __construct_node(_VSTD::forward<_V>(__v)); + __node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v)); iterator __r = __node_insert_unique(__p, __h.get()); if (__r.__ptr_ == __h.get()) __h.release(); @@ -1803,11 +1805,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v) } template -template +template typename __tree<_Tp, _Compare, _Allocator>::iterator -__tree<_Tp, _Compare, _Allocator>::__insert_multi(_V&& __v) +__tree<_Tp, _Compare, _Allocator>::__insert_multi(_Vp&& __v) { - __node_holder __h = __construct_node(_VSTD::forward<_V>(__v)); + __node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v)); __node_base_pointer __parent; __node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_); __insert_node_at(__parent, __child, __h.get()); @@ -1815,11 +1817,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(_V&& __v) } template -template +template typename __tree<_Tp, _Compare, _Allocator>::iterator -__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _V&& __v) +__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _Vp&& __v) { - __node_holder __h = __construct_node(_VSTD::forward<_V>(__v)); + __node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v)); __node_base_pointer __parent; __node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_); __insert_node_at(__parent, __child, __h.get()); @@ -1833,7 +1835,7 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder __tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v) { __node_allocator& __na = __node_alloc(); - __node_holder __h(__node_traits::allocate(__na, 1), _D(__na)); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v); __h.get_deleter().__value_constructed = true; return _VSTD::move(__h); @@ -2051,7 +2053,7 @@ template typename __tree<_Tp, _Compare, _Allocator>::size_type __tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const { - typedef pair _P; + typedef pair _Pp; __node_const_pointer __result = __end_node(); __node_const_pointer __rt = __root(); while (__rt != nullptr) @@ -2158,7 +2160,7 @@ pair::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator> __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) { - typedef pair _P; + typedef pair _Pp; __node_pointer __result = __end_node(); __node_pointer __rt = __root(); while (__rt != nullptr) @@ -2171,13 +2173,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) else if (value_comp()(__rt->__value_, __k)) __rt = static_cast<__node_pointer>(__rt->__right_); else - return _P(iterator(__rt), + return _Pp(iterator(__rt), iterator( __rt->__right_ != nullptr ? static_cast<__node_pointer>(__tree_min(__rt->__right_)) : __result)); } - return _P(iterator(__result), iterator(__result)); + return _Pp(iterator(__result), iterator(__result)); } template @@ -2186,7 +2188,7 @@ pair::const_iterator, typename __tree<_Tp, _Compare, _Allocator>::const_iterator> __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const { - typedef pair _P; + typedef pair _Pp; __node_const_pointer __result = __end_node(); __node_const_pointer __rt = __root(); while (__rt != nullptr) @@ -2199,13 +2201,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const else if (value_comp()(__rt->__value_, __k)) __rt = static_cast<__node_const_pointer>(__rt->__right_); else - return _P(const_iterator(__rt), + return _Pp(const_iterator(__rt), const_iterator( __rt->__right_ != nullptr ? static_cast<__node_const_pointer>(__tree_min(__rt->__right_)) : __result)); } - return _P(const_iterator(__result), const_iterator(__result)); + return _Pp(const_iterator(__result), const_iterator(__result)); } template @@ -2214,7 +2216,7 @@ pair::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator> __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) { - typedef pair _P; + typedef pair _Pp; __node_pointer __result = __end_node(); __node_pointer __rt = __root(); while (__rt != nullptr) @@ -2227,10 +2229,10 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) else if (value_comp()(__rt->__value_, __k)) __rt = static_cast<__node_pointer>(__rt->__right_); else - return _P(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), __rt), + return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), __rt), __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result)); } - return _P(iterator(__result), iterator(__result)); + return _Pp(iterator(__result), iterator(__result)); } template @@ -2239,7 +2241,7 @@ pair::const_iterator, typename __tree<_Tp, _Compare, _Allocator>::const_iterator> __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const { - typedef pair _P; + typedef pair _Pp; __node_const_pointer __result = __end_node(); __node_const_pointer __rt = __root(); while (__rt != nullptr) @@ -2252,10 +2254,10 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const else if (value_comp()(__rt->__value_, __k)) __rt = static_cast<__node_const_pointer>(__rt->__right_); else - return _P(__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt), + return _Pp(__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt), __upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result)); } - return _P(const_iterator(__result), const_iterator(__result)); + return _Pp(const_iterator(__result), const_iterator(__result)); } template @@ -2273,7 +2275,7 @@ __tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT --size(); __tree_remove(__end_node()->__left_, static_cast<__node_base_pointer>(__np)); - return __node_holder(__np, _D(__node_alloc())); + return __node_holder(__np, _Dp(__node_alloc())); } template diff --git a/system/include/libcxx/__tuple b/system/include/libcxx/__tuple index 918656ed83866..1fa90a0088a31 100644 --- a/system/include/libcxx/__tuple +++ b/system/include/libcxx/__tuple @@ -15,7 +15,9 @@ #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif #ifdef _LIBCPP_HAS_NO_VARIADICS @@ -63,7 +65,7 @@ public: }; template class _LIBCPP_VISIBLE tuple; -template class _LIBCPP_VISIBLE pair; +template struct _LIBCPP_VISIBLE pair; template struct _LIBCPP_VISIBLE array; template struct __tuple_like : false_type {}; @@ -77,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; @@ -214,7 +225,7 @@ struct __tuple_convertible_imp : public false_type {}; template struct __tuple_convertible_imp, __tuple_types<_Up0, _Up...> > : public integral_constant::value && + is_convertible<_Tp0, _Up0>::value && __tuple_convertible_imp, __tuple_types<_Up...> >::value> {}; template <> @@ -233,6 +244,33 @@ struct __tuple_convertible<_Tp, _Up, true, true> typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type> {}; +// __tuple_constructible + +template +struct __tuple_constructible_imp : public false_type {}; + +template +struct __tuple_constructible_imp, __tuple_types<_Up0, _Up...> > + : public integral_constant::value && + __tuple_constructible_imp, __tuple_types<_Up...> >::value> {}; + +template <> +struct __tuple_constructible_imp, __tuple_types<> > + : public true_type {}; + +template ::type>::value, + bool = __tuple_like<_Up>::value> +struct __tuple_constructible + : public false_type {}; + +template +struct __tuple_constructible<_Tp, _Up, true, true> + : public __tuple_constructible_imp::type>::value == + tuple_size<_Up>::value, + typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type> +{}; + // __tuple_assignable template diff --git a/system/include/libcxx/__tuple_03 b/system/include/libcxx/__tuple_03 index 61049191cb2bd..a28ac0800ae9d 100644 --- a/system/include/libcxx/__tuple_03 +++ b/system/include/libcxx/__tuple_03 @@ -13,7 +13,9 @@ #include <__config> +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/system/include/libcxx/__undef_min_max b/system/include/libcxx/__undef_min_max new file mode 100644 index 0000000000000..b1e80d1b0499f --- /dev/null +++ b/system/include/libcxx/__undef_min_max @@ -0,0 +1,19 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +#ifdef min +#warning: macro min is incompatible with C++. #undefing min +#undef min +#endif + +#ifdef max +#warning: macro max is incompatible with C++. #undefing max +#undef max +#endif diff --git a/system/include/libcxx/algorithm b/system/include/libcxx/algorithm index d6906a209e85c..4adcc69674ce9 100644 --- a/system/include/libcxx/algorithm +++ b/system/include/libcxx/algorithm @@ -593,9 +593,13 @@ template #include #include #include -#include +#include +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -693,14 +697,48 @@ struct __debug_less #endif // _LIBCPP_DEBUG2 // Precondition: __x != 0 -inline _LIBCPP_INLINE_VISIBILITY unsigned __ctz(unsigned __x) {return __builtin_ctz (__x);} -inline _LIBCPP_INLINE_VISIBILITY unsigned long __ctz(unsigned long __x) {return __builtin_ctzl (__x);} -inline _LIBCPP_INLINE_VISIBILITY unsigned long long __ctz(unsigned long long __x) {return __builtin_ctzll(__x);} +inline _LIBCPP_INLINE_VISIBILITY +unsigned +__ctz(unsigned __x) +{ + return static_cast(__builtin_ctz(__x)); +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long +__ctz(unsigned long __x) +{ + return static_cast(__builtin_ctzl(__x)); +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long long +__ctz(unsigned long long __x) +{ + return static_cast(__builtin_ctzll(__x)); +} // Precondition: __x != 0 -inline _LIBCPP_INLINE_VISIBILITY unsigned __clz(unsigned __x) {return __builtin_clz (__x);} -inline _LIBCPP_INLINE_VISIBILITY unsigned long __clz(unsigned long __x) {return __builtin_clzl (__x);} -inline _LIBCPP_INLINE_VISIBILITY unsigned long long __clz(unsigned long long __x) {return __builtin_clzll(__x);} +inline _LIBCPP_INLINE_VISIBILITY +unsigned +__clz(unsigned __x) +{ + return static_cast(__builtin_clz(__x)); +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long +__clz(unsigned long __x) +{ + return static_cast(__builtin_clzl (__x)); +} + +inline _LIBCPP_INLINE_VISIBILITY +unsigned long long +__clz(unsigned long long __x) +{ + return static_cast(__builtin_clzll(__x)); +} inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) {return __builtin_popcount (__x);} inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) {return __builtin_popcountl (__x);} @@ -762,10 +800,10 @@ for_each(_InputIterator __first, _InputIterator __last, _Function __f) template inline _LIBCPP_INLINE_VISIBILITY _InputIterator -find(_InputIterator __first, _InputIterator __last, const _Tp& __value) +find(_InputIterator __first, _InputIterator __last, const _Tp& __value_) { for (; __first != __last; ++__first) - if (*__first == __value) + if (*__first == __value_) break; return __first; } @@ -1002,11 +1040,11 @@ adjacent_find(_ForwardIterator __first, _ForwardIterator __last) template inline _LIBCPP_INLINE_VISIBILITY typename iterator_traits<_InputIterator>::difference_type -count(_InputIterator __first, _InputIterator __last, const _Tp& __value) +count(_InputIterator __first, _InputIterator __last, const _Tp& __value_) { typename iterator_traits<_InputIterator>::difference_type __r(0); for (; __first != __last; ++__first) - if (*__first == __value) + if (*__first == __value_) ++__r; return __r; } @@ -1310,22 +1348,22 @@ search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, template _ForwardIterator __search_n(_ForwardIterator __first, _ForwardIterator __last, - _Size __count, const _Tp& __value, _BinaryPredicate __pred, forward_iterator_tag) + _Size __count, const _Tp& __value_, _BinaryPredicate __pred, forward_iterator_tag) { if (__count <= 0) return __first; while (true) { - // Find first element in sequence that matchs __value, with a mininum of loop checks + // Find first element in sequence that matchs __value_, with a mininum of loop checks while (true) { - if (__first == __last) // return __last if no element matches __value + if (__first == __last) // return __last if no element matches __value_ return __last; - if (__pred(*__first, __value)) + if (__pred(*__first, __value_)) break; ++__first; } - // *__first matches __value, now match elements after here + // *__first matches __value_, now match elements after here _ForwardIterator __m = __first; _Size __c(0); while (true) @@ -1334,7 +1372,7 @@ __search_n(_ForwardIterator __first, _ForwardIterator __last, return __first; if (++__m == __last) // Otherwise if source exhaused, pattern not found return __last; - if (!__pred(*__m, __value)) // if there is a mismatch, restart with a new __first + if (!__pred(*__m, __value_)) // if there is a mismatch, restart with a new __first { __first = __m; ++__first; @@ -1347,7 +1385,7 @@ __search_n(_ForwardIterator __first, _ForwardIterator __last, template _RandomAccessIterator __search_n(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Size __count, const _Tp& __value, _BinaryPredicate __pred, random_access_iterator_tag) + _Size __count, const _Tp& __value_, _BinaryPredicate __pred, random_access_iterator_tag) { if (__count <= 0) return __first; @@ -1357,16 +1395,16 @@ __search_n(_RandomAccessIterator __first, _RandomAccessIterator __last, const _RandomAccessIterator __s = __last - (__count - 1); // Start of pattern match can't go beyond here while (true) { - // Find first element in sequence that matchs __value, with a mininum of loop checks + // Find first element in sequence that matchs __value_, with a mininum of loop checks while (true) { - if (__first == __s) // return __last if no element matches __value + if (__first == __s) // return __last if no element matches __value_ return __last; - if (__pred(*__first, __value)) + if (__pred(*__first, __value_)) break; ++__first; } - // *__first matches __value, now match elements after here + // *__first matches __value_, now match elements after here _RandomAccessIterator __m = __first; _Size __c(0); while (true) @@ -1374,7 +1412,7 @@ __search_n(_RandomAccessIterator __first, _RandomAccessIterator __last, if (++__c == __count) // If pattern exhausted, __first is the answer (works for 1 element pattern) return __first; ++__m; // no need to check range on __m because __s guarantees we have enough source - if (!__pred(*__m, __value)) // if there is a mismatch, restart with a new __first + if (!__pred(*__m, __value_)) // if there is a mismatch, restart with a new __first { __first = __m; ++__first; @@ -1388,19 +1426,19 @@ template ::type> - (__first, __last, __count, __value, __pred, typename iterator_traits<_ForwardIterator>::iterator_category()); + (__first, __last, __count, __value_, __pred, typename iterator_traits<_ForwardIterator>::iterator_category()); } template inline _LIBCPP_INLINE_VISIBILITY _ForwardIterator -search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value) +search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_) { typedef typename iterator_traits<_ForwardIterator>::value_type __v; - return _VSTD::search_n(__first, __last, __count, __value, __equal_to<__v, _Tp>()); + return _VSTD::search_n(__first, __last, __count, __value_, __equal_to<__v, _Tp>()); } // copy @@ -1490,10 +1528,10 @@ copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) // copy_backward -template +template inline _LIBCPP_INLINE_VISIBILITY _OutputIterator -__copy_backward(_InputIterator __first, _InputIterator __last, _OutputIterator __result) +__copy_backward(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result) { while (__first != __last) *--__result = *--__last; @@ -1742,29 +1780,29 @@ replace_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator _ template inline _LIBCPP_INLINE_VISIBILITY _OutputIterator -__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value, false_type) +__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_, false_type) { for (; __n > 0; ++__first, --__n) - *__first = __value; + *__first = __value_; return __first; } template inline _LIBCPP_INLINE_VISIBILITY _OutputIterator -__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value, true_type) +__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_, true_type) { if (__n > 0) - _VSTD::memset(__first, (unsigned char)__value, (size_t)(__n)); + _VSTD::memset(__first, (unsigned char)__value_, (size_t)(__n)); return __first + __n; } template inline _LIBCPP_INLINE_VISIBILITY _OutputIterator -fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) +fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_) { - return _VSTD::__fill_n(__first, __n, __value, integral_constant::value && is_trivially_copy_assignable<_Tp>::value && sizeof(_Tp) == 1>()); @@ -1775,26 +1813,26 @@ fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) template inline _LIBCPP_INLINE_VISIBILITY void -__fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, forward_iterator_tag) +__fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, forward_iterator_tag) { for (; __first != __last; ++__first) - *__first = __value; + *__first = __value_; } template inline _LIBCPP_INLINE_VISIBILITY void -__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value, random_access_iterator_tag) +__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value_, random_access_iterator_tag) { - _VSTD::fill_n(__first, __last - __first, __value); + _VSTD::fill_n(__first, __last - __first, __value_); } template inline _LIBCPP_INLINE_VISIBILITY void -fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) +fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) { - _VSTD::__fill(__first, __last, __value, typename iterator_traits<_ForwardIterator>::iterator_category()); + _VSTD::__fill(__first, __last, __value_, typename iterator_traits<_ForwardIterator>::iterator_category()); } // generate @@ -1824,15 +1862,15 @@ generate_n(_OutputIterator __first, _Size __n, _Generator __gen) template _ForwardIterator -remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) +remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) { - __first = _VSTD::find(__first, __last, __value); + __first = _VSTD::find(__first, __last, __value_); if (__first != __last) { _ForwardIterator __i = __first; while (++__i != __last) { - if (!(*__i == __value)) + if (!(*__i == __value_)) { *__first = _VSTD::move(*__i); ++__first; @@ -1870,11 +1908,11 @@ remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) template inline _LIBCPP_INLINE_VISIBILITY _OutputIterator -remove_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __value) +remove_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __value_) { for (; __first != __last; ++__first) { - if (!(*__first == __value)) + if (!(*__first == __value_)) { *__result = *__first; ++__result; @@ -2065,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) { @@ -2118,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) @@ -2134,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) @@ -2150,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 @@ -2326,10 +2421,7 @@ minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __com if (++__first != __last) { if (__comp(*__first, *__result.first)) - { - __result.second = __result.first; __result.first = __first; - } else __result.second = __first; while (++__first != __last) @@ -2421,29 +2513,29 @@ minmax(initializer_list<_Tp> __t, _Compare __comp) // __independent_bits_engine -template +template struct __log2_imp { - static const size_t value = _X & ((unsigned long long)(1) << _R) ? _R - : __log2_imp<_X, _R - 1>::value; + static const size_t value = _Xp & ((unsigned long long)(1) << _Rp) ? _Rp + : __log2_imp<_Xp, _Rp - 1>::value; }; -template -struct __log2_imp<_X, 0> +template +struct __log2_imp<_Xp, 0> { static const size_t value = 0; }; -template -struct __log2_imp<0, _R> +template +struct __log2_imp<0, _Rp> { - static const size_t value = _R + 1; + static const size_t value = _Rp + 1; }; -template +template struct __log2 { - static const size_t value = __log2_imp<_X, + static const size_t value = __log2_imp<_Xp, sizeof(_UI) * __CHAR_BIT__ - 1>::value; }; @@ -2473,18 +2565,23 @@ private: _Engine_result_type __mask0_; _Engine_result_type __mask1_; - static const _Working_result_type _R = _Engine::_Max - _Engine::_Min - + _Working_result_type(1); - static const size_t __m = __log2<_Working_result_type, _R>::value; - static const size_t _WDt = numeric_limits<_Working_result_type>::digits; - static const size_t _EDt = numeric_limits<_Engine_result_type>::digits; +#ifdef _LIBCPP_HAS_NO_CONSTEXPR + static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min + + _Working_result_type(1); +#else + static _LIBCPP_CONSTEXPR const _Working_result_type _Rp = _Engine::max() - _Engine::min() + + _Working_result_type(1); +#endif + static _LIBCPP_CONSTEXPR const size_t __m = __log2<_Working_result_type, _Rp>::value; + static _LIBCPP_CONSTEXPR const size_t _WDt = numeric_limits<_Working_result_type>::digits; + static _LIBCPP_CONSTEXPR const size_t _EDt = numeric_limits<_Engine_result_type>::digits; public: // constructors and seeding functions __independent_bits_engine(_Engine& __e, size_t __w); // generating functions - result_type operator()() {return __eval(integral_constant());} + result_type operator()() {return __eval(integral_constant());} private: result_type __eval(false_type); @@ -2499,24 +2596,24 @@ __independent_bits_engine<_Engine, _UIntType> { __n_ = __w_ / __m + (__w_ % __m != 0); __w0_ = __w_ / __n_; - if (_R == 0) - __y0_ = _R; + if (_Rp == 0) + __y0_ = _Rp; else if (__w0_ < _WDt) - __y0_ = (_R >> __w0_) << __w0_; + __y0_ = (_Rp >> __w0_) << __w0_; else __y0_ = 0; - if (_R - __y0_ > __y0_ / __n_) + if (_Rp - __y0_ > __y0_ / __n_) { ++__n_; __w0_ = __w_ / __n_; if (__w0_ < _WDt) - __y0_ = (_R >> __w0_) << __w0_; + __y0_ = (_Rp >> __w0_) << __w0_; else __y0_ = 0; } __n0_ = __n_ - __w_ % __n_; if (__w0_ < _WDt - 1) - __y1_ = (_R >> (__w0_ + 1)) << (__w0_ + 1); + __y1_ = (_Rp >> (__w0_ + 1)) << (__w0_ + 1); else __y1_ = 0; __mask0_ = __w0_ > 0 ? _Engine_result_type(~0) >> (_EDt - __w0_) : @@ -2538,7 +2635,7 @@ template _UIntType __independent_bits_engine<_Engine, _UIntType>::__eval(true_type) { - result_type _S = 0; + result_type _Sp = 0; for (size_t __k = 0; __k < __n0_; ++__k) { _Engine_result_type __u; @@ -2546,11 +2643,11 @@ __independent_bits_engine<_Engine, _UIntType>::__eval(true_type) { __u = __e_() - _Engine::min(); } while (__u >= __y0_); - if (__w0_ < _EDt) - _S <<= __w0_; + if (__w0_ < _WDt) + _Sp <<= __w0_; else - _S = 0; - _S += __u & __mask0_; + _Sp = 0; + _Sp += __u & __mask0_; } for (size_t __k = __n0_; __k < __n_; ++__k) { @@ -2559,13 +2656,13 @@ __independent_bits_engine<_Engine, _UIntType>::__eval(true_type) { __u = __e_() - _Engine::min(); } while (__u >= __y1_); - if (__w0_ < _EDt - 1) - _S <<= __w0_ + 1; + if (__w0_ < _WDt - 1) + _Sp <<= __w0_ + 1; else - _S = 0; - _S += __u & __mask1_; + _Sp = 0; + _Sp += __u & __mask1_; } - return _S; + return _Sp; } // uniform_int_distribution @@ -2638,22 +2735,22 @@ uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p { typedef typename conditional::type _UIntType; - const _UIntType _R = __p.b() - __p.a() + _UIntType(1); - if (_R == 1) + const _UIntType _Rp = __p.b() - __p.a() + _UIntType(1); + if (_Rp == 1) return __p.a(); const size_t _Dt = numeric_limits<_UIntType>::digits; typedef __independent_bits_engine<_URNG, _UIntType> _Eng; - if (_R == 0) + if (_Rp == 0) return static_cast(_Eng(__g, _Dt)()); - size_t __w = _Dt - __clz(_R) - 1; - if ((_R & (_UIntType(~0) >> (_Dt - __w))) != 0) + size_t __w = _Dt - __clz(_Rp) - 1; + if ((_Rp & (_UIntType(~0) >> (_Dt - __w))) != 0) ++__w; _Eng __e(__g, __w); _UIntType __u; do { __u = __e(); - } while (__u >= _R); + } while (__u >= _Rp); return static_cast(__u + __p.a()); } @@ -2667,7 +2764,7 @@ class __rs_default __rs_default(); public: - typedef unsigned result_type; + typedef uint_fast32_t result_type; static const result_type _Min = 0; static const result_type _Max = 0xFFFFFFFF; @@ -2677,8 +2774,8 @@ public: result_type operator()(); - static const/*expr*/ result_type min() {return _Min;} - static const/*expr*/ result_type max() {return _Max;} + static _LIBCPP_CONSTEXPR result_type min() {return _Min;} + static _LIBCPP_CONSTEXPR result_type max() {return _Max;} friend __rs_default __rs_get(); }; @@ -2690,16 +2787,16 @@ void random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last) { typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; - typedef uniform_int_distribution _D; - typedef typename _D::param_type _P; + typedef uniform_int_distribution _Dp; + typedef typename _Dp::param_type _Pp; difference_type __d = __last - __first; if (__d > 1) { - _D __uid; + _Dp __uid; __rs_default __g = __rs_get(); for (--__last, --__d; __first < __last; ++__first, --__d) { - difference_type __i = __uid(__g, _P(0, __d)); + difference_type __i = __uid(__g, _Pp(0, __d)); if (__i != difference_type(0)) swap(*__first, *(__first + __i)); } @@ -2736,15 +2833,15 @@ template #endif { typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; - typedef uniform_int_distribution _D; - typedef typename _D::param_type _P; + typedef uniform_int_distribution _Dp; + typedef typename _Dp::param_type _Pp; difference_type __d = __last - __first; if (__d > 1) { - _D __uid; + _Dp __uid; for (--__last, --__d; __first < __last; ++__first, --__d) { - difference_type __i = __uid(__g, _P(0, __d)); + difference_type __i = __uid(__g, _Pp(0, __d)); if (__i != difference_type(0)) swap(*__first, *(__first + __i)); } @@ -3681,45 +3778,52 @@ sort(__wrap_iter<_Tp*> __first, __wrap_iter<_Tp*> __last, _Compare __comp) _VSTD::sort<_Tp*, _Comp_ref>(__first.base(), __last.base(), __comp); } -extern template void __sort<__less&, char*>(char*, char*, __less&); -extern template void __sort<__less&, wchar_t*>(wchar_t*, wchar_t*, __less&); -extern template void __sort<__less&, signed char*>(signed char*, signed char*, __less&); -extern template void __sort<__less&, unsigned char*>(unsigned char*, unsigned char*, __less&); -extern template void __sort<__less&, short*>(short*, short*, __less&); -extern template void __sort<__less&, unsigned short*>(unsigned short*, unsigned short*, __less&); -extern template void __sort<__less&, int*>(int*, int*, __less&); -extern template void __sort<__less&, unsigned*>(unsigned*, unsigned*, __less&); -extern template void __sort<__less&, long*>(long*, long*, __less&); -extern template void __sort<__less&, unsigned long*>(unsigned long*, unsigned long*, __less&); -extern template void __sort<__less&, long long*>(long long*, long long*, __less&); -extern template void __sort<__less&, unsigned long long*>(unsigned long long*, unsigned long long*, __less&); -extern template void __sort<__less&, float*>(float*, float*, __less&); -extern template void __sort<__less&, double*>(double*, double*, __less&); -extern template void __sort<__less&, long double*>(long double*, long double*, __less&); - -extern template bool __insertion_sort_incomplete<__less&, char*>(char*, char*, __less&); -extern template bool __insertion_sort_incomplete<__less&, wchar_t*>(wchar_t*, wchar_t*, __less&); -extern template bool __insertion_sort_incomplete<__less&, signed char*>(signed char*, signed char*, __less&); -extern template bool __insertion_sort_incomplete<__less&, unsigned char*>(unsigned char*, unsigned char*, __less&); -extern template bool __insertion_sort_incomplete<__less&, short*>(short*, short*, __less&); -extern template bool __insertion_sort_incomplete<__less&, unsigned short*>(unsigned short*, unsigned short*, __less&); -extern template bool __insertion_sort_incomplete<__less&, int*>(int*, int*, __less&); -extern template bool __insertion_sort_incomplete<__less&, unsigned*>(unsigned*, unsigned*, __less&); -extern template bool __insertion_sort_incomplete<__less&, long*>(long*, long*, __less&); -extern template bool __insertion_sort_incomplete<__less&, unsigned long*>(unsigned long*, unsigned long*, __less&); -extern template bool __insertion_sort_incomplete<__less&, long long*>(long long*, long long*, __less&); -extern template bool __insertion_sort_incomplete<__less&, unsigned long long*>(unsigned long long*, unsigned long long*, __less&); -extern template bool __insertion_sort_incomplete<__less&, float*>(float*, float*, __less&); -extern template bool __insertion_sort_incomplete<__less&, double*>(double*, double*, __less&); -extern template bool __insertion_sort_incomplete<__less&, long double*>(long double*, long double*, __less&); - -extern template unsigned __sort5<__less&, long double*>(long double*, long double*, long double*, long double*, long double*, __less&); +#ifdef _MSC_VER +#pragma warning( push ) +#pragma warning( disable: 4231) +#endif // _MSC_VER +_LIBCPP_EXTERN_TEMPLATE(void __sort<__less&, char*>(char*, char*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(void __sort<__less&, wchar_t*>(wchar_t*, wchar_t*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(void __sort<__less&, signed char*>(signed char*, signed char*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(void __sort<__less&, unsigned char*>(unsigned char*, unsigned char*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(void __sort<__less&, short*>(short*, short*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(void __sort<__less&, unsigned short*>(unsigned short*, unsigned short*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(void __sort<__less&, int*>(int*, int*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(void __sort<__less&, unsigned*>(unsigned*, unsigned*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(void __sort<__less&, long*>(long*, long*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(void __sort<__less&, unsigned long*>(unsigned long*, unsigned long*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(void __sort<__less&, long long*>(long long*, long long*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(void __sort<__less&, unsigned long long*>(unsigned long long*, unsigned long long*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(void __sort<__less&, float*>(float*, float*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(void __sort<__less&, double*>(double*, double*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(void __sort<__less&, long double*>(long double*, long double*, __less&)) + +_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less&, char*>(char*, char*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less&, wchar_t*>(wchar_t*, wchar_t*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less&, signed char*>(signed char*, signed char*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less&, unsigned char*>(unsigned char*, unsigned char*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less&, short*>(short*, short*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less&, unsigned short*>(unsigned short*, unsigned short*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less&, int*>(int*, int*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less&, unsigned*>(unsigned*, unsigned*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less&, long*>(long*, long*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less&, unsigned long*>(unsigned long*, unsigned long*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less&, long long*>(long long*, long long*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less&, unsigned long long*>(unsigned long long*, unsigned long long*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less&, float*>(float*, float*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less&, double*>(double*, double*, __less&)) +_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less&, long double*>(long double*, long double*, __less&)) + +_LIBCPP_EXTERN_TEMPLATE(unsigned __sort5<__less&, long double*>(long double*, long double*, long double*, long double*, long double*, __less&)) +#ifdef _MSC_VER +#pragma warning( pop ) +#endif // _MSC_VER // lower_bound template _ForwardIterator -__lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) +__lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) { typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type; difference_type __len = _VSTD::distance(__first, __last); @@ -3728,7 +3832,7 @@ __lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va difference_type __l2 = __len / 2; _ForwardIterator __m = __first; _VSTD::advance(__m, __l2); - if (__comp(*__m, __value)) + if (__comp(*__m, __value_)) { __first = ++__m; __len -= __l2 + 1; @@ -3742,24 +3846,24 @@ __lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va template inline _LIBCPP_INLINE_VISIBILITY _ForwardIterator -lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) +lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) { #ifdef _LIBCPP_DEBUG2 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref; __debug_less<_Compare> __c(__comp); - return __lower_bound<_Comp_ref>(__first, __last, __value, __c); + return __lower_bound<_Comp_ref>(__first, __last, __value_, __c); #else // _LIBCPP_DEBUG2 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref; - return __lower_bound<_Comp_ref>(__first, __last, __value, __comp); + return __lower_bound<_Comp_ref>(__first, __last, __value_, __comp); #endif // _LIBCPP_DEBUG2 } template inline _LIBCPP_INLINE_VISIBILITY _ForwardIterator -lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) +lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) { - return _VSTD::lower_bound(__first, __last, __value, + return _VSTD::lower_bound(__first, __last, __value_, __less::value_type, _Tp>()); } @@ -3767,7 +3871,7 @@ lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu template _ForwardIterator -__upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) +__upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) { typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type; difference_type __len = _VSTD::distance(__first, __last); @@ -3776,7 +3880,7 @@ __upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va difference_type __l2 = __len / 2; _ForwardIterator __m = __first; _VSTD::advance(__m, __l2); - if (__comp(__value, *__m)) + if (__comp(__value_, *__m)) __len = __l2; else { @@ -3790,24 +3894,24 @@ __upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va template inline _LIBCPP_INLINE_VISIBILITY _ForwardIterator -upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) +upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) { #ifdef _LIBCPP_DEBUG2 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref; __debug_less<_Compare> __c(__comp); - return __upper_bound<_Comp_ref>(__first, __last, __value, __c); + return __upper_bound<_Comp_ref>(__first, __last, __value_, __c); #else // _LIBCPP_DEBUG2 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref; - return __upper_bound<_Comp_ref>(__first, __last, __value, __comp); + return __upper_bound<_Comp_ref>(__first, __last, __value_, __comp); #endif // _LIBCPP_DEBUG2 } template inline _LIBCPP_INLINE_VISIBILITY _ForwardIterator -upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) +upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) { - return _VSTD::upper_bound(__first, __last, __value, + return _VSTD::upper_bound(__first, __last, __value_, __less<_Tp, typename iterator_traits<_ForwardIterator>::value_type>()); } @@ -3815,7 +3919,7 @@ upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu template pair<_ForwardIterator, _ForwardIterator> -__equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) +__equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) { typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type; difference_type __len = _VSTD::distance(__first, __last); @@ -3824,12 +3928,12 @@ __equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va difference_type __l2 = __len / 2; _ForwardIterator __m = __first; _VSTD::advance(__m, __l2); - if (__comp(*__m, __value)) + if (__comp(*__m, __value_)) { __first = ++__m; __len -= __l2 + 1; } - else if (__comp(__value, *__m)) + else if (__comp(__value_, *__m)) { __last = __m; __len = __l2; @@ -3839,8 +3943,8 @@ __equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va _ForwardIterator __mp1 = __m; return pair<_ForwardIterator, _ForwardIterator> ( - __lower_bound<_Compare>(__first, __m, __value, __comp), - __upper_bound<_Compare>(++__mp1, __last, __value, __comp) + __lower_bound<_Compare>(__first, __m, __value_, __comp), + __upper_bound<_Compare>(++__mp1, __last, __value_, __comp) ); } } @@ -3850,24 +3954,24 @@ __equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va template inline _LIBCPP_INLINE_VISIBILITY pair<_ForwardIterator, _ForwardIterator> -equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) +equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) { #ifdef _LIBCPP_DEBUG2 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref; __debug_less<_Compare> __c(__comp); - return __equal_range<_Comp_ref>(__first, __last, __value, __c); + return __equal_range<_Comp_ref>(__first, __last, __value_, __c); #else // _LIBCPP_DEBUG2 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref; - return __equal_range<_Comp_ref>(__first, __last, __value, __comp); + return __equal_range<_Comp_ref>(__first, __last, __value_, __comp); #endif // _LIBCPP_DEBUG2 } template inline _LIBCPP_INLINE_VISIBILITY pair<_ForwardIterator, _ForwardIterator> -equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) +equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) { - return _VSTD::equal_range(__first, __last, __value, + return _VSTD::equal_range(__first, __last, __value_, __less::value_type, _Tp>()); } @@ -3876,33 +3980,33 @@ equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu template inline _LIBCPP_INLINE_VISIBILITY bool -__binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) +__binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) { - __first = __lower_bound<_Compare>(__first, __last, __value, __comp); - return __first != __last && !__comp(__value, *__first); + __first = __lower_bound<_Compare>(__first, __last, __value_, __comp); + return __first != __last && !__comp(__value_, *__first); } template inline _LIBCPP_INLINE_VISIBILITY bool -binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) +binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) { #ifdef _LIBCPP_DEBUG2 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref; __debug_less<_Compare> __c(__comp); - return __binary_search<_Comp_ref>(__first, __last, __value, __c); + return __binary_search<_Comp_ref>(__first, __last, __value_, __c); #else // _LIBCPP_DEBUG2 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref; - return __binary_search<_Comp_ref>(__first, __last, __value, __comp); + return __binary_search<_Comp_ref>(__first, __last, __value_, __comp); #endif // _LIBCPP_DEBUG2 } template inline _LIBCPP_INLINE_VISIBILITY bool -binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) +binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) { - return _VSTD::binary_search(__first, __last, __value, + return _VSTD::binary_search(__first, __last, __value_, __less::value_type, _Tp>()); } @@ -4709,6 +4813,8 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando while (true) { __restart: + if (__nth == __last) + return; difference_type __len = __last - __first; switch (__len) { diff --git a/system/include/libcxx/array b/system/include/libcxx/array index 3ac4c55b9d2a9..f4a3020aeae72 100644 --- a/system/include/libcxx/array +++ b/system/include/libcxx/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); @@ -111,7 +111,9 @@ template T&& get(array&&) noexcept; #include #endif +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -171,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];} @@ -308,6 +310,7 @@ _LIBCPP_INLINE_VISIBILITY inline _Tp& get(array<_Tp, _Size>& __a) _NOEXCEPT { + static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)"); return __a[_Ip]; } @@ -316,6 +319,7 @@ _LIBCPP_INLINE_VISIBILITY inline const _Tp& get(const array<_Tp, _Size>& __a) _NOEXCEPT { + static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)"); return __a[_Ip]; } @@ -326,6 +330,7 @@ _LIBCPP_INLINE_VISIBILITY inline _Tp&& get(array<_Tp, _Size>&& __a) _NOEXCEPT { + static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)"); return _VSTD::move(__a[_Ip]); } diff --git a/system/include/libcxx/atomic b/system/include/libcxx/atomic index 31385a23d17a5..db67e7625b811 100644 --- a/system/include/libcxx/atomic +++ b/system/include/libcxx/atomic @@ -29,10 +29,11 @@ typedef enum memory_order memory_order_seq_cst // store-release load-acquire } memory_order; -template T kill_dependency(T y); +template T kill_dependency(T y) noexcept; // lock-free property +#define ATOMIC_BOOL_LOCK_FREE unspecified #define ATOMIC_CHAR_LOCK_FREE unspecified #define ATOMIC_CHAR16_T_LOCK_FREE unspecified #define ATOMIC_CHAR32_T_LOCK_FREE unspecified @@ -41,45 +42,46 @@ template T kill_dependency(T y); #define ATOMIC_INT_LOCK_FREE unspecified #define ATOMIC_LONG_LOCK_FREE unspecified #define ATOMIC_LLONG_LOCK_FREE unspecified +#define ATOMIC_POINTER_LOCK_FREE unspecified // flag type and operations typedef struct atomic_flag { - bool test_and_set(memory_order m = memory_order_seq_cst) volatile; - bool test_and_set(memory_order m = memory_order_seq_cst); - void clear(memory_order m = memory_order_seq_cst) volatile; - void clear(memory_order m = memory_order_seq_cst); - atomic_flag() = default; + bool test_and_set(memory_order m = memory_order_seq_cst) volatile noexcept; + bool test_and_set(memory_order m = memory_order_seq_cst) noexcept; + void clear(memory_order m = memory_order_seq_cst) volatile noexcept; + void clear(memory_order m = memory_order_seq_cst) noexcept; + atomic_flag() noexcept = default; atomic_flag(const atomic_flag&) = delete; atomic_flag& operator=(const atomic_flag&) = delete; atomic_flag& operator=(const atomic_flag&) volatile = delete; } atomic_flag; bool - atomic_flag_test_and_set(volatile atomic_flag* obj); + atomic_flag_test_and_set(volatile atomic_flag* obj) noexcept; bool - atomic_flag_test_and_set(atomic_flag* obj); + atomic_flag_test_and_set(atomic_flag* obj) noexcept; bool atomic_flag_test_and_set_explicit(volatile atomic_flag* obj, - memory_order m); + memory_order m) noexcept; bool - atomic_flag_test_and_set_explicit(atomic_flag* obj, memory_order m); + atomic_flag_test_and_set_explicit(atomic_flag* obj, memory_order m) noexcept; void - atomic_flag_clear(volatile atomic_flag* obj); + atomic_flag_clear(volatile atomic_flag* obj) noexcept; void - atomic_flag_clear(atomic_flag* obj); + atomic_flag_clear(atomic_flag* obj) noexcept; void - atomic_flag_clear_explicit(volatile atomic_flag* obj, memory_order m); + atomic_flag_clear_explicit(volatile atomic_flag* obj, memory_order m) noexcept; void - atomic_flag_clear_explicit(atomic_flag* obj, memory_order m); + atomic_flag_clear_explicit(atomic_flag* obj, memory_order m) noexcept; #define ATOMIC_FLAG_INIT see below #define ATOMIC_VAR_INIT(value) see below @@ -87,391 +89,392 @@ void template struct atomic { - bool is_lock_free() const volatile; - bool is_lock_free() const; - void store(T desr, memory_order m = memory_order_seq_cst) volatile; - void store(T desr, memory_order m = memory_order_seq_cst); - T load(memory_order m = memory_order_seq_cst) const volatile; - T load(memory_order m = memory_order_seq_cst) const; - operator T() const volatile; - operator T() const; - T exchange(T desr, memory_order m = memory_order_seq_cst) volatile; - T exchange(T desr, memory_order m = memory_order_seq_cst); + bool is_lock_free() const volatile noexcept; + bool is_lock_free() const noexcept; + void store(T desr, memory_order m = memory_order_seq_cst) volatile noexcept; + void store(T desr, memory_order m = memory_order_seq_cst) noexcept; + T load(memory_order m = memory_order_seq_cst) const volatile noexcept; + T load(memory_order m = memory_order_seq_cst) const noexcept; + operator T() const volatile noexcept; + operator T() const noexcept; + T exchange(T desr, memory_order m = memory_order_seq_cst) volatile noexcept; + T exchange(T desr, memory_order m = memory_order_seq_cst) noexcept; bool compare_exchange_weak(T& expc, T desr, - memory_order s, memory_order f) volatile; - bool compare_exchange_weak(T& expc, T desr, memory_order s, memory_order f); + memory_order s, memory_order f) volatile noexcept; + bool compare_exchange_weak(T& expc, T desr, memory_order s, memory_order f) noexcept; bool compare_exchange_strong(T& expc, T desr, - memory_order s, memory_order f) volatile; + memory_order s, memory_order f) volatile noexcept; bool compare_exchange_strong(T& expc, T desr, - memory_order s, memory_order f); + memory_order s, memory_order f) noexcept; bool compare_exchange_weak(T& expc, T desr, - memory_order m = memory_order_seq_cst) volatile; + memory_order m = memory_order_seq_cst) volatile noexcept; bool compare_exchange_weak(T& expc, T desr, - memory_order m = memory_order_seq_cst); + memory_order m = memory_order_seq_cst) noexcept; bool compare_exchange_strong(T& expc, T desr, - memory_order m = memory_order_seq_cst) volatile; + memory_order m = memory_order_seq_cst) volatile noexcept; bool compare_exchange_strong(T& expc, T desr, - memory_order m = memory_order_seq_cst); + memory_order m = memory_order_seq_cst) noexcept; - atomic() = default; - constexpr atomic(T desr); + atomic() noexcept = default; + constexpr atomic(T desr) noexcept; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - T operator=(T) volatile; - T operator=(T); + T operator=(T) volatile noexcept; + T operator=(T) noexcept; }; template <> struct atomic { - bool is_lock_free() const volatile; - bool is_lock_free() const; - void store(integral desr, memory_order m = memory_order_seq_cst) volatile; - void store(integral desr, memory_order m = memory_order_seq_cst); - integral load(memory_order m = memory_order_seq_cst) const volatile; - integral load(memory_order m = memory_order_seq_cst) const; - operator integral() const volatile; - operator integral() const; + bool is_lock_free() const volatile noexcept; + bool is_lock_free() const noexcept; + void store(integral desr, memory_order m = memory_order_seq_cst) volatile noexcept; + void store(integral desr, memory_order m = memory_order_seq_cst) noexcept; + integral load(memory_order m = memory_order_seq_cst) const volatile noexcept; + integral load(memory_order m = memory_order_seq_cst) const noexcept; + operator integral() const volatile noexcept; + operator integral() const noexcept; integral exchange(integral desr, - memory_order m = memory_order_seq_cst) volatile; - integral exchange(integral desr, memory_order m = memory_order_seq_cst); + memory_order m = memory_order_seq_cst) volatile noexcept; + integral exchange(integral desr, memory_order m = memory_order_seq_cst) noexcept; bool compare_exchange_weak(integral& expc, integral desr, - memory_order s, memory_order f) volatile; + memory_order s, memory_order f) volatile noexcept; bool compare_exchange_weak(integral& expc, integral desr, - memory_order s, memory_order f); + memory_order s, memory_order f) noexcept; bool compare_exchange_strong(integral& expc, integral desr, - memory_order s, memory_order f) volatile; + memory_order s, memory_order f) volatile noexcept; bool compare_exchange_strong(integral& expc, integral desr, - memory_order s, memory_order f); + memory_order s, memory_order f) noexcept; bool compare_exchange_weak(integral& expc, integral desr, - memory_order m = memory_order_seq_cst) volatile; + memory_order m = memory_order_seq_cst) volatile noexcept; bool compare_exchange_weak(integral& expc, integral desr, - memory_order m = memory_order_seq_cst); + memory_order m = memory_order_seq_cst) noexcept; bool compare_exchange_strong(integral& expc, integral desr, - memory_order m = memory_order_seq_cst) volatile; + memory_order m = memory_order_seq_cst) volatile noexcept; bool compare_exchange_strong(integral& expc, integral desr, - memory_order m = memory_order_seq_cst); + memory_order m = memory_order_seq_cst) noexcept; integral - fetch_add(integral op, memory_order m = memory_order_seq_cst) volatile; - integral fetch_add(integral op, memory_order m = memory_order_seq_cst); + fetch_add(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; + integral fetch_add(integral op, memory_order m = memory_order_seq_cst) noexcept; integral - fetch_sub(integral op, memory_order m = memory_order_seq_cst) volatile; - integral fetch_sub(integral op, memory_order m = memory_order_seq_cst); + fetch_sub(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; + integral fetch_sub(integral op, memory_order m = memory_order_seq_cst) noexcept; integral - fetch_and(integral op, memory_order m = memory_order_seq_cst) volatile; - integral fetch_and(integral op, memory_order m = memory_order_seq_cst); + fetch_and(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; + integral fetch_and(integral op, memory_order m = memory_order_seq_cst) noexcept; integral - fetch_or(integral op, memory_order m = memory_order_seq_cst) volatile; - integral fetch_or(integral op, memory_order m = memory_order_seq_cst); + fetch_or(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; + integral fetch_or(integral op, memory_order m = memory_order_seq_cst) noexcept; integral - fetch_xor(integral op, memory_order m = memory_order_seq_cst) volatile; - integral fetch_xor(integral op, memory_order m = memory_order_seq_cst); + fetch_xor(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; + integral fetch_xor(integral op, memory_order m = memory_order_seq_cst) noexcept; - atomic() = default; - constexpr atomic(integral desr); + atomic() noexcept = default; + constexpr atomic(integral desr) noexcept; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - integral operator=(integral desr) volatile; - integral operator=(integral desr); - - integral operator++(int) volatile; - integral operator++(int); - integral operator--(int) volatile; - integral operator--(int); - integral operator++() volatile; - integral operator++(); - integral operator--() volatile; - integral operator--(); - integral operator+=(integral op) volatile; - integral operator+=(integral op); - integral operator-=(integral op) volatile; - integral operator-=(integral op); - integral operator&=(integral op) volatile; - integral operator&=(integral op); - integral operator|=(integral op) volatile; - integral operator|=(integral op); - integral operator^=(integral op) volatile; - integral operator^=(integral op); + integral operator=(integral desr) volatile noexcept; + integral operator=(integral desr) noexcept; + + integral operator++(int) volatile noexcept; + integral operator++(int) noexcept; + integral operator--(int) volatile noexcept; + integral operator--(int) noexcept; + integral operator++() volatile noexcept; + integral operator++() noexcept; + integral operator--() volatile noexcept; + integral operator--() noexcept; + integral operator+=(integral op) volatile noexcept; + integral operator+=(integral op) noexcept; + integral operator-=(integral op) volatile noexcept; + integral operator-=(integral op) noexcept; + integral operator&=(integral op) volatile noexcept; + integral operator&=(integral op) noexcept; + integral operator|=(integral op) volatile noexcept; + integral operator|=(integral op) noexcept; + integral operator^=(integral op) volatile noexcept; + integral operator^=(integral op) noexcept; }; template struct atomic { - bool is_lock_free() const volatile; - bool is_lock_free() const; - void store(T* desr, memory_order m = memory_order_seq_cst) volatile; - void store(T* desr, memory_order m = memory_order_seq_cst); - T* load(memory_order m = memory_order_seq_cst) const volatile; - T* load(memory_order m = memory_order_seq_cst) const; - operator T*() const volatile; - operator T*() const; - T* exchange(T* desr, memory_order m = memory_order_seq_cst) volatile; - T* exchange(T* desr, memory_order m = memory_order_seq_cst); + bool is_lock_free() const volatile noexcept; + bool is_lock_free() const noexcept; + void store(T* desr, memory_order m = memory_order_seq_cst) volatile noexcept; + void store(T* desr, memory_order m = memory_order_seq_cst) noexcept; + T* load(memory_order m = memory_order_seq_cst) const volatile noexcept; + T* load(memory_order m = memory_order_seq_cst) const noexcept; + operator T*() const volatile noexcept; + operator T*() const noexcept; + T* exchange(T* desr, memory_order m = memory_order_seq_cst) volatile noexcept; + T* exchange(T* desr, memory_order m = memory_order_seq_cst) noexcept; bool compare_exchange_weak(T*& expc, T* desr, - memory_order s, memory_order f) volatile; + memory_order s, memory_order f) volatile noexcept; bool compare_exchange_weak(T*& expc, T* desr, - memory_order s, memory_order f); + memory_order s, memory_order f) noexcept; bool compare_exchange_strong(T*& expc, T* desr, - memory_order s, memory_order f) volatile; + memory_order s, memory_order f) volatile noexcept; bool compare_exchange_strong(T*& expc, T* desr, - memory_order s, memory_order f); + memory_order s, memory_order f) noexcept; bool compare_exchange_weak(T*& expc, T* desr, - memory_order m = memory_order_seq_cst) volatile; + memory_order m = memory_order_seq_cst) volatile noexcept; bool compare_exchange_weak(T*& expc, T* desr, - memory_order m = memory_order_seq_cst); + memory_order m = memory_order_seq_cst) noexcept; bool compare_exchange_strong(T*& expc, T* desr, - memory_order m = memory_order_seq_cst) volatile; + memory_order m = memory_order_seq_cst) volatile noexcept; bool compare_exchange_strong(T*& expc, T* desr, - memory_order m = memory_order_seq_cst); - T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile; - T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst); - T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile; - T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst); - - atomic() = default; - constexpr atomic(T* desr); + memory_order m = memory_order_seq_cst) noexcept; + T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile noexcept; + T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst) noexcept; + T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile noexcept; + T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst) noexcept; + + atomic() noexcept = default; + constexpr atomic(T* desr) noexcept; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - T* operator=(T*) volatile; - T* operator=(T*); - T* operator++(int) volatile; - T* operator++(int); - T* operator--(int) volatile; - T* operator--(int); - T* operator++() volatile; - T* operator++(); - T* operator--() volatile; - T* operator--(); - T* operator+=(ptrdiff_t op) volatile; - T* operator+=(ptrdiff_t op); - T* operator-=(ptrdiff_t op) volatile; - T* operator-=(ptrdiff_t op); + T* operator=(T*) volatile noexcept; + T* operator=(T*) noexcept; + T* operator++(int) volatile noexcept; + T* operator++(int) noexcept; + T* operator--(int) volatile noexcept; + T* operator--(int) noexcept; + T* operator++() volatile noexcept; + T* operator++() noexcept; + T* operator--() volatile noexcept; + T* operator--() noexcept; + T* operator+=(ptrdiff_t op) volatile noexcept; + T* operator+=(ptrdiff_t op) noexcept; + T* operator-=(ptrdiff_t op) volatile noexcept; + T* operator-=(ptrdiff_t op) noexcept; }; template bool - atomic_is_lock_free(const volatile atomic* obj); + atomic_is_lock_free(const volatile atomic* obj) noexcept; template bool - atomic_is_lock_free(const atomic* obj); + atomic_is_lock_free(const atomic* obj) noexcept; template void - atomic_init(volatile atomic* obj, T desr); + atomic_init(volatile atomic* obj, T desr) noexcept; template void - atomic_init(atomic* obj, T desr); + atomic_init(atomic* obj, T desr) noexcept; template void - atomic_store(volatile atomic* obj, T desr); + atomic_store(volatile atomic* obj, T desr) noexcept; template void - atomic_store(atomic* obj, T desr); + atomic_store(atomic* obj, T desr) noexcept; template void - atomic_store_explicit(volatile atomic* obj, T desr, memory_order m); + atomic_store_explicit(volatile atomic* obj, T desr, memory_order m) noexcept; template void - atomic_store_explicit(atomic* obj, T desr, memory_order m); + atomic_store_explicit(atomic* obj, T desr, memory_order m) noexcept; template T - atomic_load(const volatile atomic* obj); + atomic_load(const volatile atomic* obj) noexcept; template T - atomic_load(const atomic* obj); + atomic_load(const atomic* obj) noexcept; template T - atomic_load_explicit(const volatile atomic* obj, memory_order m); + atomic_load_explicit(const volatile atomic* obj, memory_order m) noexcept; template T - atomic_load_explicit(const atomic* obj, memory_order m); + atomic_load_explicit(const atomic* obj, memory_order m) noexcept; template T - atomic_exchange(volatile atomic* obj, T desr); + atomic_exchange(volatile atomic* obj, T desr) noexcept; template T - atomic_exchange(atomic* obj, T desr); + atomic_exchange(atomic* obj, T desr) noexcept; template T - atomic_exchange_explicit(volatile atomic* obj, T desr, memory_order m); + atomic_exchange_explicit(volatile atomic* obj, T desr, memory_order m) noexcept; template T - atomic_exchange_explicit(atomic* obj, T desr, memory_order m); + atomic_exchange_explicit(atomic* obj, T desr, memory_order m) noexcept; template bool - atomic_compare_exchange_weak(volatile atomic* obj, T* expc, T desr); + atomic_compare_exchange_weak(volatile atomic* obj, T* expc, T desr) noexcept; template bool - atomic_compare_exchange_weak(atomic* obj, T* expc, T desr); + atomic_compare_exchange_weak(atomic* obj, T* expc, T desr) noexcept; template bool - atomic_compare_exchange_strong(volatile atomic* obj, T* expc, T desr); + atomic_compare_exchange_strong(volatile atomic* obj, T* expc, T desr) noexcept; template bool - atomic_compare_exchange_strong(atomic* obj, T* expc, T desr); + atomic_compare_exchange_strong(atomic* obj, T* expc, T desr) noexcept; template bool atomic_compare_exchange_weak_explicit(volatile atomic* obj, T* expc, T desr, - memory_order s, memory_order f); + memory_order s, memory_order f) noexcept; template bool atomic_compare_exchange_weak_explicit(atomic* obj, T* expc, T desr, - memory_order s, memory_order f); + memory_order s, memory_order f) noexcept; template bool atomic_compare_exchange_strong_explicit(volatile atomic* obj, T* expc, T desr, - memory_order s, memory_order f); + memory_order s, memory_order f) noexcept; template bool atomic_compare_exchange_strong_explicit(atomic* obj, T* expc, T desr, - memory_order s, memory_order f); + memory_order s, memory_order f) noexcept; template Integral - atomic_fetch_add(volatile atomic* obj, Integral op); + atomic_fetch_add(volatile atomic* obj, Integral op) noexcept; template Integral - atomic_fetch_add(atomic* obj, Integral op); + atomic_fetch_add(atomic* obj, Integral op) noexcept; template Integral atomic_fetch_add_explicit(volatile atomic* obj, Integral op, - memory_order m); + memory_order m) noexcept; template Integral atomic_fetch_add_explicit(atomic* obj, Integral op, - memory_order m); + memory_order m) noexcept; template Integral - atomic_fetch_sub(volatile atomic* obj, Integral op); + atomic_fetch_sub(volatile atomic* obj, Integral op) noexcept; template Integral - atomic_fetch_sub(atomic* obj, Integral op); + atomic_fetch_sub(atomic* obj, Integral op) noexcept; template Integral atomic_fetch_sub_explicit(volatile atomic* obj, Integral op, - memory_order m); + memory_order m) noexcept; template Integral atomic_fetch_sub_explicit(atomic* obj, Integral op, - memory_order m); + memory_order m) noexcept; template Integral - atomic_fetch_and(volatile atomic* obj, Integral op); + atomic_fetch_and(volatile atomic* obj, Integral op) noexcept; template Integral - atomic_fetch_and(atomic* obj, Integral op); + atomic_fetch_and(atomic* obj, Integral op) noexcept; template Integral atomic_fetch_and_explicit(volatile atomic* obj, Integral op, - memory_order m); + memory_order m) noexcept; template Integral atomic_fetch_and_explicit(atomic* obj, Integral op, - memory_order m); + memory_order m) noexcept; template Integral - atomic_fetch_or(volatile atomic* obj, Integral op); + atomic_fetch_or(volatile atomic* obj, Integral op) noexcept; template Integral - atomic_fetch_or(atomic* obj, Integral op); + atomic_fetch_or(atomic* obj, Integral op) noexcept; template Integral atomic_fetch_or_explicit(volatile atomic* obj, Integral op, - memory_order m); + memory_order m) noexcept; template Integral atomic_fetch_or_explicit(atomic* obj, Integral op, - memory_order m); + memory_order m) noexcept; template Integral - atomic_fetch_xor(volatile atomic* obj, Integral op); + atomic_fetch_xor(volatile atomic* obj, Integral op) noexcept; template Integral - atomic_fetch_xor(atomic* obj, Integral op); + atomic_fetch_xor(atomic* obj, Integral op) noexcept; template Integral atomic_fetch_xor_explicit(volatile atomic* obj, Integral op, - memory_order m); + memory_order m) noexcept; template Integral atomic_fetch_xor_explicit(atomic* obj, Integral op, - memory_order m); + memory_order m) noexcept; template T* - atomic_fetch_add(volatile atomic* obj, ptrdiff_t op); + atomic_fetch_add(volatile atomic* obj, ptrdiff_t op) noexcept; template T* - atomic_fetch_add(atomic* obj, ptrdiff_t op); + atomic_fetch_add(atomic* obj, ptrdiff_t op) noexcept; template T* atomic_fetch_add_explicit(volatile atomic* obj, ptrdiff_t op, - memory_order m); + memory_order m) noexcept; template T* - atomic_fetch_add_explicit(atomic* obj, ptrdiff_t op, memory_order m); + atomic_fetch_add_explicit(atomic* obj, ptrdiff_t op, memory_order m) noexcept; template T* - atomic_fetch_sub(volatile atomic* obj, ptrdiff_t op); + atomic_fetch_sub(volatile atomic* obj, ptrdiff_t op) noexcept; template T* - atomic_fetch_sub(atomic* obj, ptrdiff_t op); + atomic_fetch_sub(atomic* obj, ptrdiff_t op) noexcept; template T* atomic_fetch_sub_explicit(volatile atomic* obj, ptrdiff_t op, - memory_order m); + memory_order m) noexcept; template T* - atomic_fetch_sub_explicit(atomic* obj, ptrdiff_t op, memory_order m); + atomic_fetch_sub_explicit(atomic* obj, ptrdiff_t op, memory_order m) noexcept; // Atomics for standard typedef types +typedef atomic atomic_bool; typedef atomic atomic_char; typedef atomic atomic_schar; typedef atomic atomic_uchar; @@ -514,8 +517,8 @@ typedef atomic atomic_uintmax_t; // fences -void atomic_thread_fence(memory_order m); -void atomic_signal_fence(memory_order m); +void atomic_thread_fence(memory_order m) noexcept; +void atomic_signal_fence(memory_order m) noexcept; } // std @@ -526,7 +529,9 @@ void atomic_signal_fence(memory_order m); #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -543,7 +548,7 @@ typedef enum memory_order template inline _LIBCPP_INLINE_VISIBILITY _Tp -kill_dependency(_Tp __y) +kill_dependency(_Tp __y) _NOEXCEPT { return __y; } @@ -553,73 +558,73 @@ kill_dependency(_Tp __y) template ::value && !is_same<_Tp, bool>::value> struct __atomic_base // false { - _Tp __a_; + mutable _Atomic(_Tp) __a_; _LIBCPP_INLINE_VISIBILITY - bool is_lock_free() const volatile - {return __atomic_is_lock_free(_Tp());} + bool is_lock_free() const volatile _NOEXCEPT + {return __c11_atomic_is_lock_free(sizeof(_Tp));} _LIBCPP_INLINE_VISIBILITY - bool is_lock_free() const - {return __atomic_is_lock_free(_Tp());} + bool is_lock_free() const _NOEXCEPT + {return __c11_atomic_is_lock_free(sizeof(_Tp));} _LIBCPP_INLINE_VISIBILITY - void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile - {__atomic_store(&__a_, __d, __m);} + void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT + {__c11_atomic_store(&__a_, __d, __m);} _LIBCPP_INLINE_VISIBILITY - void store(_Tp __d, memory_order __m = memory_order_seq_cst) - {__atomic_store(&__a_, __d, __m);} + void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT + {__c11_atomic_store(&__a_, __d, __m);} _LIBCPP_INLINE_VISIBILITY - _Tp load(memory_order __m = memory_order_seq_cst) const volatile - {return __atomic_load(&__a_, __m);} + _Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT + {return __c11_atomic_load(&__a_, __m);} _LIBCPP_INLINE_VISIBILITY - _Tp load(memory_order __m = memory_order_seq_cst) const - {return __atomic_load(&__a_, __m);} + _Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT + {return __c11_atomic_load(&__a_, __m);} _LIBCPP_INLINE_VISIBILITY - operator _Tp() const volatile {return load();} + operator _Tp() const volatile _NOEXCEPT {return load();} _LIBCPP_INLINE_VISIBILITY - operator _Tp() const {return load();} + operator _Tp() const _NOEXCEPT {return load();} _LIBCPP_INLINE_VISIBILITY - _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile - {return __atomic_exchange(&__a_, __d, __m);} + _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT + {return __c11_atomic_exchange(&__a_, __d, __m);} _LIBCPP_INLINE_VISIBILITY - _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) - {return __atomic_exchange(&__a_, __d, __m);} + _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT + {return __c11_atomic_exchange(&__a_, __d, __m);} _LIBCPP_INLINE_VISIBILITY bool compare_exchange_weak(_Tp& __e, _Tp __d, - memory_order __s, memory_order __f) volatile - {return __atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);} + memory_order __s, memory_order __f) volatile _NOEXCEPT + {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);} _LIBCPP_INLINE_VISIBILITY bool compare_exchange_weak(_Tp& __e, _Tp __d, - memory_order __s, memory_order __f) - {return __atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);} + memory_order __s, memory_order __f) _NOEXCEPT + {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);} _LIBCPP_INLINE_VISIBILITY bool compare_exchange_strong(_Tp& __e, _Tp __d, - memory_order __s, memory_order __f) volatile - {return __atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);} + memory_order __s, memory_order __f) volatile _NOEXCEPT + {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);} _LIBCPP_INLINE_VISIBILITY bool compare_exchange_strong(_Tp& __e, _Tp __d, - memory_order __s, memory_order __f) - {return __atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);} + memory_order __s, memory_order __f) _NOEXCEPT + {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);} _LIBCPP_INLINE_VISIBILITY bool compare_exchange_weak(_Tp& __e, _Tp __d, - memory_order __m = memory_order_seq_cst) volatile - {return __atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);} + memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT + {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);} _LIBCPP_INLINE_VISIBILITY bool compare_exchange_weak(_Tp& __e, _Tp __d, - memory_order __m = memory_order_seq_cst) - {return __atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);} + memory_order __m = memory_order_seq_cst) _NOEXCEPT + {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);} _LIBCPP_INLINE_VISIBILITY bool compare_exchange_strong(_Tp& __e, _Tp __d, - memory_order __m = memory_order_seq_cst) volatile - {return __atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);} + memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT + {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);} _LIBCPP_INLINE_VISIBILITY bool compare_exchange_strong(_Tp& __e, _Tp __d, - memory_order __m = memory_order_seq_cst) - {return __atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);} + memory_order __m = memory_order_seq_cst) _NOEXCEPT + {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);} _LIBCPP_INLINE_VISIBILITY - __atomic_base() {} // = default; + __atomic_base() _NOEXCEPT {} // = default; _LIBCPP_INLINE_VISIBILITY - /*constexpr*/ __atomic_base(_Tp __d) : __a_(__d) {} + _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {} #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS __atomic_base(const __atomic_base&) = delete; __atomic_base& operator=(const __atomic_base&) = delete; @@ -640,77 +645,77 @@ struct __atomic_base<_Tp, true> { typedef __atomic_base<_Tp, false> __base; _LIBCPP_INLINE_VISIBILITY - __atomic_base() {} // = default; + __atomic_base() _NOEXCEPT {} // = default; _LIBCPP_INLINE_VISIBILITY - /*constexpr*/ __atomic_base(_Tp __d) : __base(__d) {} + _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __base(__d) {} _LIBCPP_INLINE_VISIBILITY - _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile - {return __atomic_fetch_add(&this->__a_, __op, __m);} + _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT + {return __c11_atomic_fetch_add(&this->__a_, __op, __m);} _LIBCPP_INLINE_VISIBILITY - _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) - {return __atomic_fetch_add(&this->__a_, __op, __m);} + _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT + {return __c11_atomic_fetch_add(&this->__a_, __op, __m);} _LIBCPP_INLINE_VISIBILITY - _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile - {return __atomic_fetch_sub(&this->__a_, __op, __m);} + _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT + {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);} _LIBCPP_INLINE_VISIBILITY - _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) - {return __atomic_fetch_sub(&this->__a_, __op, __m);} + _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT + {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);} _LIBCPP_INLINE_VISIBILITY - _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile - {return __atomic_fetch_and(&this->__a_, __op, __m);} + _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT + {return __c11_atomic_fetch_and(&this->__a_, __op, __m);} _LIBCPP_INLINE_VISIBILITY - _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) - {return __atomic_fetch_and(&this->__a_, __op, __m);} + _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT + {return __c11_atomic_fetch_and(&this->__a_, __op, __m);} _LIBCPP_INLINE_VISIBILITY - _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile - {return __atomic_fetch_or(&this->__a_, __op, __m);} + _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT + {return __c11_atomic_fetch_or(&this->__a_, __op, __m);} _LIBCPP_INLINE_VISIBILITY - _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) - {return __atomic_fetch_or(&this->__a_, __op, __m);} + _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT + {return __c11_atomic_fetch_or(&this->__a_, __op, __m);} _LIBCPP_INLINE_VISIBILITY - _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile - {return __atomic_fetch_xor(&this->__a_, __op, __m);} + _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT + {return __c11_atomic_fetch_xor(&this->__a_, __op, __m);} _LIBCPP_INLINE_VISIBILITY - _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) - {return __atomic_fetch_xor(&this->__a_, __op, __m);} + _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT + {return __c11_atomic_fetch_xor(&this->__a_, __op, __m);} _LIBCPP_INLINE_VISIBILITY - _Tp operator++(int) volatile {return fetch_add(_Tp(1));} + _Tp operator++(int) volatile _NOEXCEPT {return fetch_add(_Tp(1));} _LIBCPP_INLINE_VISIBILITY - _Tp operator++(int) {return fetch_add(_Tp(1));} + _Tp operator++(int) _NOEXCEPT {return fetch_add(_Tp(1));} _LIBCPP_INLINE_VISIBILITY - _Tp operator--(int) volatile {return fetch_sub(_Tp(1));} + _Tp operator--(int) volatile _NOEXCEPT {return fetch_sub(_Tp(1));} _LIBCPP_INLINE_VISIBILITY - _Tp operator--(int) {return fetch_sub(_Tp(1));} + _Tp operator--(int) _NOEXCEPT {return fetch_sub(_Tp(1));} _LIBCPP_INLINE_VISIBILITY - _Tp operator++() volatile {return fetch_add(_Tp(1)) + _Tp(1);} + _Tp operator++() volatile _NOEXCEPT {return fetch_add(_Tp(1)) + _Tp(1);} _LIBCPP_INLINE_VISIBILITY - _Tp operator++() {return fetch_add(_Tp(1)) + _Tp(1);} + _Tp operator++() _NOEXCEPT {return fetch_add(_Tp(1)) + _Tp(1);} _LIBCPP_INLINE_VISIBILITY - _Tp operator--() volatile {return fetch_sub(_Tp(1)) - _Tp(1);} + _Tp operator--() volatile _NOEXCEPT {return fetch_sub(_Tp(1)) - _Tp(1);} _LIBCPP_INLINE_VISIBILITY - _Tp operator--() {return fetch_sub(_Tp(1)) - _Tp(1);} + _Tp operator--() _NOEXCEPT {return fetch_sub(_Tp(1)) - _Tp(1);} _LIBCPP_INLINE_VISIBILITY - _Tp operator+=(_Tp __op) volatile {return fetch_add(__op) + __op;} + _Tp operator+=(_Tp __op) volatile _NOEXCEPT {return fetch_add(__op) + __op;} _LIBCPP_INLINE_VISIBILITY - _Tp operator+=(_Tp __op) {return fetch_add(__op) + __op;} + _Tp operator+=(_Tp __op) _NOEXCEPT {return fetch_add(__op) + __op;} _LIBCPP_INLINE_VISIBILITY - _Tp operator-=(_Tp __op) volatile {return fetch_sub(__op) - __op;} + _Tp operator-=(_Tp __op) volatile _NOEXCEPT {return fetch_sub(__op) - __op;} _LIBCPP_INLINE_VISIBILITY - _Tp operator-=(_Tp __op) {return fetch_sub(__op) - __op;} + _Tp operator-=(_Tp __op) _NOEXCEPT {return fetch_sub(__op) - __op;} _LIBCPP_INLINE_VISIBILITY - _Tp operator&=(_Tp __op) volatile {return fetch_and(__op) & __op;} + _Tp operator&=(_Tp __op) volatile _NOEXCEPT {return fetch_and(__op) & __op;} _LIBCPP_INLINE_VISIBILITY - _Tp operator&=(_Tp __op) {return fetch_and(__op) & __op;} + _Tp operator&=(_Tp __op) _NOEXCEPT {return fetch_and(__op) & __op;} _LIBCPP_INLINE_VISIBILITY - _Tp operator|=(_Tp __op) volatile {return fetch_or(__op) | __op;} + _Tp operator|=(_Tp __op) volatile _NOEXCEPT {return fetch_or(__op) | __op;} _LIBCPP_INLINE_VISIBILITY - _Tp operator|=(_Tp __op) {return fetch_or(__op) | __op;} + _Tp operator|=(_Tp __op) _NOEXCEPT {return fetch_or(__op) | __op;} _LIBCPP_INLINE_VISIBILITY - _Tp operator^=(_Tp __op) volatile {return fetch_xor(__op) ^ __op;} + _Tp operator^=(_Tp __op) volatile _NOEXCEPT {return fetch_xor(__op) ^ __op;} _LIBCPP_INLINE_VISIBILITY - _Tp operator^=(_Tp __op) {return fetch_xor(__op) ^ __op;} + _Tp operator^=(_Tp __op) _NOEXCEPT {return fetch_xor(__op) ^ __op;} }; // atomic @@ -721,15 +726,15 @@ struct atomic { typedef __atomic_base<_Tp> __base; _LIBCPP_INLINE_VISIBILITY - atomic() {} // = default; + atomic() _NOEXCEPT {} // = default; _LIBCPP_INLINE_VISIBILITY - /*constexpr*/ atomic(_Tp __d) : __base(__d) {} + _LIBCPP_CONSTEXPR atomic(_Tp __d) _NOEXCEPT : __base(__d) {} _LIBCPP_INLINE_VISIBILITY - _Tp operator=(_Tp __d) volatile + _Tp operator=(_Tp __d) volatile _NOEXCEPT {__base::store(__d); return __d;} _LIBCPP_INLINE_VISIBILITY - _Tp operator=(_Tp __d) + _Tp operator=(_Tp __d) _NOEXCEPT {__base::store(__d); return __d;} }; @@ -741,56 +746,56 @@ struct atomic<_Tp*> { typedef __atomic_base<_Tp*> __base; _LIBCPP_INLINE_VISIBILITY - atomic() {} // = default; + atomic() _NOEXCEPT {} // = default; _LIBCPP_INLINE_VISIBILITY - /*constexpr*/ atomic(_Tp* __d) : __base(__d) {} + _LIBCPP_CONSTEXPR atomic(_Tp* __d) _NOEXCEPT : __base(__d) {} _LIBCPP_INLINE_VISIBILITY - _Tp* operator=(_Tp* __d) volatile + _Tp* operator=(_Tp* __d) volatile _NOEXCEPT {__base::store(__d); return __d;} _LIBCPP_INLINE_VISIBILITY - _Tp* operator=(_Tp* __d) + _Tp* operator=(_Tp* __d) _NOEXCEPT {__base::store(__d); return __d;} _LIBCPP_INLINE_VISIBILITY _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) - volatile - {return __atomic_fetch_add(&this->__a_, __op, __m);} + volatile _NOEXCEPT + {return __c11_atomic_fetch_add(&this->__a_, __op, __m);} _LIBCPP_INLINE_VISIBILITY - _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) - {return __atomic_fetch_add(&this->__a_, __op, __m);} + _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT + {return __c11_atomic_fetch_add(&this->__a_, __op, __m);} _LIBCPP_INLINE_VISIBILITY _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) - volatile - {return __atomic_fetch_sub(&this->__a_, __op, __m);} + volatile _NOEXCEPT + {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);} _LIBCPP_INLINE_VISIBILITY - _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) - {return __atomic_fetch_sub(&this->__a_, __op, __m);} + _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT + {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);} _LIBCPP_INLINE_VISIBILITY - _Tp* operator++(int) volatile {return fetch_add(1);} + _Tp* operator++(int) volatile _NOEXCEPT {return fetch_add(1);} _LIBCPP_INLINE_VISIBILITY - _Tp* operator++(int) {return fetch_add(1);} + _Tp* operator++(int) _NOEXCEPT {return fetch_add(1);} _LIBCPP_INLINE_VISIBILITY - _Tp* operator--(int) volatile {return fetch_sub(1);} + _Tp* operator--(int) volatile _NOEXCEPT {return fetch_sub(1);} _LIBCPP_INLINE_VISIBILITY - _Tp* operator--(int) {return fetch_sub(1);} + _Tp* operator--(int) _NOEXCEPT {return fetch_sub(1);} _LIBCPP_INLINE_VISIBILITY - _Tp* operator++() volatile {return fetch_add(1) + 1;} + _Tp* operator++() volatile _NOEXCEPT {return fetch_add(1) + 1;} _LIBCPP_INLINE_VISIBILITY - _Tp* operator++() {return fetch_add(1) + 1;} + _Tp* operator++() _NOEXCEPT {return fetch_add(1) + 1;} _LIBCPP_INLINE_VISIBILITY - _Tp* operator--() volatile {return fetch_sub(1) - 1;} + _Tp* operator--() volatile _NOEXCEPT {return fetch_sub(1) - 1;} _LIBCPP_INLINE_VISIBILITY - _Tp* operator--() {return fetch_sub(1) - 1;} + _Tp* operator--() _NOEXCEPT {return fetch_sub(1) - 1;} _LIBCPP_INLINE_VISIBILITY - _Tp* operator+=(ptrdiff_t __op) volatile {return fetch_add(__op) + __op;} + _Tp* operator+=(ptrdiff_t __op) volatile _NOEXCEPT {return fetch_add(__op) + __op;} _LIBCPP_INLINE_VISIBILITY - _Tp* operator+=(ptrdiff_t __op) {return fetch_add(__op) + __op;} + _Tp* operator+=(ptrdiff_t __op) _NOEXCEPT {return fetch_add(__op) + __op;} _LIBCPP_INLINE_VISIBILITY - _Tp* operator-=(ptrdiff_t __op) volatile {return fetch_sub(__op) - __op;} + _Tp* operator-=(ptrdiff_t __op) volatile _NOEXCEPT {return fetch_sub(__op) - __op;} _LIBCPP_INLINE_VISIBILITY - _Tp* operator-=(ptrdiff_t __op) {return fetch_sub(__op) - __op;} + _Tp* operator-=(ptrdiff_t __op) _NOEXCEPT {return fetch_sub(__op) - __op;} }; // atomic_is_lock_free @@ -798,7 +803,7 @@ struct atomic<_Tp*> template inline _LIBCPP_INLINE_VISIBILITY bool -atomic_is_lock_free(const volatile atomic<_Tp>* __o) +atomic_is_lock_free(const volatile atomic<_Tp>* __o) _NOEXCEPT { return __o->is_lock_free(); } @@ -806,7 +811,7 @@ atomic_is_lock_free(const volatile atomic<_Tp>* __o) template inline _LIBCPP_INLINE_VISIBILITY bool -atomic_is_lock_free(const atomic<_Tp>* __o) +atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT { return __o->is_lock_free(); } @@ -816,17 +821,17 @@ atomic_is_lock_free(const atomic<_Tp>* __o) template inline _LIBCPP_INLINE_VISIBILITY void -atomic_init(volatile atomic<_Tp>* __o, _Tp __d) +atomic_init(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT { - __o->__a_ = __d; + __c11_atomic_init(&__o->__a_, __d); } template inline _LIBCPP_INLINE_VISIBILITY void -atomic_init(atomic<_Tp>* __o, _Tp __d) +atomic_init(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT { - __o->__a_ = __d; + __c11_atomic_init(&__o->__a_, __d); } // atomic_store @@ -834,7 +839,7 @@ atomic_init(atomic<_Tp>* __o, _Tp __d) template inline _LIBCPP_INLINE_VISIBILITY void -atomic_store(volatile atomic<_Tp>* __o, _Tp __d) +atomic_store(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT { __o->store(__d); } @@ -842,7 +847,7 @@ atomic_store(volatile atomic<_Tp>* __o, _Tp __d) template inline _LIBCPP_INLINE_VISIBILITY void -atomic_store(atomic<_Tp>* __o, _Tp __d) +atomic_store(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT { __o->store(__d); } @@ -852,7 +857,7 @@ atomic_store(atomic<_Tp>* __o, _Tp __d) template inline _LIBCPP_INLINE_VISIBILITY void -atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) +atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT { __o->store(__d, __m); } @@ -860,7 +865,7 @@ atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) template inline _LIBCPP_INLINE_VISIBILITY void -atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) +atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT { __o->store(__d, __m); } @@ -870,7 +875,7 @@ atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) template inline _LIBCPP_INLINE_VISIBILITY _Tp -atomic_load(const volatile atomic<_Tp>* __o) +atomic_load(const volatile atomic<_Tp>* __o) _NOEXCEPT { return __o->load(); } @@ -878,7 +883,7 @@ atomic_load(const volatile atomic<_Tp>* __o) template inline _LIBCPP_INLINE_VISIBILITY _Tp -atomic_load(const atomic<_Tp>* __o) +atomic_load(const atomic<_Tp>* __o) _NOEXCEPT { return __o->load(); } @@ -888,7 +893,7 @@ atomic_load(const atomic<_Tp>* __o) template inline _LIBCPP_INLINE_VISIBILITY _Tp -atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) +atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEPT { return __o->load(__m); } @@ -896,7 +901,7 @@ atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) template inline _LIBCPP_INLINE_VISIBILITY _Tp -atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) +atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT { return __o->load(__m); } @@ -906,7 +911,7 @@ atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) template inline _LIBCPP_INLINE_VISIBILITY _Tp -atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) +atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT { return __o->exchange(__d); } @@ -914,7 +919,7 @@ atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) template inline _LIBCPP_INLINE_VISIBILITY _Tp -atomic_exchange(atomic<_Tp>* __o, _Tp __d) +atomic_exchange(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT { return __o->exchange(__d); } @@ -924,7 +929,7 @@ atomic_exchange(atomic<_Tp>* __o, _Tp __d) template inline _LIBCPP_INLINE_VISIBILITY _Tp -atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) +atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT { return __o->exchange(__d, __m); } @@ -932,7 +937,7 @@ atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) template inline _LIBCPP_INLINE_VISIBILITY _Tp -atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) +atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT { return __o->exchange(__d, __m); } @@ -942,7 +947,7 @@ atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) template inline _LIBCPP_INLINE_VISIBILITY bool -atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) +atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT { return __o->compare_exchange_weak(*__e, __d); } @@ -950,7 +955,7 @@ atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) template inline _LIBCPP_INLINE_VISIBILITY bool -atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) +atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT { return __o->compare_exchange_weak(*__e, __d); } @@ -960,7 +965,7 @@ atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) template inline _LIBCPP_INLINE_VISIBILITY bool -atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) +atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT { return __o->compare_exchange_strong(*__e, __d); } @@ -968,7 +973,7 @@ atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) template inline _LIBCPP_INLINE_VISIBILITY bool -atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) +atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT { return __o->compare_exchange_strong(*__e, __d); } @@ -980,7 +985,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d, - memory_order __s, memory_order __f) + memory_order __s, memory_order __f) _NOEXCEPT { return __o->compare_exchange_weak(*__e, __d, __s, __f); } @@ -989,7 +994,7 @@ template inline _LIBCPP_INLINE_VISIBILITY bool atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d, - memory_order __s, memory_order __f) + memory_order __s, memory_order __f) _NOEXCEPT { return __o->compare_exchange_weak(*__e, __d, __s, __f); } @@ -1001,7 +1006,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d, - memory_order __s, memory_order __f) + memory_order __s, memory_order __f) _NOEXCEPT { return __o->compare_exchange_strong(*__e, __d, __s, __f); } @@ -1011,7 +1016,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d, - memory_order __s, memory_order __f) + memory_order __s, memory_order __f) _NOEXCEPT { return __o->compare_exchange_strong(*__e, __d, __s, __f); } @@ -1025,7 +1030,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_add(volatile atomic<_Tp>* __o, _Tp __op) +atomic_fetch_add(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT { return __o->fetch_add(__op); } @@ -1037,7 +1042,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_add(atomic<_Tp>* __o, _Tp __op) +atomic_fetch_add(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT { return __o->fetch_add(__op); } @@ -1045,7 +1050,7 @@ atomic_fetch_add(atomic<_Tp>* __o, _Tp __op) template inline _LIBCPP_INLINE_VISIBILITY _Tp* -atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) +atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT { return __o->fetch_add(__op); } @@ -1053,7 +1058,7 @@ atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) template inline _LIBCPP_INLINE_VISIBILITY _Tp* -atomic_fetch_add(atomic<_Tp*>* __o, ptrdiff_t __op) +atomic_fetch_add(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT { return __o->fetch_add(__op); } @@ -1067,7 +1072,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) +atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT { return __o->fetch_add(__op, __m); } @@ -1079,7 +1084,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_add_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) +atomic_fetch_add_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT { return __o->fetch_add(__op, __m); } @@ -1088,7 +1093,7 @@ template inline _LIBCPP_INLINE_VISIBILITY _Tp* atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op, - memory_order __m) + memory_order __m) _NOEXCEPT { return __o->fetch_add(__op, __m); } @@ -1096,7 +1101,7 @@ atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op, template inline _LIBCPP_INLINE_VISIBILITY _Tp* -atomic_fetch_add_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) +atomic_fetch_add_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT { return __o->fetch_add(__op, __m); } @@ -1110,7 +1115,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_sub(volatile atomic<_Tp>* __o, _Tp __op) +atomic_fetch_sub(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT { return __o->fetch_sub(__op); } @@ -1122,7 +1127,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) +atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT { return __o->fetch_sub(__op); } @@ -1130,7 +1135,7 @@ atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) template inline _LIBCPP_INLINE_VISIBILITY _Tp* -atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) +atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT { return __o->fetch_sub(__op); } @@ -1138,7 +1143,7 @@ atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) template inline _LIBCPP_INLINE_VISIBILITY _Tp* -atomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op) +atomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT { return __o->fetch_sub(__op); } @@ -1152,7 +1157,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) +atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT { return __o->fetch_sub(__op, __m); } @@ -1164,7 +1169,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_sub_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) +atomic_fetch_sub_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT { return __o->fetch_sub(__op, __m); } @@ -1173,7 +1178,7 @@ template inline _LIBCPP_INLINE_VISIBILITY _Tp* atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op, - memory_order __m) + memory_order __m) _NOEXCEPT { return __o->fetch_sub(__op, __m); } @@ -1181,7 +1186,7 @@ atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op, template inline _LIBCPP_INLINE_VISIBILITY _Tp* -atomic_fetch_sub_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) +atomic_fetch_sub_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT { return __o->fetch_sub(__op, __m); } @@ -1195,7 +1200,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_and(volatile atomic<_Tp>* __o, _Tp __op) +atomic_fetch_and(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT { return __o->fetch_and(__op); } @@ -1207,7 +1212,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_and(atomic<_Tp>* __o, _Tp __op) +atomic_fetch_and(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT { return __o->fetch_and(__op); } @@ -1221,7 +1226,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) +atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT { return __o->fetch_and(__op, __m); } @@ -1233,7 +1238,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_and_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) +atomic_fetch_and_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT { return __o->fetch_and(__op, __m); } @@ -1247,7 +1252,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_or(volatile atomic<_Tp>* __o, _Tp __op) +atomic_fetch_or(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT { return __o->fetch_or(__op); } @@ -1259,7 +1264,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_or(atomic<_Tp>* __o, _Tp __op) +atomic_fetch_or(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT { return __o->fetch_or(__op); } @@ -1273,7 +1278,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) +atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT { return __o->fetch_or(__op, __m); } @@ -1285,7 +1290,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_or_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) +atomic_fetch_or_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT { return __o->fetch_or(__op, __m); } @@ -1299,7 +1304,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_xor(volatile atomic<_Tp>* __o, _Tp __op) +atomic_fetch_xor(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT { return __o->fetch_xor(__op); } @@ -1311,7 +1316,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_xor(atomic<_Tp>* __o, _Tp __op) +atomic_fetch_xor(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT { return __o->fetch_xor(__op); } @@ -1325,7 +1330,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) +atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT { return __o->fetch_xor(__op, __m); } @@ -1337,7 +1342,7 @@ typename enable_if is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type -atomic_fetch_xor_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) +atomic_fetch_xor_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT { return __o->fetch_xor(__op, __m); } @@ -1346,25 +1351,25 @@ atomic_fetch_xor_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) typedef struct atomic_flag { - bool __a_; + _Atomic(bool) __a_; _LIBCPP_INLINE_VISIBILITY - bool test_and_set(memory_order __m = memory_order_seq_cst) volatile - {return __atomic_exchange(&__a_, true, __m);} + bool test_and_set(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT + {return __c11_atomic_exchange(&__a_, true, __m);} _LIBCPP_INLINE_VISIBILITY - bool test_and_set(memory_order __m = memory_order_seq_cst) - {return __atomic_exchange(&__a_, true, __m);} + bool test_and_set(memory_order __m = memory_order_seq_cst) _NOEXCEPT + {return __c11_atomic_exchange(&__a_, true, __m);} _LIBCPP_INLINE_VISIBILITY - void clear(memory_order __m = memory_order_seq_cst) volatile - {__atomic_store(&__a_, false, __m);} + void clear(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT + {__c11_atomic_store(&__a_, false, __m);} _LIBCPP_INLINE_VISIBILITY - void clear(memory_order __m = memory_order_seq_cst) - {__atomic_store(&__a_, false, __m);} + void clear(memory_order __m = memory_order_seq_cst) _NOEXCEPT + {__c11_atomic_store(&__a_, false, __m);} _LIBCPP_INLINE_VISIBILITY - atomic_flag() {} // = default; + atomic_flag() _NOEXCEPT {} // = default; _LIBCPP_INLINE_VISIBILITY - atomic_flag(bool __b) : __a_(__b) {} + atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS atomic_flag(const atomic_flag&) = delete; @@ -1380,56 +1385,56 @@ private: inline _LIBCPP_INLINE_VISIBILITY bool -atomic_flag_test_and_set(volatile atomic_flag* __o) +atomic_flag_test_and_set(volatile atomic_flag* __o) _NOEXCEPT { return __o->test_and_set(); } inline _LIBCPP_INLINE_VISIBILITY bool -atomic_flag_test_and_set(atomic_flag* __o) +atomic_flag_test_and_set(atomic_flag* __o) _NOEXCEPT { return __o->test_and_set(); } inline _LIBCPP_INLINE_VISIBILITY bool -atomic_flag_test_and_set_explicit(volatile atomic_flag* __o, memory_order __m) +atomic_flag_test_and_set_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT { return __o->test_and_set(__m); } inline _LIBCPP_INLINE_VISIBILITY bool -atomic_flag_test_and_set_explicit(atomic_flag* __o, memory_order __m) +atomic_flag_test_and_set_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT { return __o->test_and_set(__m); } inline _LIBCPP_INLINE_VISIBILITY void -atomic_flag_clear(volatile atomic_flag* __o) +atomic_flag_clear(volatile atomic_flag* __o) _NOEXCEPT { __o->clear(); } inline _LIBCPP_INLINE_VISIBILITY void -atomic_flag_clear(atomic_flag* __o) +atomic_flag_clear(atomic_flag* __o) _NOEXCEPT { __o->clear(); } inline _LIBCPP_INLINE_VISIBILITY void -atomic_flag_clear_explicit(volatile atomic_flag* __o, memory_order __m) +atomic_flag_clear_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT { __o->clear(__m); } inline _LIBCPP_INLINE_VISIBILITY void -atomic_flag_clear_explicit(atomic_flag* __o, memory_order __m) +atomic_flag_clear_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT { __o->clear(__m); } @@ -1438,20 +1443,21 @@ atomic_flag_clear_explicit(atomic_flag* __o, memory_order __m) inline _LIBCPP_INLINE_VISIBILITY void -atomic_thread_fence(memory_order __m) +atomic_thread_fence(memory_order __m) _NOEXCEPT { - __atomic_thread_fence(__m); + __c11_atomic_thread_fence(__m); } inline _LIBCPP_INLINE_VISIBILITY void -atomic_signal_fence(memory_order __m) +atomic_signal_fence(memory_order __m) _NOEXCEPT { - __atomic_signal_fence(__m); + __c11_atomic_signal_fence(__m); } // Atomics for standard typedef types +typedef atomic atomic_bool; typedef atomic atomic_char; typedef atomic atomic_schar; typedef atomic atomic_uchar; @@ -1497,14 +1503,16 @@ typedef atomic atomic_uintmax_t; // lock-free property -#define ATOMIC_CHAR_LOCK_FREE 0 -#define ATOMIC_CHAR16_T_LOCK_FREE 0 -#define ATOMIC_CHAR32_T_LOCK_FREE 0 -#define ATOMIC_WCHAR_T_LOCK_FREE 0 -#define ATOMIC_SHORT_LOCK_FREE 0 -#define ATOMIC_INT_LOCK_FREE 0 -#define ATOMIC_LONG_LOCK_FREE 0 -#define ATOMIC_LLONG_LOCK_FREE 0 +#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE +#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE +#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE +#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE +#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE +#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE +#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE +#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE +#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE +#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE #endif // !__has_feature(cxx_atomic) diff --git a/system/include/libcxx/bitset b/system/include/libcxx/bitset index 4d9efd9391bb9..06fd729ef8c41 100644 --- a/system/include/libcxx/bitset +++ b/system/include/libcxx/bitset @@ -113,7 +113,9 @@ template struct hash>; */ +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif #include <__config> #include <__bit_reference> @@ -127,6 +129,8 @@ template struct hash>; #include #endif +#include <__undef_min_max> + _LIBCPP_BEGIN_NAMESPACE_STD template @@ -144,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); @@ -155,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]; @@ -164,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);} @@ -190,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; @@ -202,14 +208,22 @@ 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) +__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT { __storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)]; for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word) @@ -222,17 +236,31 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) template inline _LIBCPP_INLINE_VISIBILITY void -__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) +__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT { __first_[0] = __v; _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 +#if __SIZE_WIDTH__ == 64 + : __first_{__v} +#elif __SIZE_WIDTH__ == 32 + : __first_{__v, __v >> __bits_per_word} +#elif +#error This constructor has not been ported to this platform +#endif +#endif { +#ifdef _LIBCPP_HAS_NO_CONSTEXPR __init(__v, integral_constant()); +#endif } template @@ -402,9 +430,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); @@ -413,7 +441,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_; @@ -422,12 +450,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);} @@ -451,6 +479,7 @@ protected: template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR __bitset<1, _Size>::__bitset() _NOEXCEPT : __first_(0) { @@ -458,6 +487,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)) { @@ -545,9 +575,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); @@ -556,23 +586,23 @@ 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>; typedef __bit_reference<__bitset> reference; typedef __bit_const_reference<__bitset> const_reference; 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 __pos) _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT {return iterator(0, 0);} - _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t) const _NOEXCEPT {return const_iterator(0, 0);} _LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {} @@ -591,22 +621,25 @@ 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 class _LIBCPP_VISIBLE bitset : private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size> { +public: static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1; typedef __bitset<__n_words, _Size> base; @@ -615,8 +648,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, @@ -643,7 +677,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; @@ -659,7 +694,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; @@ -691,11 +726,11 @@ bitset<_Size>::bitset(const _CharT* __str, #else assert(!"bitset string ctor has invalid argument"); #endif - size_t _M = _VSTD::min(__rlen, _Size); + size_t _Mp = _VSTD::min(__rlen, _Size); size_t __i = 0; - for (; __i < _M; ++__i) + for (; __i < _Mp; ++__i) { - _CharT __c = __str[_M - 1 - __i]; + _CharT __c = __str[_Mp - 1 - __i]; if (__c == __zero) (*this)[__i] = false; else @@ -725,11 +760,11 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str, #else assert(!"bitset string ctor has invalid argument"); #endif - size_t _M = _VSTD::min(__rlen, _Size); + size_t _Mp = _VSTD::min(__rlen, _Size); size_t __i = 0; - for (; __i < _M; ++__i) + for (; __i < _Mp; ++__i) { - _CharT __c = __str[__pos + _M - 1 - __i]; + _CharT __c = __str[__pos + _Mp - 1 - __i]; if (_Traits::eq(__c, __zero)) (*this)[__i] = false; else diff --git a/system/include/libcxx/cassert b/system/include/libcxx/cassert index 7337b16ee64d4..3775990640a94 100644 --- a/system/include/libcxx/cassert +++ b/system/include/libcxx/cassert @@ -20,4 +20,6 @@ Macros: #include <__config> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif diff --git a/system/include/libcxx/ccomplex b/system/include/libcxx/ccomplex index 0e999a92d1fc4..6ed116445e64e 100644 --- a/system/include/libcxx/ccomplex +++ b/system/include/libcxx/ccomplex @@ -20,7 +20,9 @@ #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif // hh 080623 Created diff --git a/system/include/libcxx/cctype b/system/include/libcxx/cctype index dbdc3e765e533..e33244e7daa25 100644 --- a/system/include/libcxx/cctype +++ b/system/include/libcxx/cctype @@ -37,8 +37,13 @@ int toupper(int c); #include <__config> #include +#if defined(_MSC_VER) +#include "support/win32/support.h" +#endif // _MSC_VER +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/system/include/libcxx/cerrno b/system/include/libcxx/cerrno index 71084a14ac589..9804e4e3dcfec 100644 --- a/system/include/libcxx/cerrno +++ b/system/include/libcxx/cerrno @@ -26,7 +26,9 @@ Macros: #include <__config> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif #if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) diff --git a/system/include/libcxx/cfenv b/system/include/libcxx/cfenv index cd86b88232588..dd7db37f8e484 100644 --- a/system/include/libcxx/cfenv +++ b/system/include/libcxx/cfenv @@ -56,7 +56,9 @@ int feupdateenv(const fenv_t* envp); #include <__config> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/system/include/libcxx/cfloat b/system/include/libcxx/cfloat index f0079c23fa24d..5fa56550fa6a1 100644 --- a/system/include/libcxx/cfloat +++ b/system/include/libcxx/cfloat @@ -63,7 +63,9 @@ Macros: #include <__config> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif #ifndef FLT_EVAL_METHOD #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ diff --git a/system/include/libcxx/chrono b/system/include/libcxx/chrono index a6cd1945bfff6..508c1f3775795 100644 --- a/system/include/libcxx/chrono +++ b/system/include/libcxx/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 @@ -255,7 +268,11 @@ typedef steady_clock high_resolution_clock; #include #include +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -302,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())); @@ -312,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; @@ -324,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; @@ -336,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; @@ -348,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, @@ -365,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 @@ -385,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 < @@ -399,7 +417,7 @@ public: // conversions template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration(const duration<_Rep2, _Period2>& __d, typename enable_if < @@ -411,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;} @@ -432,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; @@ -449,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; @@ -460,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) { @@ -477,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) { @@ -488,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; @@ -499,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) { @@ -516,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) { @@ -526,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) { @@ -536,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) { @@ -546,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, @@ -578,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, @@ -623,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) { @@ -645,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())); } ////////////////////////////////////////////////////////// @@ -701,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/system/include/libcxx/cinttypes b/system/include/libcxx/cinttypes index ddf20e896141e..786692b8fec3c 100644 --- a/system/include/libcxx/cinttypes +++ b/system/include/libcxx/cinttypes @@ -239,7 +239,9 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/system/include/libcxx/ciso646 b/system/include/libcxx/ciso646 index 38b3e942a8334..b2efc72a9aa1f 100644 --- a/system/include/libcxx/ciso646 +++ b/system/include/libcxx/ciso646 @@ -18,6 +18,8 @@ #include <__config> +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif #endif // _LIBCPP_CISO646 diff --git a/system/include/libcxx/climits b/system/include/libcxx/climits index c82becdc0567f..81ffecdf6eef0 100644 --- a/system/include/libcxx/climits +++ b/system/include/libcxx/climits @@ -41,6 +41,8 @@ Macros: #include <__config> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif #endif // _LIBCPP_CLIMITS diff --git a/system/include/libcxx/clocale b/system/include/libcxx/clocale index 6982f84e9cf23..f8b8f0dd34b6f 100644 --- a/system/include/libcxx/clocale +++ b/system/include/libcxx/clocale @@ -38,7 +38,9 @@ lconv* localeconv(); #include <__config> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/system/include/libcxx/cmath b/system/include/libcxx/cmath index f8bc0dfc66a7f..bd6034413eef7 100644 --- a/system/include/libcxx/cmath +++ b/system/include/libcxx/cmath @@ -137,21 +137,21 @@ long double tanhl(long double x); // C99 -bool signbit(floating_point x); +bool signbit(arithmetic x); -int fpclassify(floating_point x); +int fpclassify(arithmetic x); -bool isfinite(floating_point x); -bool isinf(floating_point x); -bool isnan(floating_point x); -bool isnormal(floating_point x); +bool isfinite(arithmetic x); +bool isinf(arithmetic x); +bool isnan(arithmetic x); +bool isnormal(arithmetic x); -bool isgreater(floating_point x, floating_point y); -bool isgreaterequal(floating_point x, floating_point y); -bool isless(floating_point x, floating_point y); -bool islessequal(floating_point x, floating_point y); -bool islessgreater(floating_point x, floating_point y); -bool isunordered(floating_point x, floating_point y); +bool isgreater(arithmetic x, arithmetic y); +bool isgreaterequal(arithmetic x, arithmetic y); +bool isless(arithmetic x, arithmetic y); +bool islessequal(arithmetic x, arithmetic y); +bool islessgreater(arithmetic x, arithmetic y); +bool isunordered(arithmetic x, arithmetic y); floating_point acosh (arithmetic x); float acoshf(float x); @@ -301,7 +301,13 @@ long double truncl(long double x); #include #include +#ifdef _MSC_VER +#include "support/win32/math_win32.h" +#endif + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif // signbit @@ -310,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); } @@ -319,10 +325,10 @@ __libcpp_signbit(_A1 __x) template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type -signbit(_A1 __x) +typename std::enable_if::value, bool>::type +signbit(_A1 __x) _NOEXCEPT { - return __libcpp_signbit(__x); + return __libcpp_signbit((typename std::__promote<_A1>::type)__x); } #endif // signbit @@ -334,7 +340,7 @@ signbit(_A1 __x) template _LIBCPP_ALWAYS_INLINE int -__libcpp_fpclassify(_A1 __x) +__libcpp_fpclassify(_A1 __x) _NOEXCEPT { return fpclassify(__x); } @@ -343,10 +349,10 @@ __libcpp_fpclassify(_A1 __x) template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, int>::type -fpclassify(_A1 __x) +typename std::enable_if::value, int>::type +fpclassify(_A1 __x) _NOEXCEPT { - return __libcpp_fpclassify(__x); + return __libcpp_fpclassify((typename std::__promote<_A1>::type)__x); } #endif // fpclassify @@ -358,7 +364,7 @@ fpclassify(_A1 __x) template _LIBCPP_ALWAYS_INLINE bool -__libcpp_isfinite(_A1 __x) +__libcpp_isfinite(_A1 __x) _NOEXCEPT { return isfinite(__x); } @@ -367,10 +373,10 @@ __libcpp_isfinite(_A1 __x) template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type -isfinite(_A1 __x) +typename std::enable_if::value, bool>::type +isfinite(_A1 __x) _NOEXCEPT { - return __libcpp_isfinite(__x); + return __libcpp_isfinite((typename std::__promote<_A1>::type)__x); } #endif // isfinite @@ -382,7 +388,7 @@ isfinite(_A1 __x) template _LIBCPP_ALWAYS_INLINE bool -__libcpp_isinf(_A1 __x) +__libcpp_isinf(_A1 __x) _NOEXCEPT { return isinf(__x); } @@ -391,10 +397,10 @@ __libcpp_isinf(_A1 __x) template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type -isinf(_A1 __x) +typename std::enable_if::value, bool>::type +isinf(_A1 __x) _NOEXCEPT { - return __libcpp_isinf(__x); + return __libcpp_isinf((typename std::__promote<_A1>::type)__x); } #endif // isinf @@ -406,7 +412,7 @@ isinf(_A1 __x) template _LIBCPP_ALWAYS_INLINE bool -__libcpp_isnan(_A1 __x) +__libcpp_isnan(_A1 __x) _NOEXCEPT { return isnan(__x); } @@ -415,10 +421,10 @@ __libcpp_isnan(_A1 __x) template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type -isnan(_A1 __x) +typename std::enable_if::value, bool>::type +isnan(_A1 __x) _NOEXCEPT { - return __libcpp_isnan(__x); + return __libcpp_isnan((typename std::__promote<_A1>::type)__x); } #endif // isnan @@ -430,7 +436,7 @@ isnan(_A1 __x) template _LIBCPP_ALWAYS_INLINE bool -__libcpp_isnormal(_A1 __x) +__libcpp_isnormal(_A1 __x) _NOEXCEPT { return isnormal(__x); } @@ -439,10 +445,10 @@ __libcpp_isnormal(_A1 __x) template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type -isnormal(_A1 __x) +typename std::enable_if::value, bool>::type +isnormal(_A1 __x) _NOEXCEPT { - return __libcpp_isnormal(__x); + return __libcpp_isnormal((typename std::__promote<_A1>::type)__x); } #endif // isnormal @@ -454,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); } @@ -465,13 +471,14 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if < - std::is_floating_point<_A1>::value && - std::is_floating_point<_A2>::value, + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, bool >::type -isgreater(_A1 __x, _A2 __y) +isgreater(_A1 __x, _A2 __y) _NOEXCEPT { - return __libcpp_isgreater(__x, __y); + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_isgreater((type)__x, (type)__y); } #endif // isgreater @@ -483,7 +490,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); } @@ -494,13 +501,14 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if < - std::is_floating_point<_A1>::value && - std::is_floating_point<_A2>::value, + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, bool >::type -isgreaterequal(_A1 __x, _A2 __y) +isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT { - return __libcpp_isgreaterequal(__x, __y); + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_isgreaterequal((type)__x, (type)__y); } #endif // isgreaterequal @@ -512,7 +520,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); } @@ -523,13 +531,14 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if < - std::is_floating_point<_A1>::value && - std::is_floating_point<_A2>::value, + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, bool >::type -isless(_A1 __x, _A2 __y) +isless(_A1 __x, _A2 __y) _NOEXCEPT { - return __libcpp_isless(__x, __y); + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_isless((type)__x, (type)__y); } #endif // isless @@ -541,7 +550,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); } @@ -552,13 +561,14 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if < - std::is_floating_point<_A1>::value && - std::is_floating_point<_A2>::value, + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, bool >::type -islessequal(_A1 __x, _A2 __y) +islessequal(_A1 __x, _A2 __y) _NOEXCEPT { - return __libcpp_islessequal(__x, __y); + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_islessequal((type)__x, (type)__y); } #endif // islessequal @@ -570,7 +580,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); } @@ -581,13 +591,14 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if < - std::is_floating_point<_A1>::value && - std::is_floating_point<_A2>::value, + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, bool >::type -islessgreater(_A1 __x, _A2 __y) +islessgreater(_A1 __x, _A2 __y) _NOEXCEPT { - return __libcpp_islessgreater(__x, __y); + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_islessgreater((type)__x, (type)__y); } #endif // islessgreater @@ -599,7 +610,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); } @@ -610,13 +621,14 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if < - std::is_floating_point<_A1>::value && - std::is_floating_point<_A2>::value, + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, bool >::type -isunordered(_A1 __x, _A2 __y) +isunordered(_A1 __x, _A2 __y) _NOEXCEPT { - return __libcpp_isunordered(__x, __y); + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_isunordered((type)__x, (type)__y); } #endif // isunordered @@ -642,57 +654,74 @@ using ::double_t; // abs -template inline _LIBCPP_INLINE_VISIBILITY -typename enable_if::value, _A1>::type -abs(_A1 __x) {return fabs(__x);} +float +abs(float __x) _NOEXCEPT {return fabsf(__x);} + +inline _LIBCPP_INLINE_VISIBILITY +double +abs(double __x) _NOEXCEPT {return fabs(__x);} + +inline _LIBCPP_INLINE_VISIBILITY +long double +abs(long double __x) _NOEXCEPT {return fabsl(__x);} + +#ifndef __sun__ // acos using ::acos; using ::acosf; -inline _LIBCPP_INLINE_VISIBILITY float acos(float __x) {return acosf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __x) {return acosl(__x);} +#ifndef _MSC_VER +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 using ::asin; using ::asinf; -inline _LIBCPP_INLINE_VISIBILITY float asin(float __x) {return asinf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __x) {return asinl(__x);} +#ifndef _MSC_VER +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 using ::atan; using ::atanf; -inline _LIBCPP_INLINE_VISIBILITY float atan(float __x) {return atanf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __x) {return atanl(__x);} +#ifndef _MSC_VER +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 using ::atan2; using ::atan2f; -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);} +#ifndef _MSC_VER +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 inline _LIBCPP_INLINE_VISIBILITY @@ -702,7 +731,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 && @@ -715,86 +744,106 @@ atan2(_A1 __y, _A2 __x) using ::ceil; using ::ceilf; -inline _LIBCPP_INLINE_VISIBILITY float ceil(float __x) {return ceilf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __x) {return ceill(__x);} +#ifndef _MSC_VER +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 using ::cos; using ::cosf; -inline _LIBCPP_INLINE_VISIBILITY float cos(float __x) {return cosf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __x) {return cosl(__x);} +#ifndef _MSC_VER +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 using ::cosh; using ::coshf; -inline _LIBCPP_INLINE_VISIBILITY float cosh(float __x) {return coshf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __x) {return coshl(__x);} +#ifndef _MSC_VER +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 using ::exp; using ::expf; -inline _LIBCPP_INLINE_VISIBILITY float exp(float __x) {return expf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) {return expl(__x);} +#ifndef __sun__ + +#ifndef _MSC_VER +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 using ::fabs; using ::fabsf; -inline _LIBCPP_INLINE_VISIBILITY float fabs(float __x) {return fabsf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __x) {return fabsl(__x);} +#ifndef _MSC_VER +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 using ::floor; using ::floorf; -inline _LIBCPP_INLINE_VISIBILITY float floor(float __x) {return floorf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __x) {return floorl(__x);} +#ifndef _MSC_VER +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 +#endif //__sun__ using ::fmod; using ::fmodf; +#ifndef __sun__ -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);} +#ifndef _MSC_VER +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 inline _LIBCPP_INLINE_VISIBILITY @@ -804,7 +853,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 && @@ -812,73 +861,92 @@ fmod(_A1 __x, _A2 __y) return fmod((__result_type)__x, (__result_type)__y); } + // frexp using ::frexp; using ::frexpf; -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);} +#ifndef _MSC_VER +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 using ::ldexp; using ::ldexpf; -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);} +#ifndef _MSC_VER +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 +#endif // __sun__ using ::log; using ::logf; +#ifndef __sun__ -inline _LIBCPP_INLINE_VISIBILITY float log(float __x) {return logf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double log(long double __x) {return logl(__x);} +#ifndef _MSC_VER +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 using ::log10; using ::log10f; -inline _LIBCPP_INLINE_VISIBILITY float log10(float __x) {return log10f(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __x) {return log10l(__x);} +#ifndef _MSC_VER +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 using ::modf; using ::modff; -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);} +#ifndef _MSC_VER +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 +#endif // __sun__ using ::pow; using ::powf; -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);} +#ifndef __sun__ + +#ifndef _MSC_VER +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 inline _LIBCPP_INLINE_VISIBILITY @@ -888,7 +956,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 && @@ -896,130 +964,152 @@ pow(_A1 __x, _A2 __y) return pow((__result_type)__x, (__result_type)__y); } + // sin using ::sin; using ::sinf; -inline _LIBCPP_INLINE_VISIBILITY float sin(float __x) {return sinf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __x) {return sinl(__x);} +#ifndef _MSC_VER +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 using ::sinh; using ::sinhf; -inline _LIBCPP_INLINE_VISIBILITY float sinh(float __x) {return sinhf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __x) {return sinhl(__x);} +#ifndef _MSC_VER +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 +#endif // __sun__ using ::sqrt; using ::sqrtf; -inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __x) {return sqrtf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) {return sqrtl(__x);} + +#if !(defined(_MSC_VER) || defined(__sun__)) +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 using ::tan; using ::tanf; +#ifndef __sun__ -inline _LIBCPP_INLINE_VISIBILITY float tan(float __x) {return tanf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __x) {return tanl(__x);} +#ifndef _MSC_VER +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 using ::tanh; using ::tanhf; -inline _LIBCPP_INLINE_VISIBILITY float tanh(float __x) {return tanhf(__x);} -inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __x) {return tanhl(__x);} +#ifndef _MSC_VER +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 +#ifndef _MSC_VER 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 +#ifndef _MSC_VER 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 +#ifndef _MSC_VER 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 +#ifndef _MSC_VER 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 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 @@ -1029,7 +1119,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 && @@ -1037,65 +1127,67 @@ copysign(_A1 __x, _A2 __y) return copysign((__result_type)__x, (__result_type)__y); } +#ifndef _MSC_VER + // erf 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 @@ -1105,7 +1197,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 && @@ -1115,13 +1207,15 @@ 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);} +#ifndef FP_FAST_FMAF #define FP_FAST_FMAF +#endif 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 @@ -1132,7 +1226,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 && @@ -1146,8 +1240,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 @@ -1157,7 +1251,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 && @@ -1170,8 +1264,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 @@ -1181,7 +1275,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 && @@ -1194,8 +1288,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 @@ -1205,7 +1299,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 && @@ -1218,143 +1312,148 @@ 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 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 +#endif // __sun__ using ::nan; using ::nanf; +#ifndef __sun__ +#ifndef _MSC_VER // nearbyint 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 @@ -1364,7 +1463,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 && @@ -1377,21 +1476,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 @@ -1401,7 +1500,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 && @@ -1414,8 +1513,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 @@ -1425,7 +1524,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 && @@ -1438,78 +1537,80 @@ 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 using ::acosl; using ::asinl; @@ -1532,12 +1633,15 @@ using ::sinl; using ::sinhl; using ::sqrtl; using ::tanl; +#ifndef _MSC_VER using ::tanhl; using ::acoshl; using ::asinhl; using ::atanhl; using ::cbrtl; +#endif // !_MSC_VER using ::copysignl; +#ifndef _MSC_VER using ::erfl; using ::erfcl; using ::exp2l; @@ -1568,7 +1672,12 @@ using ::scalblnl; using ::scalbnl; using ::tgammal; using ::truncl; +#endif // !_MSC_VER +#else +using ::lgamma; +using ::lgammaf; +#endif // __sun__ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_CMATH diff --git a/system/include/libcxx/codecvt b/system/include/libcxx/codecvt index 86fdc727e4392..6c44e34347460 100644 --- a/system/include/libcxx/codecvt +++ b/system/include/libcxx/codecvt @@ -55,7 +55,9 @@ class codecvt_utf8_utf16 #include <__config> #include <__locale> +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/system/include/libcxx/complex b/system/include/libcxx/complex index f91b240488b60..07d3754658fbf 100644 --- a/system/include/libcxx/complex +++ b/system/include/libcxx/complex @@ -249,7 +249,9 @@ template #include #endif +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -280,7 +282,8 @@ public: _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} - _LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re) {__re_ = __re; return *this;} + _LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re) + {__re_ = __re; __im_ = value_type(); return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator+=(const value_type& __re) {__re_ += __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;} @@ -327,18 +330,19 @@ 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;} - _LIBCPP_INLINE_VISIBILITY complex& operator= (float __re) {__re_ = __re; return *this;} + _LIBCPP_INLINE_VISIBILITY complex& operator= (float __re) + {__re_ = __re; __im_ = value_type(); return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator+=(float __re) {__re_ += __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator-=(float __re) {__re_ -= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;} @@ -382,18 +386,19 @@ 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;} - _LIBCPP_INLINE_VISIBILITY complex& operator= (double __re) {__re_ = __re; return *this;} + _LIBCPP_INLINE_VISIBILITY complex& operator= (double __re) + {__re_ = __re; __im_ = value_type(); return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator+=(double __re) {__re_ += __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator-=(double __re) {__re_ -= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;} @@ -437,18 +442,19 @@ 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;} - _LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re) {__re_ = __re; return *this;} + _LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re) + {__re_ = __re; __im_ = value_type(); return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator+=(long double __re) {__re_ += __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator-=(long double __re) {__re_ -= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;} @@ -484,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()) {} @@ -1243,10 +1249,12 @@ acosh(const complex<_Tp>& __x) if (isnan(__x.imag())) return complex<_Tp>(abs(__x.real()), __x.imag()); if (isinf(__x.imag())) + { if (__x.real() > 0) return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag())); else return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag())); + } if (__x.real() < 0) return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag())); return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag())); @@ -1345,7 +1353,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/system/include/libcxx/complex.h b/system/include/libcxx/complex.h index e04b2e3e881e2..7003d31a89cdc 100644 --- a/system/include/libcxx/complex.h +++ b/system/include/libcxx/complex.h @@ -28,6 +28,8 @@ #endif // __cplusplus +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif #endif // _LIBCPP_COMPLEX_H diff --git a/system/include/libcxx/condition_variable b/system/include/libcxx/condition_variable index fc3ac3dff5c85..b1a50ee5ff13f 100644 --- a/system/include/libcxx/condition_variable +++ b/system/include/libcxx/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); @@ -111,7 +111,9 @@ public: #include <__mutex_base> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -122,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); @@ -159,17 +161,17 @@ 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_);} + {lock_guard __lx(*__mut_);} __cv_.notify_one(); } inline _LIBCPP_INLINE_VISIBILITY void -condition_variable_any::notify_all() +condition_variable_any::notify_all() _NOEXCEPT { - {lock_guard _(*__mut_);} + {lock_guard __lx(*__mut_);} __cv_.notify_all(); } @@ -186,8 +188,8 @@ condition_variable_any::wait(_Lock& __lock) shared_ptr __mut = __mut_; unique_lock __lk(*__mut); __lock.unlock(); - unique_ptr<_Lock, __lock_external> __(&__lock); - lock_guard > _(__lk, adopt_lock); + unique_ptr<_Lock, __lock_external> __lxx(&__lock); + lock_guard > __lx(__lk, adopt_lock); __cv_.wait(__lk); } // __mut_.unlock(), __lock.lock() @@ -208,8 +210,8 @@ condition_variable_any::wait_until(_Lock& __lock, shared_ptr __mut = __mut_; unique_lock __lk(*__mut); __lock.unlock(); - unique_ptr<_Lock, __lock_external> __(&__lock); - lock_guard > _(__lk, adopt_lock); + unique_ptr<_Lock, __lock_external> __lxx(&__lock); + lock_guard > __lx(__lk, adopt_lock); return __cv_.wait_until(__lk, __t); } // __mut_.unlock(), __lock.lock() diff --git a/system/include/libcxx/csetjmp b/system/include/libcxx/csetjmp index 2b8b81f9d4bcb..d0b2c078967df 100644 --- a/system/include/libcxx/csetjmp +++ b/system/include/libcxx/csetjmp @@ -34,7 +34,9 @@ void longjmp(jmp_buf env, int val); #include <__config> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif #ifndef setjmp #define setjmp(env) setjmp(env) diff --git a/system/include/libcxx/csignal b/system/include/libcxx/csignal index 93adc59928f6d..97282661872a0 100644 --- a/system/include/libcxx/csignal +++ b/system/include/libcxx/csignal @@ -43,7 +43,9 @@ int raise(int sig); #include <__config> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/system/include/libcxx/cstdarg b/system/include/libcxx/cstdarg index dbd73cb3bafb5..c8b6999242f77 100644 --- a/system/include/libcxx/cstdarg +++ b/system/include/libcxx/cstdarg @@ -35,7 +35,9 @@ Types: #include <__config> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/system/include/libcxx/cstdbool b/system/include/libcxx/cstdbool index 76761fb319500..2c764a61f211b 100644 --- a/system/include/libcxx/cstdbool +++ b/system/include/libcxx/cstdbool @@ -22,7 +22,9 @@ Macros: #include <__config> +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif #undef __bool_true_false_are_defined #define __bool_true_false_are_defined 1 diff --git a/system/include/libcxx/cstddef b/system/include/libcxx/cstddef index b851ea0092636..24670897381df 100644 --- a/system/include/libcxx/cstddef +++ b/system/include/libcxx/cstddef @@ -43,7 +43,9 @@ Types: #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -56,31 +58,32 @@ typedef long double max_align_t; struct _LIBCPP_VISIBLE nullptr_t { - void* _; + void* __lx; struct __nat {int __for_bool_;}; - _LIBCPP_ALWAYS_INLINE nullptr_t(int __nat::*) {} + _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {} + _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(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/system/include/libcxx/cstdint b/system/include/libcxx/cstdint index 0ded1f168443a..7a187d3ebf280 100644 --- a/system/include/libcxx/cstdint +++ b/system/include/libcxx/cstdint @@ -144,7 +144,9 @@ Types: #include <__config> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/system/include/libcxx/cstdio b/system/include/libcxx/cstdio index 9af0ed5e366e5..718d2f7155165 100644 --- a/system/include/libcxx/cstdio +++ b/system/include/libcxx/cstdio @@ -99,7 +99,21 @@ void perror(const char* s); #include <__config> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #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 @@ -124,13 +138,15 @@ using ::scanf; using ::snprintf; using ::sprintf; using ::sscanf; +#ifndef _MSC_VER using ::vfprintf; using ::vfscanf; -using ::vprintf; using ::vscanf; +using ::vsscanf; +#endif // _MSC_VER +using ::vprintf; using ::vsnprintf; using ::vsprintf; -using ::vsscanf; using ::fgetc; using ::fgets; using ::fputc; diff --git a/system/include/libcxx/cstdlib b/system/include/libcxx/cstdlib index 26c27ffd201c3..95e384283a7cc 100644 --- a/system/include/libcxx/cstdlib +++ b/system/include/libcxx/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 @@ -81,26 +84,39 @@ size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n); #include <__config> #include +#ifdef _MSC_VER +#include "support/win32/locale_win32.h" +#endif // _MSC_VER +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD using ::size_t; using ::div_t; using ::ldiv_t; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::lldiv_t; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::atof; using ::atoi; using ::atol; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::atoll; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::strtod; using ::strtof; using ::strtold; using ::strtol; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::strtoll; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::strtoul; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::strtoull; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::rand; using ::srand; using ::calloc; @@ -117,21 +133,39 @@ using ::bsearch; using ::qsort; using ::abs; using ::labs; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::llabs; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::div; using ::ldiv; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::lldiv; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::mblen; using ::mbtowc; using ::wctomb; using ::mbstowcs; using ::wcstombs; - -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 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);} +#ifdef _LIBCPP_HAS_QUICK_EXIT +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) _NOEXCEPT {return labs(__x);} +#ifndef _LIBCPP_HAS_NO_LONG_LONG +inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);} +#endif // _LIBCPP_HAS_NO_LONG_LONG + +inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);} +#ifndef _LIBCPP_HAS_NO_LONG_LONG +inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);} +#endif // _LIBCPP_HAS_NO_LONG_LONG +#endif // _MSC_VER _LIBCPP_END_NAMESPACE_STD diff --git a/system/include/libcxx/cstring b/system/include/libcxx/cstring index 6d2e507c4d8a3..13bb11892dc3f 100644 --- a/system/include/libcxx/cstring +++ b/system/include/libcxx/cstring @@ -60,7 +60,9 @@ size_t strlen(const char* s); #include <__config> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -91,7 +93,8 @@ using ::strspn; using ::strstr; -#ifndef __GLIBC__ // GNU libc and its derivates already have the correct prototype in #ifdef __cplusplus +// MSVC, GNU libc and its derivates already have the correct prototype in #ifdef __cplusplus +#if !defined(__GLIBC__) && !defined(_MSC_VER) && !defined(__sun__) inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);} inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);} inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);} diff --git a/system/include/libcxx/ctgmath b/system/include/libcxx/ctgmath index 9044c6ad8870e..535eb7dccd154 100644 --- a/system/include/libcxx/ctgmath +++ b/system/include/libcxx/ctgmath @@ -22,6 +22,8 @@ #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif #endif // _LIBCPP_CTGMATH diff --git a/system/include/libcxx/ctime b/system/include/libcxx/ctime index 2cef9585cec57..fc4eb26f54305 100644 --- a/system/include/libcxx/ctime +++ b/system/include/libcxx/ctime @@ -47,7 +47,9 @@ size_t strftime(char* restrict s, size_t maxsize, const char* restrict format, #include <__config> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/system/include/libcxx/cwchar b/system/include/libcxx/cwchar index ce71782c86bbe..eed6de18f1a30 100644 --- a/system/include/libcxx/cwchar +++ b/system/include/libcxx/cwchar @@ -106,8 +106,13 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len, #include <__config> #include #include +#if _WIN32 +#include // pull in *swprintf defines +#endif // _WIN32 +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -119,13 +124,15 @@ using ::FILE; using ::fwprintf; using ::fwscanf; using ::swprintf; -using ::swscanf; using ::vfwprintf; -using ::vfwscanf; using ::vswprintf; -using ::vswscanf; using ::vwprintf; +#ifndef _MSC_VER +using ::swscanf; +using ::vfwscanf; +using ::vswscanf; using ::vwscanf; +#endif // _MSC_VER using ::wprintf; using ::wscanf; using ::fgetwc; @@ -139,12 +146,18 @@ using ::putwc; using ::putwchar; using ::ungetwc; using ::wcstod; +#ifndef _MSC_VER using ::wcstof; using ::wcstold; +#endif // _MSC_VER using ::wcstol; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::wcstoll; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::wcstoul; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::wcstoull; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::wcscpy; using ::wcsncpy; using ::wcscat; diff --git a/system/include/libcxx/cwctype b/system/include/libcxx/cwctype index f2f4470a95fa7..4f89b52db27ce 100644 --- a/system/include/libcxx/cwctype +++ b/system/include/libcxx/cwctype @@ -54,7 +54,9 @@ wctrans_t wctrans(const char* property); #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/system/include/libcxx/deque b/system/include/libcxx/deque index 87cbe599359d7..b86d77f9f20d3 100644 --- a/system/include/libcxx/deque +++ b/system/include/libcxx/deque @@ -150,7 +150,9 @@ template */ +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif #include <__config> #include <__split_buffer> @@ -160,6 +162,8 @@ template #include #include +#include <__undef_min_max> + _LIBCPP_BEGIN_NAMESPACE_STD template class __deque_base; @@ -276,10 +280,10 @@ public: _LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT {} - template + template _LIBCPP_INLINE_VISIBILITY - __deque_iterator(const __deque_iterator& __it, - typename enable_if::value>::type* = 0) _NOEXCEPT + __deque_iterator(const __deque_iterator& __it, + typename enable_if::value>::type* = 0) _NOEXCEPT : __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {} _LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__ptr_;} @@ -405,9 +409,9 @@ private: _LIBCPP_INLINE_VISIBILITY __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT : __m_iter_(__m), __ptr_(__p) {} - template friend class __deque_base; - template friend class _LIBCPP_VISIBLE deque; - template + template friend class __deque_base; + template friend class _LIBCPP_VISIBLE deque; + template friend class _LIBCPP_VISIBLE __deque_iterator; template ::deque(deque&& __c, const allocator_type& __a) { if (__a != __c.__alloc()) { - typedef move_iterator _I; - assign(_I(__c.begin()), _I(__c.end())); + typedef move_iterator _Ip; + assign(_Ip(__c.begin()), _Ip(__c.end())); } } @@ -1529,8 +1533,8 @@ deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type) { if (__base::__alloc() != __c.__alloc()) { - typedef move_iterator _I; - assign(_I(__c.begin()), _I(__c.end())); + typedef move_iterator _Ip; + assign(_Ip(__c.begin()), _Ip(__c.end())); } else __move_assign(__c, true_type()); @@ -1962,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)); @@ -1969,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 @@ -1985,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/system/include/libcxx/exception b/system/include/libcxx/exception index f418575c735c8..51a48c8286d64 100644 --- a/system/include/libcxx/exception +++ b/system/include/libcxx/exception @@ -80,7 +80,9 @@ template void rethrow_if_nested(const E& e); #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif namespace std // purposefully not using versioning namespace { @@ -105,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 { @@ -130,7 +132,7 @@ public: ~exception_ptr() _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - // explicit + _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return __ptr_ != nullptr;} friend _LIBCPP_INLINE_VISIBILITY @@ -141,12 +143,12 @@ public: {return !(__x == __y);} friend exception_ptr current_exception() _NOEXCEPT; - _ATTRIBUTE(noreturn) friend void rethrow_exception(exception_ptr); + friend void rethrow_exception(exception_ptr); }; -template +template exception_ptr -make_exception_ptr(_E __e) _NOEXCEPT +make_exception_ptr(_Ep __e) _NOEXCEPT { #ifndef _LIBCPP_NO_EXCEPTIONS try @@ -172,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_;} }; @@ -185,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< @@ -204,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< @@ -222,11 +224,11 @@ throw_with_nested (_Tp& __t, typename enable_if< #endif } -template +template inline _LIBCPP_INLINE_VISIBILITY void -rethrow_if_nested(const _E& __e, typename enable_if< - is_polymorphic<_E>::value +rethrow_if_nested(const _Ep& __e, typename enable_if< + is_polymorphic<_Ep>::value >::type* = 0) { const nested_exception* __nep = dynamic_cast(&__e); @@ -234,11 +236,11 @@ rethrow_if_nested(const _E& __e, typename enable_if< __nep->rethrow_nested(); } -template +template inline _LIBCPP_INLINE_VISIBILITY void -rethrow_if_nested(const _E& __e, typename enable_if< - !is_polymorphic<_E>::value +rethrow_if_nested(const _Ep&, typename enable_if< + !is_polymorphic<_Ep>::value >::type* = 0) { } diff --git a/system/include/libcxx/ext/__hash b/system/include/libcxx/ext/__hash index 8e9635d07f573..21500e894dcd9 100644 --- a/system/include/libcxx/ext/__hash +++ b/system/include/libcxx/ext/__hash @@ -43,4 +43,4 @@ template <> struct _LIBCPP_VISIBLE hash }; } -#endif _LIBCPP_EXT_HASH +#endif // _LIBCPP_EXT_HASH diff --git a/system/include/libcxx/ext/hash_map b/system/include/libcxx/ext/hash_map index 9e62e7a777d63..bebdccb3c41c5 100644 --- a/system/include/libcxx/ext/hash_map +++ b/system/include/libcxx/ext/hash_map @@ -215,7 +215,11 @@ namespace __gnu_cxx { using namespace std; -template ::value> +template ::value +#if __has_feature(is_final) + && !__is_final(_Hash) +#endif + > class __hash_map_hasher : private _Hash { @@ -247,7 +251,11 @@ public: {return __hash_(__x);} }; -template ::value> +template ::value +#if __has_feature(is_final) + && !__is_final(_Pred) +#endif + > class __hash_map_equal : private _Pred { @@ -499,8 +507,8 @@ private: typedef typename __table::__node_traits __node_traits; typedef typename __table::__node_allocator __node_allocator; typedef typename __table::__node __node; - typedef __hash_map_node_destructor<__node_allocator> _D; - typedef unique_ptr<__node, _D> __node_holder; + typedef __hash_map_node_destructor<__node_allocator> _Dp; + typedef unique_ptr<__node, _Dp> __node_holder; typedef allocator_traits __alloc_traits; public: typedef typename __alloc_traits::pointer pointer; @@ -671,7 +679,7 @@ typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k) { __node_allocator& __na = __table_.__node_alloc(); - __node_holder __h(__node_traits::allocate(__na, 1), _D(__na)); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k); __h.get_deleter().__first_constructed = true; __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second)); @@ -776,8 +784,8 @@ private: typedef typename __table::__node_traits __node_traits; typedef typename __table::__node_allocator __node_allocator; typedef typename __table::__node __node; - typedef __hash_map_node_destructor<__node_allocator> _D; - typedef unique_ptr<__node, _D> __node_holder; + typedef __hash_map_node_destructor<__node_allocator> _Dp; + typedef unique_ptr<__node, _Dp> __node_holder; typedef allocator_traits __alloc_traits; public: typedef typename __alloc_traits::pointer pointer; diff --git a/system/include/libcxx/forward_list b/system/include/libcxx/forward_list index 0dd6bb241b069..404c6eb1cb0f7 100644 --- a/system/include/libcxx/forward_list +++ b/system/include/libcxx/forward_list @@ -174,7 +174,11 @@ template #include #include +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -208,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 @@ -221,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; @@ -768,8 +772,8 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n) if (__n > 0) { __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __h(nullptr, _D(__a, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); for (__node_pointer __p = base::__before_begin(); __n > 0; --__n, __p = __p->__next_) { @@ -844,8 +848,8 @@ forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x, { if (base::__alloc() != __x.__alloc()) { - typedef move_iterator _I; - insert_after(cbefore_begin(), _I(__x.begin()), _I(__x.end())); + typedef move_iterator _Ip; + insert_after(cbefore_begin(), _Ip(__x.begin()), _Ip(__x.end())); } } @@ -902,8 +906,8 @@ forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type) __move_assign(__x, true_type()); else { - typedef move_iterator _I; - assign(_I(__x.begin()), _I(__x.end())); + typedef move_iterator _Ip; + assign(_Ip(__x.begin()), _Ip(__x.end())); } } @@ -991,8 +995,8 @@ void forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args) { __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...); __h->__next_ = base::__before_begin()->__next_; @@ -1006,8 +1010,8 @@ void forward_list<_Tp, _Alloc>::push_front(value_type&& __v) { __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v)); __h->__next_ = base::__before_begin()->__next_; base::__before_begin()->__next_ = __h.release(); @@ -1020,8 +1024,8 @@ void forward_list<_Tp, _Alloc>::push_front(const value_type& __v) { __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v); __h->__next_ = base::__before_begin()->__next_; base::__before_begin()->__next_ = __h.release(); @@ -1048,8 +1052,8 @@ forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args) { __node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_); __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...); __h->__next_ = __r->__next_; @@ -1065,8 +1069,8 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v) { __node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_); __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v)); __h->__next_ = __r->__next_; __r->__next_ = __h.release(); @@ -1081,8 +1085,8 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __ { __node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_); __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v); __h->__next_ = __r->__next_; __r->__next_ = __h.release(); @@ -1098,8 +1102,8 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n, if (__n > 0) { __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v); __node_pointer __first = __h.release(); __node_pointer __last = __first; @@ -1148,8 +1152,8 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, if (__f != __l) { __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f); __node_pointer __first = __h.release(); __node_pointer __last = __first; @@ -1240,8 +1244,8 @@ forward_list<_Tp, _Alloc>::resize(size_type __n) if (__n > 0) { __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __h(nullptr, _D(__a, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n, __ptr = __ptr->__next_) { @@ -1272,8 +1276,8 @@ forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v) if (__n > 0) { __node_allocator& __a = base::__alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __h(nullptr, _D(__a, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n, __ptr = __ptr->__next_) { @@ -1565,12 +1569,12 @@ template bool operator==(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) { - typedef forward_list<_Tp, _Alloc> _C; - typedef typename _C::const_iterator _I; - _I __ix = __x.begin(); - _I __ex = __x.end(); - _I __iy = __y.begin(); - _I __ey = __y.end(); + typedef forward_list<_Tp, _Alloc> _Cp; + typedef typename _Cp::const_iterator _Ip; + _Ip __ix = __x.begin(); + _Ip __ex = __x.end(); + _Ip __iy = __y.begin(); + _Ip __ey = __y.end(); for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy) if (!(*__ix == *__iy)) return false; diff --git a/system/include/libcxx/fstream b/system/include/libcxx/fstream index 7034aab110aa0..1b8e7a0a5d477 100644 --- a/system/include/libcxx/fstream +++ b/system/include/libcxx/fstream @@ -171,7 +171,11 @@ typedef basic_fstream wfstream; #include <__locale> #include +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -230,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_; @@ -249,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); } @@ -284,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_; @@ -316,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; @@ -331,6 +344,7 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs) { close(); swap(__rhs); + return *this; } #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -393,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_); @@ -545,7 +560,7 @@ basic_filebuf<_CharT, _Traits>::close() { __rt = this; unique_ptr __h(__file_, fclose); - if ((__cm_ & ios_base::out) && sync()) + if (sync()) __rt = 0; if (fclose(__h.release()) == 0) __file_ = 0; @@ -587,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_); @@ -672,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); @@ -761,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)); @@ -795,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; } @@ -804,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()) @@ -826,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 @@ -838,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/system/include/libcxx/functional b/system/include/libcxx/functional index 6db7ac48e927c..258278226f79b 100644 --- a/system/include/libcxx/functional +++ b/system/include/libcxx/functional @@ -198,7 +198,7 @@ namespace placeholders { . . . - extern unspecified _M; + extern unspecified _Mp; } template @@ -467,7 +467,9 @@ POLICY: For non-variadic implementations, the number of arguments is limited #include <__functional_base> +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -534,12 +536,7 @@ struct _LIBCPP_VISIBLE greater : binary_function<_Tp, _Tp, bool> {return __x > __y;} }; -template -struct _LIBCPP_VISIBLE less : binary_function<_Tp, _Tp, bool> -{ - _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const - {return __x < __y;} -}; +// less in <__functional_base> template struct _LIBCPP_VISIBLE greater_equal : binary_function<_Tp, _Tp, bool> @@ -888,44 +885,44 @@ public: } }; -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R _T::*> -mem_fn(_R _T::* __pm) +__mem_fn<_Rp _Tp::*> +mem_fn(_Rp _Tp::* __pm) { - return __mem_fn<_R _T::*>(__pm); + return __mem_fn<_Rp _Tp::*>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)(_Args...)> -mem_fn(_R (_T::* __pm)(_Args...)) +__mem_fn<_Rp (_Tp::*)(_Args...)> +mem_fn(_Rp (_Tp::* __pm)(_Args...)) { - return __mem_fn<_R (_T::*)(_Args...)>(__pm); + return __mem_fn<_Rp (_Tp::*)(_Args...)>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)(_Args...) const> -mem_fn(_R (_T::* __pm)(_Args...) const) +__mem_fn<_Rp (_Tp::*)(_Args...) const> +mem_fn(_Rp (_Tp::* __pm)(_Args...) const) { - return __mem_fn<_R (_T::*)(_Args...) const>(__pm); + return __mem_fn<_Rp (_Tp::*)(_Args...) const>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)(_Args...) volatile> -mem_fn(_R (_T::* __pm)(_Args...) volatile) +__mem_fn<_Rp (_Tp::*)(_Args...) volatile> +mem_fn(_Rp (_Tp::* __pm)(_Args...) volatile) { - return __mem_fn<_R (_T::*)(_Args...) volatile>(__pm); + return __mem_fn<_Rp (_Tp::*)(_Args...) volatile>(__pm); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_R (_T::*)(_Args...) const volatile> -mem_fn(_R (_T::* __pm)(_Args...) const volatile) +__mem_fn<_Rp (_Tp::*)(_Args...) const volatile> +mem_fn(_Rp (_Tp::* __pm)(_Args...) const volatile) { - return __mem_fn<_R (_T::*)(_Args...) const volatile>(__pm); + return __mem_fn<_Rp (_Tp::*)(_Args...) const volatile>(__pm); } // bad_function_call @@ -940,32 +937,32 @@ template class _LIBCPP_VISIBLE function; // undefined namespace __function { -template +template struct __maybe_derive_from_unary_function { }; -template -struct __maybe_derive_from_unary_function<_R(_A1)> - : public unary_function<_A1, _R> +template +struct __maybe_derive_from_unary_function<_Rp(_A1)> + : public unary_function<_A1, _Rp> { }; -template +template struct __maybe_derive_from_binary_function { }; -template -struct __maybe_derive_from_binary_function<_R(_A1, _A2)> - : public binary_function<_A1, _A2, _R> +template +struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)> + : public binary_function<_A1, _A2, _Rp> { }; template class __base; -template -class __base<_R(_ArgTypes...)> +template +class __base<_Rp(_ArgTypes...)> { __base(const __base&); __base& operator=(const __base&); @@ -976,7 +973,7 @@ public: virtual void __clone(__base*) const = 0; virtual void destroy() _NOEXCEPT = 0; virtual void destroy_deallocate() _NOEXCEPT = 0; - virtual _R operator()(_ArgTypes&& ...) = 0; + virtual _Rp operator()(_ArgTypes&& ...) = 0; #ifndef _LIBCPP_NO_RTTI virtual const void* target(const type_info&) const _NOEXCEPT = 0; virtual const std::type_info& target_type() const _NOEXCEPT = 0; @@ -985,139 +982,154 @@ public: template class __func; -template -class __func<_F, _Alloc, _R(_ArgTypes...)> - : public __base<_R(_ArgTypes...)> +template +class __func<_Fp, _Alloc, _Rp(_ArgTypes...)> + : public __base<_Rp(_ArgTypes...)> { - __compressed_pair<_F, _Alloc> __f_; + __compressed_pair<_Fp, _Alloc> __f_; public: _LIBCPP_INLINE_VISIBILITY - explicit __func(_F __f) : __f_(_VSTD::move(__f)) {} + explicit __func(_Fp&& __f) + : __f_(piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__f)), + _VSTD::forward_as_tuple()) {} _LIBCPP_INLINE_VISIBILITY - explicit __func(_F __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {} - virtual __base<_R(_ArgTypes...)>* __clone() const; - virtual void __clone(__base<_R(_ArgTypes...)>*) const; + explicit __func(const _Fp& __f, const _Alloc& __a) + : __f_(piecewise_construct, _VSTD::forward_as_tuple(__f), + _VSTD::forward_as_tuple(__a)) {} + + _LIBCPP_INLINE_VISIBILITY + explicit __func(const _Fp& __f, _Alloc&& __a) + : __f_(piecewise_construct, _VSTD::forward_as_tuple(__f), + _VSTD::forward_as_tuple(_VSTD::move(__a))) {} + + _LIBCPP_INLINE_VISIBILITY + explicit __func(_Fp&& __f, _Alloc&& __a) + : __f_(piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__f)), + _VSTD::forward_as_tuple(_VSTD::move(__a))) {} + virtual __base<_Rp(_ArgTypes...)>* __clone() const; + virtual void __clone(__base<_Rp(_ArgTypes...)>*) const; virtual void destroy() _NOEXCEPT; virtual void destroy_deallocate() _NOEXCEPT; - virtual _R operator()(_ArgTypes&& ... __arg); + virtual _Rp operator()(_ArgTypes&& ... __arg); #ifndef _LIBCPP_NO_RTTI virtual const void* target(const type_info&) const _NOEXCEPT; virtual const std::type_info& target_type() const _NOEXCEPT; #endif // _LIBCPP_NO_RTTI }; -template -__base<_R(_ArgTypes...)>* -__func<_F, _Alloc, _R(_ArgTypes...)>::__clone() const +template +__base<_Rp(_ArgTypes...)>* +__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone() const { - typedef typename _Alloc::template rebind<__func>::other _A; - _A __a(__f_.second()); - typedef __allocator_destructor<_A> _D; - unique_ptr<__func, _D> __hold(__a.allocate(1), _D(__a, 1)); + typedef typename _Alloc::template rebind<__func>::other _Ap; + _Ap __a(__f_.second()); + typedef __allocator_destructor<_Ap> _Dp; + unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); ::new (__hold.get()) __func(__f_.first(), _Alloc(__a)); return __hold.release(); } -template +template void -__func<_F, _Alloc, _R(_ArgTypes...)>::__clone(__base<_R(_ArgTypes...)>* __p) const +__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone(__base<_Rp(_ArgTypes...)>* __p) const { ::new (__p) __func(__f_.first(), __f_.second()); } -template +template void -__func<_F, _Alloc, _R(_ArgTypes...)>::destroy() _NOEXCEPT +__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy() _NOEXCEPT { - __f_.~__compressed_pair<_F, _Alloc>(); + __f_.~__compressed_pair<_Fp, _Alloc>(); } -template +template void -__func<_F, _Alloc, _R(_ArgTypes...)>::destroy_deallocate() _NOEXCEPT +__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() _NOEXCEPT { - typedef typename _Alloc::template rebind<__func>::other _A; - _A __a(__f_.second()); - __f_.~__compressed_pair<_F, _Alloc>(); + typedef typename _Alloc::template rebind<__func>::other _Ap; + _Ap __a(__f_.second()); + __f_.~__compressed_pair<_Fp, _Alloc>(); __a.deallocate(this, 1); } -template -_R -__func<_F, _Alloc, _R(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg) +template +_Rp +__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg) { return __invoke(__f_.first(), _VSTD::forward<_ArgTypes>(__arg)...); } #ifndef _LIBCPP_NO_RTTI -template +template const void* -__func<_F, _Alloc, _R(_ArgTypes...)>::target(const type_info& __ti) const _NOEXCEPT +__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target(const type_info& __ti) const _NOEXCEPT { - if (__ti == typeid(_F)) + if (__ti == typeid(_Fp)) return &__f_.first(); return (const void*)0; } -template +template const std::type_info& -__func<_F, _Alloc, _R(_ArgTypes...)>::target_type() const _NOEXCEPT +__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target_type() const _NOEXCEPT { - return typeid(_F); + return typeid(_Fp); } #endif // _LIBCPP_NO_RTTI } // __function -template -class _LIBCPP_VISIBLE function<_R(_ArgTypes...)> - : public __function::__maybe_derive_from_unary_function<_R(_ArgTypes...)>, - public __function::__maybe_derive_from_binary_function<_R(_ArgTypes...)> +template +class _LIBCPP_VISIBLE function<_Rp(_ArgTypes...)> + : public __function::__maybe_derive_from_unary_function<_Rp(_ArgTypes...)>, + public __function::__maybe_derive_from_binary_function<_Rp(_ArgTypes...)> { - typedef __function::__base<_R(_ArgTypes...)> __base; - aligned_storage<3*sizeof(void*)>::type __buf_; + typedef __function::__base<_Rp(_ArgTypes...)> __base; + typename aligned_storage<3*sizeof(void*)>::type __buf_; __base* __f_; - template + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const _F&) {return true;} - template + static bool __not_null(const _Fp&) {return true;} + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (*__p)(_A...)) {return __p;} - template + static bool __not_null(_R2 (*__p)(_Ap...)) {return __p;} + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_C::*__p)(_A...)) {return __p;} - template + static bool __not_null(_R2 (_Cp::*__p)(_Ap...)) {return __p;} + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_C::*__p)(_A...) const) {return __p;} - template + static bool __not_null(_R2 (_Cp::*__p)(_Ap...) const) {return __p;} + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_C::*__p)(_A...) volatile) {return __p;} - template + static bool __not_null(_R2 (_Cp::*__p)(_Ap...) volatile) {return __p;} + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_C::*__p)(_A...) const volatile) {return __p;} - template + static bool __not_null(_R2 (_Cp::*__p)(_Ap...) const volatile) {return __p;} + template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const function<_R(_A...)>& __p) {return __p;} + static bool __not_null(const function<_Rp(_Ap...)>& __p) {return __p;} - template ::value> + template ::value && + __invokable<_Fp&, _ArgTypes...>::value> struct __callable; - template - struct __callable<_F, true> + template + struct __callable<_Fp, true> { static const bool value = - is_convertible::type, - _R>::value; + is_convertible::type, + _Rp>::value; }; - template - struct __callable<_F, false> + template + struct __callable<_Fp, false> { static const bool value = false; }; public: - typedef _R result_type; + typedef _Rp result_type; // construct/copy/destroy: _LIBCPP_INLINE_VISIBILITY @@ -1126,9 +1138,9 @@ public: function(nullptr_t) _NOEXCEPT : __f_(0) {} function(const function&); function(function&&) _NOEXCEPT; - template - function(_F, - typename enable_if<__callable<_F>::value>::type* = 0); + template + function(_Fp, + typename enable_if<__callable<_Fp>::value>::type* = 0); template _LIBCPP_INLINE_VISIBILITY @@ -1140,33 +1152,33 @@ public: function(allocator_arg_t, const _Alloc&, const function&); template function(allocator_arg_t, const _Alloc&, function&&); - template - function(allocator_arg_t, const _Alloc& __a, _F __f, - typename enable_if<__callable<_F>::value>::type* = 0); + template + function(allocator_arg_t, const _Alloc& __a, _Fp __f, + typename enable_if<__callable<_Fp>::value>::type* = 0); function& operator=(const function&); function& operator=(function&&) _NOEXCEPT; function& operator=(nullptr_t) _NOEXCEPT; - template + template typename enable_if < - __callable::type>::value, + __callable::type>::value, function& >::type - operator=(_F&&); + operator=(_Fp&&); ~function(); // function modifiers: void swap(function&) _NOEXCEPT; - template + template _LIBCPP_INLINE_VISIBILITY - void assign(_F&& __f, const _Alloc& __a) - {function(allocator_arg, __a, _VSTD::forward<_F>(__f)).swap(*this);} + void assign(_Fp&& __f, const _Alloc& __a) + {function(allocator_arg, __a, _VSTD::forward<_Fp>(__f)).swap(*this);} // function capacity: _LIBCPP_INLINE_VISIBILITY - /*explicit*/ operator bool() const _NOEXCEPT {return __f_;} + _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return __f_;} // deleted overloads close possible hole in the type system template @@ -1175,18 +1187,18 @@ public: bool operator!=(const function<_R2(_ArgTypes2...)>&) const = delete; public: // function invocation: - _R operator()(_ArgTypes...) const; + _Rp operator()(_ArgTypes...) const; #ifndef _LIBCPP_NO_RTTI // function target access: const std::type_info& target_type() const _NOEXCEPT; - template _T* target() _NOEXCEPT; - template const _T* target() const _NOEXCEPT; + template _Tp* target() _NOEXCEPT; + template const _Tp* target() const _NOEXCEPT; #endif // _LIBCPP_NO_RTTI }; -template -function<_R(_ArgTypes...)>::function(const function& __f) +template +function<_Rp(_ArgTypes...)>::function(const function& __f) { if (__f.__f_ == 0) __f_ = 0; @@ -1199,9 +1211,9 @@ function<_R(_ArgTypes...)>::function(const function& __f) __f_ = __f.__f_->__clone(); } -template +template template -function<_R(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&, +function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&, const function& __f) { if (__f.__f_ == 0) @@ -1215,8 +1227,8 @@ function<_R(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&, __f_ = __f.__f_->__clone(); } -template -function<_R(_ArgTypes...)>::function(function&& __f) _NOEXCEPT +template +function<_Rp(_ArgTypes...)>::function(function&& __f) _NOEXCEPT { if (__f.__f_ == 0) __f_ = 0; @@ -1232,9 +1244,9 @@ function<_R(_ArgTypes...)>::function(function&& __f) _NOEXCEPT } } -template +template template -function<_R(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&, +function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&, function&& __f) { if (__f.__f_ == 0) @@ -1251,43 +1263,43 @@ function<_R(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&, } } -template -template -function<_R(_ArgTypes...)>::function(_F __f, - typename enable_if<__callable<_F>::value>::type*) +template +template +function<_Rp(_ArgTypes...)>::function(_Fp __f, + typename enable_if<__callable<_Fp>::value>::type*) : __f_(0) { if (__not_null(__f)) { - typedef __function::__func<_F, allocator<_F>, _R(_ArgTypes...)> _FF; - if (sizeof(_FF) <= sizeof(__buf_) && is_nothrow_copy_constructible<_F>::value) + typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_ArgTypes...)> _FF; + if (sizeof(_FF) <= sizeof(__buf_) && is_nothrow_copy_constructible<_Fp>::value) { __f_ = (__base*)&__buf_; ::new (__f_) _FF(_VSTD::move(__f)); } else { - typedef allocator<_FF> _A; - _A __a; - typedef __allocator_destructor<_A> _D; - unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1)); - ::new (__hold.get()) _FF(_VSTD::move(__f), allocator<_F>(__a)); + typedef allocator<_FF> _Ap; + _Ap __a; + typedef __allocator_destructor<_Ap> _Dp; + unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); + ::new (__hold.get()) _FF(_VSTD::move(__f), allocator<_Fp>(__a)); __f_ = __hold.release(); } } } -template -template -function<_R(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _F __f, - typename enable_if<__callable<_F>::value>::type*) +template +template +function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f, + typename enable_if<__callable<_Fp>::value>::type*) : __f_(0) { typedef allocator_traits<_Alloc> __alloc_traits; if (__not_null(__f)) { - typedef __function::__func<_F, _Alloc, _R(_ArgTypes...)> _FF; - if (sizeof(_FF) <= sizeof(__buf_) && is_nothrow_copy_constructible<_F>::value) + typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _FF; + if (sizeof(_FF) <= sizeof(__buf_) && is_nothrow_copy_constructible<_Fp>::value) { __f_ = (__base*)&__buf_; ::new (__f_) _FF(_VSTD::move(__f)); @@ -1300,27 +1312,27 @@ function<_R(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _F __f #else rebind_alloc<_FF>::other #endif - _A; - _A __a(__a0); - typedef __allocator_destructor<_A> _D; - unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1)); + _Ap; + _Ap __a(__a0); + typedef __allocator_destructor<_Ap> _Dp; + unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); ::new (__hold.get()) _FF(_VSTD::move(__f), _Alloc(__a)); __f_ = __hold.release(); } } } -template -function<_R(_ArgTypes...)>& -function<_R(_ArgTypes...)>::operator=(const function& __f) +template +function<_Rp(_ArgTypes...)>& +function<_Rp(_ArgTypes...)>::operator=(const function& __f) { function(__f).swap(*this); return *this; } -template -function<_R(_ArgTypes...)>& -function<_R(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT +template +function<_Rp(_ArgTypes...)>& +function<_Rp(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT { if (__f_ == (__base*)&__buf_) __f_->destroy(); @@ -1339,34 +1351,36 @@ function<_R(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT __f_ = __f.__f_; __f.__f_ = 0; } + return *this; } -template -function<_R(_ArgTypes...)>& -function<_R(_ArgTypes...)>::operator=(nullptr_t) _NOEXCEPT +template +function<_Rp(_ArgTypes...)>& +function<_Rp(_ArgTypes...)>::operator=(nullptr_t) _NOEXCEPT { if (__f_ == (__base*)&__buf_) __f_->destroy(); else if (__f_) __f_->destroy_deallocate(); __f_ = 0; + return *this; } -template -template +template +template typename enable_if < - function<_R(_ArgTypes...)>::template __callable::type>::value, - function<_R(_ArgTypes...)>& + function<_Rp(_ArgTypes...)>::template __callable::type>::value, + function<_Rp(_ArgTypes...)>& >::type -function<_R(_ArgTypes...)>::operator=(_F&& __f) +function<_Rp(_ArgTypes...)>::operator=(_Fp&& __f) { - function(_VSTD::forward<_F>(__f)).swap(*this); + function(_VSTD::forward<_Fp>(__f)).swap(*this); return *this; } -template -function<_R(_ArgTypes...)>::~function() +template +function<_Rp(_ArgTypes...)>::~function() { if (__f_ == (__base*)&__buf_) __f_->destroy(); @@ -1374,9 +1388,9 @@ function<_R(_ArgTypes...)>::~function() __f_->destroy_deallocate(); } -template +template void -function<_R(_ArgTypes...)>::swap(function& __f) _NOEXCEPT +function<_Rp(_ArgTypes...)>::swap(function& __f) _NOEXCEPT { if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_) { @@ -1411,9 +1425,9 @@ function<_R(_ArgTypes...)>::swap(function& __f) _NOEXCEPT _VSTD::swap(__f_, __f.__f_); } -template -_R -function<_R(_ArgTypes...)>::operator()(_ArgTypes... __arg) const +template +_Rp +function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const { #ifndef _LIBCPP_NO_EXCEPTIONS if (__f_ == 0) @@ -1424,61 +1438,61 @@ function<_R(_ArgTypes...)>::operator()(_ArgTypes... __arg) const #ifndef _LIBCPP_NO_RTTI -template +template const std::type_info& -function<_R(_ArgTypes...)>::target_type() const _NOEXCEPT +function<_Rp(_ArgTypes...)>::target_type() const _NOEXCEPT { if (__f_ == 0) return typeid(void); return __f_->target_type(); } -template -template -_T* -function<_R(_ArgTypes...)>::target() _NOEXCEPT +template +template +_Tp* +function<_Rp(_ArgTypes...)>::target() _NOEXCEPT { if (__f_ == 0) - return (_T*)0; - return (_T*)__f_->target(typeid(_T)); + return (_Tp*)0; + return (_Tp*)__f_->target(typeid(_Tp)); } -template -template -const _T* -function<_R(_ArgTypes...)>::target() const _NOEXCEPT +template +template +const _Tp* +function<_Rp(_ArgTypes...)>::target() const _NOEXCEPT { if (__f_ == 0) - return (const _T*)0; - return (const _T*)__f_->target(typeid(_T)); + return (const _Tp*)0; + return (const _Tp*)__f_->target(typeid(_Tp)); } #endif // _LIBCPP_NO_RTTI -template +template inline _LIBCPP_INLINE_VISIBILITY bool -operator==(const function<_R(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return !__f;} +operator==(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return !__f;} -template +template inline _LIBCPP_INLINE_VISIBILITY bool -operator==(nullptr_t, const function<_R(_ArgTypes...)>& __f) _NOEXCEPT {return !__f;} +operator==(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {return !__f;} -template +template inline _LIBCPP_INLINE_VISIBILITY bool -operator!=(const function<_R(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return (bool)__f;} +operator!=(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return (bool)__f;} -template +template inline _LIBCPP_INLINE_VISIBILITY bool -operator!=(nullptr_t, const function<_R(_ArgTypes...)>& __f) _NOEXCEPT {return (bool)__f;} +operator!=(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {return (bool)__f;} -template +template inline _LIBCPP_INLINE_VISIBILITY void -swap(function<_R(_ArgTypes...)>& __x, function<_R(_ArgTypes...)>& __y) _NOEXCEPT +swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT {return __x.swap(__y);} template struct __is_bind_expression : public false_type {}; @@ -1492,7 +1506,7 @@ template struct _LIBCPP_VISIBLE is_placeholder namespace placeholders { -template struct __ph {}; +template struct __ph {}; extern __ph<1> _1; extern __ph<2> _2; @@ -1507,9 +1521,9 @@ extern __ph<10> _10; } // placeholders -template -struct __is_placeholder > - : public integral_constant {}; +template +struct __is_placeholder > + : public integral_constant {}; template inline _LIBCPP_INLINE_VISIBILITY @@ -1571,7 +1585,7 @@ typename enable_if !__is_reference_wrapper<_Ti>::value, _Ti& >::type -__mu(_Ti& __ti, _Uj& __uj) +__mu(_Ti& __ti, _Uj&) { return __ti; } @@ -1610,20 +1624,42 @@ struct __mu_return : public ____mu_return<_Ti, __is_reference_wrapper<_Ti>::value, is_bind_expression<_Ti>::value, - 0 < is_placeholder<_Ti>::value, + 0 < is_placeholder<_Ti>::value && + is_placeholder<_Ti>::value <= tuple_size<_TupleUj>::value, _TupleUj> { }; -template +template +struct _is_valid_bind_return +{ + static const bool value = false; +}; + +template +struct _is_valid_bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj> +{ + static const bool value = __invokable<_Fp, + typename __mu_return<_BoundArgs, _TupleUj>::type...>::value; +}; + +template +struct _is_valid_bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj> +{ + static const bool value = __invokable<_Fp, + typename __mu_return::type...>::value; +}; + +template ::value> struct __bind_return; -template -struct __bind_return<_F, tuple<_BoundArgs...>, _TupleUj> +template +struct __bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj, true> { typedef typename __invoke_of < - _F&, + _Fp&, typename __mu_return < _BoundArgs, @@ -1632,12 +1668,12 @@ struct __bind_return<_F, tuple<_BoundArgs...>, _TupleUj> >::type type; }; -template -struct __bind_return<_F, const tuple<_BoundArgs...>, _TupleUj> +template +struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj, true> { typedef typename __invoke_of < - _F&, + _Fp&, typename __mu_return < const _BoundArgs, @@ -1646,21 +1682,23 @@ struct __bind_return<_F, const tuple<_BoundArgs...>, _TupleUj> >::type type; }; -template +template inline _LIBCPP_INLINE_VISIBILITY -typename __bind_return<_F, _BoundArgs, _Args>::type -__apply_functor(_F& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, +typename __bind_return<_Fp, _BoundArgs, _Args>::type +__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, _Args&& __args) { return __invoke(__f, __mu(get<_Indx>(__bound_args), __args)...); } -template +template class __bind - : public __weak_result_type::type> + : public __weak_result_type::type> { - typedef typename decay<_F>::type _Fd; +protected: + typedef typename decay<_Fp>::type _Fd; typedef tuple::type...> _Td; +private: _Fd __f_; _Td __bound_args_; @@ -1696,10 +1734,14 @@ public: #endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS - template + template ::value + >::type> _LIBCPP_INLINE_VISIBILITY - explicit __bind(_G&& __f, _BA&& ...__bound_args) - : __f_(_VSTD::forward<_G>(__f)), + explicit __bind(_Gp&& __f, _BA&& ...__bound_args) + : __f_(_VSTD::forward<_Gp>(__f)), __bound_args_(_VSTD::forward<_BA>(__bound_args)...) {} template @@ -1713,7 +1755,7 @@ public: template _LIBCPP_INLINE_VISIBILITY - typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type + typename __bind_return >::type operator()(_Args&& ...__args) const { return __apply_functor(__f_, __bound_args_, __indices(), @@ -1721,16 +1763,18 @@ public: } }; -template -struct __is_bind_expression<__bind<_F, _BoundArgs...> > : public true_type {}; +template +struct __is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {}; -template +template class __bind_r - : public __bind<_F, _BoundArgs...> + : public __bind<_Fp, _BoundArgs...> { - typedef __bind<_F, _BoundArgs...> base; + typedef __bind<_Fp, _BoundArgs...> base; + typedef typename base::_Fd _Fd; + typedef typename base::_Td _Td; public: - typedef _R result_type; + typedef _Rp result_type; #ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS @@ -1758,15 +1802,20 @@ public: #endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS - template + template _LIBCPP_INLINE_VISIBILITY - explicit __bind_r(_G&& __f, _BA&& ...__bound_args) - : base(_VSTD::forward<_G>(__f), + explicit __bind_r(_Gp&& __f, _BA&& ...__bound_args) + : base(_VSTD::forward<_Gp>(__f), _VSTD::forward<_BA>(__bound_args)...) {} template _LIBCPP_INLINE_VISIBILITY - result_type + typename enable_if + < + is_convertible >::type, + result_type>::value, + result_type + >::type operator()(_Args&& ...__args) { return base::operator()(_VSTD::forward<_Args>(__args)...); @@ -1774,32 +1823,37 @@ public: template _LIBCPP_INLINE_VISIBILITY - result_type + typename enable_if + < + is_convertible >::type, + result_type>::value, + result_type + >::type operator()(_Args&& ...__args) const { return base::operator()(_VSTD::forward<_Args>(__args)...); } }; -template -struct __is_bind_expression<__bind_r<_R, _F, _BoundArgs...> > : public true_type {}; +template +struct __is_bind_expression<__bind_r<_Rp, _Fp, _BoundArgs...> > : public true_type {}; -template +template inline _LIBCPP_INLINE_VISIBILITY -__bind<_F, _BoundArgs...> -bind(_F&& __f, _BoundArgs&&... __bound_args) +__bind<_Fp, _BoundArgs...> +bind(_Fp&& __f, _BoundArgs&&... __bound_args) { - typedef __bind<_F, _BoundArgs...> type; - return type(_VSTD::forward<_F>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...); + typedef __bind<_Fp, _BoundArgs...> type; + return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...); } -template +template inline _LIBCPP_INLINE_VISIBILITY -__bind_r<_R, _F, _BoundArgs...> -bind(_F&& __f, _BoundArgs&&... __bound_args) +__bind_r<_Rp, _Fp, _BoundArgs...> +bind(_Fp&& __f, _BoundArgs&&... __bound_args) { - typedef __bind_r<_R, _F, _BoundArgs...> type; - return type(_VSTD::forward<_F>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...); + typedef __bind_r<_Rp, _Fp, _BoundArgs...> type; + return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...); } #endif // _LIBCPP_HAS_NO_VARIADICS @@ -1914,79 +1968,91 @@ struct _LIBCPP_VISIBLE hash template <> struct _LIBCPP_VISIBLE hash - : public unary_function + : public __scalar_hash { - _LIBCPP_INLINE_VISIBILITY - size_t operator()(long long __v) const _NOEXCEPT - { - size_t __r = 0; - const size_t* const __p = reinterpret_cast(&__v); - for (unsigned __i = 0; __i < sizeof(argument_type)/sizeof(size_t); ++__i) - __r ^= __p[__i]; - return __r; - } }; template <> struct _LIBCPP_VISIBLE hash - : public unary_function + : public __scalar_hash { - _LIBCPP_INLINE_VISIBILITY - size_t operator()(unsigned long long __v) const _NOEXCEPT - { - size_t __r = 0; - const size_t* const __p = reinterpret_cast(&__v); - for (unsigned __i = 0; __i < sizeof(argument_type)/sizeof(size_t); ++__i) - __r ^= __p[__i]; - return __r; - } }; template <> struct _LIBCPP_VISIBLE hash - : public unary_function + : public __scalar_hash { _LIBCPP_INLINE_VISIBILITY size_t operator()(float __v) const _NOEXCEPT { - if (__v == 0) - return 0; - const size_t* const __p = reinterpret_cast(&__v); - return *__p; + // -0.0 and 0.0 should return same hash + if (__v == 0) + return 0; + return __scalar_hash::operator()(__v); } }; template <> struct _LIBCPP_VISIBLE hash - : public unary_function + : public __scalar_hash { _LIBCPP_INLINE_VISIBILITY size_t operator()(double __v) const _NOEXCEPT { - if (__v == 0) - return 0; - size_t __r = 0; - const size_t* const __p = reinterpret_cast(&__v); - for (unsigned __i = 0; __i < sizeof(argument_type)/sizeof(size_t); ++__i) - __r ^= __p[__i]; - return __r; + // -0.0 and 0.0 should return same hash + if (__v == 0) + return 0; + return __scalar_hash::operator()(__v); } }; template <> struct _LIBCPP_VISIBLE hash - : public unary_function + : public __scalar_hash { _LIBCPP_INLINE_VISIBILITY size_t operator()(long double __v) const _NOEXCEPT { + // -0.0 and 0.0 should return same hash if (__v == 0) return 0; - size_t __r = 0; - const size_t* const __p = reinterpret_cast(&__v); - for (unsigned __i = 0; __i < sizeof(argument_type)/sizeof(size_t); ++__i) - __r ^= __p[__i]; - return __r; +#if defined(__i386__) + // Zero out padding bits + union + { + long double __t; + struct + { + size_t __a; + size_t __b; + size_t __c; + size_t __d; + }; + } __u; + __u.__a = 0; + __u.__b = 0; + __u.__c = 0; + __u.__d = 0; + __u.__t = __v; + return __u.__a ^ __u.__b ^ __u.__c ^ __u.__d; +#elif defined(__x86_64__) + // Zero out padding bits + union + { + long double __t; + struct + { + size_t __a; + size_t __b; + }; + } __u; + __u.__a = 0; + __u.__b = 0; + __u.__t = __v; + return __u.__a ^ __u.__b; +#else + return __scalar_hash::operator()(__v); +#endif } }; diff --git a/system/include/libcxx/future b/system/include/libcxx/future index 62529d97c75c4..fa605e7d07f06 100644 --- a/system/include/libcxx/future +++ b/system/include/libcxx/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>; @@ -370,75 +370,61 @@ template struct uses_allocator, Alloc>; #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD //enum class future_errc -struct _LIBCPP_VISIBLE future_errc +_LIBCPP_DECLARE_STRONG_ENUM(future_errc) { -enum _ { broken_promise, future_already_retrieved, promise_already_satisfied, no_state }; - - _ __v_; - - _LIBCPP_INLINE_VISIBILITY future_errc(_ __v) : __v_(__v) {} - _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;} - -}; +_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(future_errc) template <> struct _LIBCPP_VISIBLE is_error_code_enum : public true_type {}; +#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS +template <> +struct _LIBCPP_VISIBLE is_error_code_enum : public true_type { }; +#endif + //enum class launch -struct _LIBCPP_VISIBLE launch +_LIBCPP_DECLARE_STRONG_ENUM(launch) { -enum _ { async = 1, deferred = 2, any = async | deferred }; - - _ __v_; - - _LIBCPP_INLINE_VISIBILITY launch(_ __v) : __v_(__v) {} - _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;} - -}; +_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch) //enum class future_status -struct _LIBCPP_VISIBLE future_status +_LIBCPP_DECLARE_STRONG_ENUM(future_status) { -enum _ { ready, timeout, deferred }; - - _ __v_; - - _LIBCPP_INLINE_VISIBILITY future_status(_ __v) : __v_(__v) {} - _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;} - -}; +_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()); } @@ -451,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; }; @@ -484,7 +470,11 @@ public: {return (__state_ & __constructed) || (__exception_ != nullptr);} _LIBCPP_INLINE_VISIBILITY - void __set_future_attached() {__state_ |= __future_attached;} + void __set_future_attached() + { + lock_guard __lk(__mut_); + __state_ |= __future_attached; + } _LIBCPP_INLINE_VISIBILITY bool __has_future_attached() const {return __state_ & __future_attached;} @@ -536,14 +526,14 @@ __assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) c return wait_until(chrono::steady_clock::now() + __rel_time); } -template +template class __assoc_state : public __assoc_sub_state { typedef __assoc_sub_state base; - typedef typename aligned_storage::value>::type _U; + typedef typename aligned_storage::value>::type _Up; protected: - _U __value_; + _Up __value_; virtual void __on_zero_shared() _NOEXCEPT; public: @@ -562,26 +552,26 @@ public: void set_value_at_thread_exit(_Arg& __arg); #endif - _R move(); - typename add_lvalue_reference<_R>::type copy(); + _Rp move(); + typename add_lvalue_reference<_Rp>::type copy(); }; -template +template void -__assoc_state<_R>::__on_zero_shared() _NOEXCEPT +__assoc_state<_Rp>::__on_zero_shared() _NOEXCEPT { if (this->__state_ & base::__constructed) - reinterpret_cast<_R*>(&__value_)->~_R(); + reinterpret_cast<_Rp*>(&__value_)->~_Rp(); delete this; } -template +template template void #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -__assoc_state<_R>::set_value(_Arg&& __arg) +__assoc_state<_Rp>::set_value(_Arg&& __arg) #else -__assoc_state<_R>::set_value(_Arg& __arg) +__assoc_state<_Rp>::set_value(_Arg& __arg) #endif { unique_lock __lk(this->__mut_); @@ -589,19 +579,19 @@ __assoc_state<_R>::set_value(_Arg& __arg) if (this->__has_value()) throw future_error(make_error_code(future_errc::promise_already_satisfied)); #endif - ::new(&__value_) _R(_VSTD::forward<_Arg>(__arg)); + ::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg)); this->__state_ |= base::__constructed | base::ready; __lk.unlock(); __cv_.notify_all(); } -template +template template void #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -__assoc_state<_R>::set_value_at_thread_exit(_Arg&& __arg) +__assoc_state<_Rp>::set_value_at_thread_exit(_Arg&& __arg) #else -__assoc_state<_R>::set_value_at_thread_exit(_Arg& __arg) +__assoc_state<_Rp>::set_value_at_thread_exit(_Arg& __arg) #endif { unique_lock __lk(this->__mut_); @@ -609,62 +599,62 @@ __assoc_state<_R>::set_value_at_thread_exit(_Arg& __arg) if (this->__has_value()) throw future_error(make_error_code(future_errc::promise_already_satisfied)); #endif - ::new(&__value_) _R(_VSTD::forward<_Arg>(__arg)); + ::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg)); this->__state_ |= base::__constructed; __thread_local_data()->__make_ready_at_thread_exit(this); __lk.unlock(); } -template -_R -__assoc_state<_R>::move() +template +_Rp +__assoc_state<_Rp>::move() { unique_lock __lk(this->__mut_); this->__sub_wait(__lk); if (this->__exception_ != nullptr) rethrow_exception(this->__exception_); - return _VSTD::move(*reinterpret_cast<_R*>(&__value_)); + return _VSTD::move(*reinterpret_cast<_Rp*>(&__value_)); } -template -typename add_lvalue_reference<_R>::type -__assoc_state<_R>::copy() +template +typename add_lvalue_reference<_Rp>::type +__assoc_state<_Rp>::copy() { unique_lock __lk(this->__mut_); this->__sub_wait(__lk); if (this->__exception_ != nullptr) rethrow_exception(this->__exception_); - return *reinterpret_cast<_R*>(&__value_); + return *reinterpret_cast<_Rp*>(&__value_); } -template -class __assoc_state<_R&> +template +class __assoc_state<_Rp&> : public __assoc_sub_state { typedef __assoc_sub_state base; - typedef _R* _U; + typedef _Rp* _Up; protected: - _U __value_; + _Up __value_; virtual void __on_zero_shared() _NOEXCEPT; public: - void set_value(_R& __arg); - void set_value_at_thread_exit(_R& __arg); + void set_value(_Rp& __arg); + void set_value_at_thread_exit(_Rp& __arg); - _R& copy(); + _Rp& copy(); }; -template +template void -__assoc_state<_R&>::__on_zero_shared() _NOEXCEPT +__assoc_state<_Rp&>::__on_zero_shared() _NOEXCEPT { delete this; } -template +template void -__assoc_state<_R&>::set_value(_R& __arg) +__assoc_state<_Rp&>::set_value(_Rp& __arg) { unique_lock __lk(this->__mut_); #ifndef _LIBCPP_NO_EXCEPTIONS @@ -677,9 +667,9 @@ __assoc_state<_R&>::set_value(_R& __arg) __cv_.notify_all(); } -template +template void -__assoc_state<_R&>::set_value_at_thread_exit(_R& __arg) +__assoc_state<_Rp&>::set_value_at_thread_exit(_Rp& __arg) { unique_lock __lk(this->__mut_); #ifndef _LIBCPP_NO_EXCEPTIONS @@ -692,9 +682,9 @@ __assoc_state<_R&>::set_value_at_thread_exit(_R& __arg) __lk.unlock(); } -template -_R& -__assoc_state<_R&>::copy() +template +_Rp& +__assoc_state<_Rp&>::copy() { unique_lock __lk(this->__mut_); this->__sub_wait(__lk); @@ -703,11 +693,11 @@ __assoc_state<_R&>::copy() return *__value_; } -template +template class __assoc_state_alloc - : public __assoc_state<_R> + : public __assoc_state<_Rp> { - typedef __assoc_state<_R> base; + typedef __assoc_state<_Rp> base; _Alloc __alloc_; virtual void __on_zero_shared() _NOEXCEPT; @@ -717,22 +707,22 @@ public: : __alloc_(__a) {} }; -template +template void -__assoc_state_alloc<_R, _Alloc>::__on_zero_shared() _NOEXCEPT +__assoc_state_alloc<_Rp, _Alloc>::__on_zero_shared() _NOEXCEPT { if (this->__state_ & base::__constructed) - reinterpret_cast<_R*>(&this->__value_)->~_R(); + reinterpret_cast<_Rp*>(&this->__value_)->~_Rp(); typename _Alloc::template rebind<__assoc_state_alloc>::other __a(__alloc_); this->~__assoc_state_alloc(); __a.deallocate(this, 1); } -template -class __assoc_state_alloc<_R&, _Alloc> - : public __assoc_state<_R&> +template +class __assoc_state_alloc<_Rp&, _Alloc> + : public __assoc_state<_Rp&> { - typedef __assoc_state<_R&> base; + typedef __assoc_state<_Rp&> base; _Alloc __alloc_; virtual void __on_zero_shared() _NOEXCEPT; @@ -742,9 +732,9 @@ public: : __alloc_(__a) {} }; -template +template void -__assoc_state_alloc<_R&, _Alloc>::__on_zero_shared() _NOEXCEPT +__assoc_state_alloc<_Rp&, _Alloc>::__on_zero_shared() _NOEXCEPT { typename _Alloc::template rebind<__assoc_state_alloc>::other __a(__alloc_); this->~__assoc_state_alloc(); @@ -769,23 +759,22 @@ 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); } -template +template class __deferred_assoc_state - : public __assoc_state<_R> + : public __assoc_state<_Rp> { - typedef __assoc_state<_R> base; + typedef __assoc_state<_Rp> base; - _F __func_; + _Fp __func_; public: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - explicit __deferred_assoc_state(_F&& __f); + explicit __deferred_assoc_state(_Fp&& __f); #endif virtual void __execute(); @@ -793,19 +782,19 @@ public: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -template +template inline _LIBCPP_INLINE_VISIBILITY -__deferred_assoc_state<_R, _F>::__deferred_assoc_state(_F&& __f) - : __func_(_VSTD::forward<_F>(__f)) +__deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f) + : __func_(_VSTD::forward<_Fp>(__f)) { this->__set_deferred(); } #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -template +template void -__deferred_assoc_state<_R, _F>::__execute() +__deferred_assoc_state<_Rp, _Fp>::__execute() { #ifndef _LIBCPP_NO_EXCEPTIONS try @@ -821,17 +810,17 @@ __deferred_assoc_state<_R, _F>::__execute() #endif // _LIBCPP_NO_EXCEPTIONS } -template -class __deferred_assoc_state +template +class __deferred_assoc_state : public __assoc_sub_state { typedef __assoc_sub_state base; - _F __func_; + _Fp __func_; public: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - explicit __deferred_assoc_state(_F&& __f); + explicit __deferred_assoc_state(_Fp&& __f); #endif virtual void __execute(); @@ -839,19 +828,19 @@ public: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -template +template inline _LIBCPP_INLINE_VISIBILITY -__deferred_assoc_state::__deferred_assoc_state(_F&& __f) - : __func_(_VSTD::forward<_F>(__f)) +__deferred_assoc_state::__deferred_assoc_state(_Fp&& __f) + : __func_(_VSTD::forward<_Fp>(__f)) { this->__set_deferred(); } #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -template +template void -__deferred_assoc_state::__execute() +__deferred_assoc_state::__execute() { #ifndef _LIBCPP_NO_EXCEPTIONS try @@ -868,18 +857,18 @@ __deferred_assoc_state::__execute() #endif // _LIBCPP_NO_EXCEPTIONS } -template +template class __async_assoc_state - : public __assoc_state<_R> + : public __assoc_state<_Rp> { - typedef __assoc_state<_R> base; + typedef __assoc_state<_Rp> base; - _F __func_; + _Fp __func_; virtual void __on_zero_shared() _NOEXCEPT; public: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - explicit __async_assoc_state(_F&& __f); + explicit __async_assoc_state(_Fp&& __f); #endif virtual void __execute(); @@ -887,18 +876,18 @@ public: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -template +template inline _LIBCPP_INLINE_VISIBILITY -__async_assoc_state<_R, _F>::__async_assoc_state(_F&& __f) - : __func_(_VSTD::forward<_F>(__f)) +__async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f) + : __func_(_VSTD::forward<_Fp>(__f)) { } #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -template +template void -__async_assoc_state<_R, _F>::__execute() +__async_assoc_state<_Rp, _Fp>::__execute() { #ifndef _LIBCPP_NO_EXCEPTIONS try @@ -914,26 +903,26 @@ __async_assoc_state<_R, _F>::__execute() #endif // _LIBCPP_NO_EXCEPTIONS } -template +template void -__async_assoc_state<_R, _F>::__on_zero_shared() _NOEXCEPT +__async_assoc_state<_Rp, _Fp>::__on_zero_shared() _NOEXCEPT { this->wait(); base::__on_zero_shared(); } -template -class __async_assoc_state +template +class __async_assoc_state : public __assoc_sub_state { typedef __assoc_sub_state base; - _F __func_; + _Fp __func_; virtual void __on_zero_shared() _NOEXCEPT; public: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - explicit __async_assoc_state(_F&& __f); + explicit __async_assoc_state(_Fp&& __f); #endif virtual void __execute(); @@ -941,18 +930,18 @@ public: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -template +template inline _LIBCPP_INLINE_VISIBILITY -__async_assoc_state::__async_assoc_state(_F&& __f) - : __func_(_VSTD::forward<_F>(__f)) +__async_assoc_state::__async_assoc_state(_Fp&& __f) + : __func_(_VSTD::forward<_Fp>(__f)) { } #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -template +template void -__async_assoc_state::__execute() +__async_assoc_state::__execute() { #ifndef _LIBCPP_NO_EXCEPTIONS try @@ -969,70 +958,70 @@ __async_assoc_state::__execute() #endif // _LIBCPP_NO_EXCEPTIONS } -template +template void -__async_assoc_state::__on_zero_shared() _NOEXCEPT +__async_assoc_state::__on_zero_shared() _NOEXCEPT { this->wait(); 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<_R> +template +future<_Rp> #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -__make_deferred_assoc_state(_F&& __f); +__make_deferred_assoc_state(_Fp&& __f); #else -__make_deferred_assoc_state(_F __f); +__make_deferred_assoc_state(_Fp __f); #endif -template -future<_R> +template +future<_Rp> #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -__make_async_assoc_state(_F&& __f); +__make_async_assoc_state(_Fp&& __f); #else -__make_async_assoc_state(_F __f); +__make_async_assoc_state(_Fp __f); #endif -template +template class _LIBCPP_VISIBLE future { - __assoc_state<_R>* __state_; + __assoc_state<_Rp>* __state_; - explicit future(__assoc_state<_R>* __state); + explicit future(__assoc_state<_Rp>* __state); template friend class promise; template friend class shared_future; #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template - friend future<_R1> __make_deferred_assoc_state(_F&& __f); - template - friend future<_R1> __make_async_assoc_state(_F&& __f); + template + friend future<_R1> __make_deferred_assoc_state(_Fp&& __f); + template + friend future<_R1> __make_async_assoc_state(_Fp&& __f); #else - template - friend future<_R1> __make_deferred_assoc_state(_F __f); - template - friend future<_R1> __make_async_assoc_state(_F __f); + template + friend future<_R1> __make_deferred_assoc_state(_Fp __f); + template + friend future<_R1> __make_async_assoc_state(_Fp __f); #endif 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; @@ -1044,17 +1033,17 @@ private: public: #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES ~future(); - shared_future<_R> share(); + shared_future<_Rp> share(); // retrieving the value - _R get(); + _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();} @@ -1070,8 +1059,8 @@ public: {return __state_->wait_until(__abs_time);} }; -template -future<_R>::future(__assoc_state<_R>* __state) +template +future<_Rp>::future(__assoc_state<_Rp>* __state) : __state_(__state) { #ifndef _LIBCPP_NO_EXCEPTIONS @@ -1087,56 +1076,56 @@ struct __release_shared_count void operator()(__shared_count* p) {p->__release_shared();} }; -template -future<_R>::~future() +template +future<_Rp>::~future() { if (__state_) __state_->__release_shared(); } -template -_R -future<_R>::get() +template +_Rp +future<_Rp>::get() { unique_ptr<__shared_count, __release_shared_count> __(__state_); - __assoc_state<_R>* __s = __state_; + __assoc_state<_Rp>* __s = __state_; __state_ = nullptr; return __s->move(); } -template -class _LIBCPP_VISIBLE future<_R&> +template +class _LIBCPP_VISIBLE future<_Rp&> { - __assoc_state<_R&>* __state_; + __assoc_state<_Rp&>* __state_; - explicit future(__assoc_state<_R&>* __state); + explicit future(__assoc_state<_Rp&>* __state); template friend class promise; template friend class shared_future; #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template - friend future<_R1> __make_deferred_assoc_state(_F&& __f); - template - friend future<_R1> __make_async_assoc_state(_F&& __f); + template + friend future<_R1> __make_deferred_assoc_state(_Fp&& __f); + template + friend future<_R1> __make_async_assoc_state(_Fp&& __f); #else - template - friend future<_R1> __make_deferred_assoc_state(_F __f); - template - friend future<_R1> __make_async_assoc_state(_F __f); + template + friend future<_R1> __make_deferred_assoc_state(_Fp __f); + template + friend future<_R1> __make_async_assoc_state(_Fp __f); #endif 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; @@ -1148,17 +1137,17 @@ private: public: #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES ~future(); - shared_future<_R&> share(); + shared_future<_Rp&> share(); // retrieving the value - _R& get(); + _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();} @@ -1174,8 +1163,8 @@ public: {return __state_->wait_until(__abs_time);} }; -template -future<_R&>::future(__assoc_state<_R&>* __state) +template +future<_Rp&>::future(__assoc_state<_Rp&>* __state) : __state_(__state) { #ifndef _LIBCPP_NO_EXCEPTIONS @@ -1186,19 +1175,19 @@ future<_R&>::future(__assoc_state<_R&>* __state) __state_->__set_future_attached(); } -template -future<_R&>::~future() +template +future<_Rp&>::~future() { if (__state_) __state_->__release_shared(); } -template -_R& -future<_R&>::get() +template +_Rp& +future<_Rp&>::get() { unique_ptr<__shared_count, __release_shared_count> __(__state_); - __assoc_state<_R&>* __s = __state_; + __assoc_state<_Rp&>* __s = __state_; __state_ = nullptr; return __s->copy(); } @@ -1214,28 +1203,28 @@ class _LIBCPP_VISIBLE future template friend class shared_future; #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template - friend future<_R1> __make_deferred_assoc_state(_F&& __f); - template - friend future<_R1> __make_async_assoc_state(_F&& __f); + template + friend future<_R1> __make_deferred_assoc_state(_Fp&& __f); + template + friend future<_R1> __make_async_assoc_state(_Fp&& __f); #else - template - friend future<_R1> __make_deferred_assoc_state(_F __f); - template - friend future<_R1> __make_async_assoc_state(_F __f); + template + friend future<_R1> __make_deferred_assoc_state(_Fp __f); + template + friend future<_R1> __make_async_assoc_state(_Fp __f); #endif 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; @@ -1253,11 +1242,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();} @@ -1273,10 +1262,10 @@ public: {return __state_->wait_until(__abs_time);} }; -template +template inline _LIBCPP_INLINE_VISIBILITY void -swap(future<_R>& __x, future<_R>& __y) +swap(future<_Rp>& __x, future<_Rp>& __y) _NOEXCEPT { __x.swap(__y); } @@ -1285,13 +1274,13 @@ swap(future<_R>& __x, future<_R>& __y) template class packaged_task; -template +template class _LIBCPP_VISIBLE promise { - __assoc_state<_R>* __state_; + __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: @@ -1300,7 +1289,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 @@ -1313,7 +1302,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; @@ -1325,46 +1314,46 @@ 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<_R> get_future(); + future<_Rp> get_future(); // setting the result - void set_value(const _R& __r); + void set_value(const _Rp& __r); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - void set_value(_R&& __r); + void set_value(_Rp&& __r); #endif void set_exception(exception_ptr __p); // setting the result with deferred notification - void set_value_at_thread_exit(const _R& __r); + void set_value_at_thread_exit(const _Rp& __r); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - void set_value_at_thread_exit(_R&& __r); + void set_value_at_thread_exit(_Rp&& __r); #endif void set_exception_at_thread_exit(exception_ptr __p); }; -template -promise<_R>::promise() - : __state_(new __assoc_state<_R>) +template +promise<_Rp>::promise() + : __state_(new __assoc_state<_Rp>) { } -template +template template -promise<_R>::promise(allocator_arg_t, const _Alloc& __a0) +promise<_Rp>::promise(allocator_arg_t, const _Alloc& __a0) { - typedef typename _Alloc::template rebind<__assoc_state_alloc<_R, _Alloc> >::other _A2; + typedef typename _Alloc::template rebind<__assoc_state_alloc<_Rp, _Alloc> >::other _A2; typedef __allocator_destructor<_A2> _D2; _A2 __a(__a0); - unique_ptr<__assoc_state_alloc<_R, _Alloc>, _D2> __hold(__a.allocate(1), _D2(__a, 1)); - ::new(__hold.get()) __assoc_state_alloc<_R, _Alloc>(__a0); + unique_ptr<__assoc_state_alloc<_Rp, _Alloc>, _D2> __hold(__a.allocate(1), _D2(__a, 1)); + ::new(__hold.get()) __assoc_state_alloc<_Rp, _Alloc>(__a0); __state_ = __hold.release(); } -template -promise<_R>::~promise() +template +promise<_Rp>::~promise() { if (__state_) { @@ -1376,20 +1365,20 @@ promise<_R>::~promise() } } -template -future<_R> -promise<_R>::get_future() +template +future<_Rp> +promise<_Rp>::get_future() { #ifndef _LIBCPP_NO_EXCEPTIONS if (__state_ == nullptr) throw future_error(make_error_code(future_errc::no_state)); #endif - return future<_R>(__state_); + return future<_Rp>(__state_); } -template +template void -promise<_R>::set_value(const _R& __r) +promise<_Rp>::set_value(const _Rp& __r) { #ifndef _LIBCPP_NO_EXCEPTIONS if (__state_ == nullptr) @@ -1400,9 +1389,9 @@ promise<_R>::set_value(const _R& __r) #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -template +template void -promise<_R>::set_value(_R&& __r) +promise<_Rp>::set_value(_Rp&& __r) { #ifndef _LIBCPP_NO_EXCEPTIONS if (__state_ == nullptr) @@ -1413,9 +1402,9 @@ promise<_R>::set_value(_R&& __r) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -template +template void -promise<_R>::set_exception(exception_ptr __p) +promise<_Rp>::set_exception(exception_ptr __p) { #ifndef _LIBCPP_NO_EXCEPTIONS if (__state_ == nullptr) @@ -1424,9 +1413,9 @@ promise<_R>::set_exception(exception_ptr __p) __state_->set_exception(__p); } -template +template void -promise<_R>::set_value_at_thread_exit(const _R& __r) +promise<_Rp>::set_value_at_thread_exit(const _Rp& __r) { #ifndef _LIBCPP_NO_EXCEPTIONS if (__state_ == nullptr) @@ -1437,9 +1426,9 @@ promise<_R>::set_value_at_thread_exit(const _R& __r) #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -template +template void -promise<_R>::set_value_at_thread_exit(_R&& __r) +promise<_Rp>::set_value_at_thread_exit(_Rp&& __r) { #ifndef _LIBCPP_NO_EXCEPTIONS if (__state_ == nullptr) @@ -1450,9 +1439,9 @@ promise<_R>::set_value_at_thread_exit(_R&& __r) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -template +template void -promise<_R>::set_exception_at_thread_exit(exception_ptr __p) +promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p) { #ifndef _LIBCPP_NO_EXCEPTIONS if (__state_ == nullptr) @@ -1463,13 +1452,13 @@ promise<_R>::set_exception_at_thread_exit(exception_ptr __p) // promise -template -class _LIBCPP_VISIBLE promise<_R&> +template +class _LIBCPP_VISIBLE promise<_Rp&> { - __assoc_state<_R&>* __state_; + __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; @@ -1479,7 +1468,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 @@ -1492,7 +1481,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; @@ -1504,40 +1493,40 @@ 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<_R&> get_future(); + future<_Rp&> get_future(); // setting the result - void set_value(_R& __r); + void set_value(_Rp& __r); void set_exception(exception_ptr __p); // setting the result with deferred notification - void set_value_at_thread_exit(_R&); + void set_value_at_thread_exit(_Rp&); void set_exception_at_thread_exit(exception_ptr __p); }; -template -promise<_R&>::promise() - : __state_(new __assoc_state<_R&>) +template +promise<_Rp&>::promise() + : __state_(new __assoc_state<_Rp&>) { } -template +template template -promise<_R&>::promise(allocator_arg_t, const _Alloc& __a0) +promise<_Rp&>::promise(allocator_arg_t, const _Alloc& __a0) { - typedef typename _Alloc::template rebind<__assoc_state_alloc<_R&, _Alloc> >::other _A2; + typedef typename _Alloc::template rebind<__assoc_state_alloc<_Rp&, _Alloc> >::other _A2; typedef __allocator_destructor<_A2> _D2; _A2 __a(__a0); - unique_ptr<__assoc_state_alloc<_R&, _Alloc>, _D2> __hold(__a.allocate(1), _D2(__a, 1)); - ::new(__hold.get()) __assoc_state_alloc<_R&, _Alloc>(__a0); + unique_ptr<__assoc_state_alloc<_Rp&, _Alloc>, _D2> __hold(__a.allocate(1), _D2(__a, 1)); + ::new(__hold.get()) __assoc_state_alloc<_Rp&, _Alloc>(__a0); __state_ = __hold.release(); } -template -promise<_R&>::~promise() +template +promise<_Rp&>::~promise() { if (__state_) { @@ -1549,20 +1538,20 @@ promise<_R&>::~promise() } } -template -future<_R&> -promise<_R&>::get_future() +template +future<_Rp&> +promise<_Rp&>::get_future() { #ifndef _LIBCPP_NO_EXCEPTIONS if (__state_ == nullptr) throw future_error(make_error_code(future_errc::no_state)); #endif - return future<_R&>(__state_); + return future<_Rp&>(__state_); } -template +template void -promise<_R&>::set_value(_R& __r) +promise<_Rp&>::set_value(_Rp& __r) { #ifndef _LIBCPP_NO_EXCEPTIONS if (__state_ == nullptr) @@ -1571,9 +1560,9 @@ promise<_R&>::set_value(_R& __r) __state_->set_value(__r); } -template +template void -promise<_R&>::set_exception(exception_ptr __p) +promise<_Rp&>::set_exception(exception_ptr __p) { #ifndef _LIBCPP_NO_EXCEPTIONS if (__state_ == nullptr) @@ -1582,9 +1571,9 @@ promise<_R&>::set_exception(exception_ptr __p) __state_->set_exception(__p); } -template +template void -promise<_R&>::set_value_at_thread_exit(_R& __r) +promise<_Rp&>::set_value_at_thread_exit(_Rp& __r) { #ifndef _LIBCPP_NO_EXCEPTIONS if (__state_ == nullptr) @@ -1593,9 +1582,9 @@ promise<_R&>::set_value_at_thread_exit(_R& __r) __state_->set_value_at_thread_exit(__r); } -template +template void -promise<_R&>::set_exception_at_thread_exit(exception_ptr __p) +promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p) { #ifndef _LIBCPP_NO_EXCEPTIONS if (__state_ == nullptr) @@ -1612,7 +1601,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; @@ -1622,7 +1611,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 @@ -1635,7 +1624,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; @@ -1647,7 +1636,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(); @@ -1672,16 +1661,16 @@ promise::promise(allocator_arg_t, const _Alloc& __a0) __state_ = __hold.release(); } -template +template inline _LIBCPP_INLINE_VISIBILITY void -swap(promise<_R>& __x, promise<_R>& __y) +swap(promise<_Rp>& __x, promise<_Rp>& __y) _NOEXCEPT { __x.swap(__y); } -template - struct _LIBCPP_VISIBLE uses_allocator, _Alloc> +template + struct _LIBCPP_VISIBLE uses_allocator, _Alloc> : public true_type {}; #ifndef _LIBCPP_HAS_NO_VARIADICS @@ -1690,8 +1679,8 @@ template template class __packaged_task_base; -template -class __packaged_task_base<_R(_ArgTypes...)> +template +class __packaged_task_base<_Rp(_ArgTypes...)> { __packaged_task_base(const __packaged_task_base&); __packaged_task_base& operator=(const __packaged_task_base&); @@ -1700,103 +1689,103 @@ 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 _R operator()(_ArgTypes&& ...) = 0; + virtual _Rp operator()(_ArgTypes&& ...) = 0; }; template class __packaged_task_func; -template -class __packaged_task_func<_F, _Alloc, _R(_ArgTypes...)> - : public __packaged_task_base<_R(_ArgTypes...)> +template +class __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)> + : public __packaged_task_base<_Rp(_ArgTypes...)> { - __compressed_pair<_F, _Alloc> __f_; + __compressed_pair<_Fp, _Alloc> __f_; public: _LIBCPP_INLINE_VISIBILITY - explicit __packaged_task_func(const _F& __f) : __f_(__f) {} + explicit __packaged_task_func(const _Fp& __f) : __f_(__f) {} _LIBCPP_INLINE_VISIBILITY - explicit __packaged_task_func(_F&& __f) : __f_(_VSTD::move(__f)) {} + explicit __packaged_task_func(_Fp&& __f) : __f_(_VSTD::move(__f)) {} _LIBCPP_INLINE_VISIBILITY - __packaged_task_func(const _F& __f, const _Alloc& __a) + __packaged_task_func(const _Fp& __f, const _Alloc& __a) : __f_(__f, __a) {} _LIBCPP_INLINE_VISIBILITY - __packaged_task_func(_F&& __f, const _Alloc& __a) + __packaged_task_func(_Fp&& __f, const _Alloc& __a) : __f_(_VSTD::move(__f), __a) {} - virtual void __move_to(__packaged_task_base<_R(_ArgTypes...)>*); + virtual void __move_to(__packaged_task_base<_Rp(_ArgTypes...)>*) _NOEXCEPT; virtual void destroy(); virtual void destroy_deallocate(); - virtual _R operator()(_ArgTypes&& ... __args); + virtual _Rp operator()(_ArgTypes&& ... __args); }; -template +template void -__packaged_task_func<_F, _Alloc, _R(_ArgTypes...)>::__move_to( - __packaged_task_base<_R(_ArgTypes...)>* __p) +__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to( + __packaged_task_base<_Rp(_ArgTypes...)>* __p) _NOEXCEPT { ::new (__p) __packaged_task_func(_VSTD::move(__f_.first()), _VSTD::move(__f_.second())); } -template +template void -__packaged_task_func<_F, _Alloc, _R(_ArgTypes...)>::destroy() +__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy() { - __f_.~__compressed_pair<_F, _Alloc>(); + __f_.~__compressed_pair<_Fp, _Alloc>(); } -template +template void -__packaged_task_func<_F, _Alloc, _R(_ArgTypes...)>::destroy_deallocate() +__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() { - typedef typename _Alloc::template rebind<__packaged_task_func>::other _A; - _A __a(__f_.second()); - __f_.~__compressed_pair<_F, _Alloc>(); + typedef typename _Alloc::template rebind<__packaged_task_func>::other _Ap; + _Ap __a(__f_.second()); + __f_.~__compressed_pair<_Fp, _Alloc>(); __a.deallocate(this, 1); } -template -_R -__packaged_task_func<_F, _Alloc, _R(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg) +template +_Rp +__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg) { return __invoke(__f_.first(), _VSTD::forward<_ArgTypes>(__arg)...); } template class __packaged_task_function; -template -class __packaged_task_function<_R(_ArgTypes...)> +template +class __packaged_task_function<_Rp(_ArgTypes...)> { - typedef __packaged_task_base<_R(_ArgTypes...)> __base; - aligned_storage<3*sizeof(void*)>::type __buf_; + typedef __packaged_task_base<_Rp(_ArgTypes...)> __base; + typename aligned_storage<3*sizeof(void*)>::type __buf_; __base* __f_; public: - typedef _R result_type; + typedef _Rp result_type; // construct/copy/destroy: _LIBCPP_INLINE_VISIBILITY - __packaged_task_function() : __f_(nullptr) {} - template - __packaged_task_function(_F&& __f); - template - __packaged_task_function(allocator_arg_t, const _Alloc& __a, _F&& __f); + __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; - _R operator()(_ArgTypes...) const; + _Rp operator()(_ArgTypes...) const; }; -template -__packaged_task_function<_R(_ArgTypes...)>::__packaged_task_function(__packaged_task_function&& __f) +template +__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(__packaged_task_function&& __f) _NOEXCEPT { if (__f.__f_ == nullptr) __f_ = nullptr; @@ -1812,42 +1801,42 @@ __packaged_task_function<_R(_ArgTypes...)>::__packaged_task_function(__packaged_ } } -template -template -__packaged_task_function<_R(_ArgTypes...)>::__packaged_task_function(_F&& __f) +template +template +__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f) : __f_(nullptr) { - typedef typename remove_reference<_F>::type _FR; - typedef __packaged_task_func<_FR, allocator<_FR>, _R(_ArgTypes...)> _FF; + typedef typename remove_reference<_Fp>::type _FR; + typedef __packaged_task_func<_FR, allocator<_FR>, _Rp(_ArgTypes...)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) { __f_ = (__base*)&__buf_; - ::new (__f_) _FF(_VSTD::forward<_F>(__f)); + ::new (__f_) _FF(_VSTD::forward<_Fp>(__f)); } else { - typedef allocator<_FF> _A; - _A __a; - typedef __allocator_destructor<_A> _D; - unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1)); - ::new (__hold.get()) _FF(_VSTD::forward<_F>(__f), allocator<_FR>(__a)); + typedef allocator<_FF> _Ap; + _Ap __a; + typedef __allocator_destructor<_Ap> _Dp; + unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); + ::new (__hold.get()) _FF(_VSTD::forward<_Fp>(__f), allocator<_FR>(__a)); __f_ = __hold.release(); } } -template -template -__packaged_task_function<_R(_ArgTypes...)>::__packaged_task_function( - allocator_arg_t, const _Alloc& __a0, _F&& __f) +template +template +__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function( + allocator_arg_t, const _Alloc& __a0, _Fp&& __f) : __f_(nullptr) { typedef allocator_traits<_Alloc> __alloc_traits; - typedef typename remove_reference<_F>::type _FR; - typedef __packaged_task_func<_FR, _Alloc, _R(_ArgTypes...)> _FF; + typedef typename remove_reference<_Fp>::type _FR; + typedef __packaged_task_func<_FR, _Alloc, _Rp(_ArgTypes...)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) { __f_ = (__base*)&__buf_; - ::new (__f_) _FF(_VSTD::forward<_F>(__f)); + ::new (__f_) _FF(_VSTD::forward<_Fp>(__f)); } else { @@ -1857,18 +1846,18 @@ __packaged_task_function<_R(_ArgTypes...)>::__packaged_task_function( #else rebind_alloc<_FF>::other #endif - _A; - _A __a(__a0); - typedef __allocator_destructor<_A> _D; - unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1)); - ::new (__hold.get()) _FF(_VSTD::forward<_F>(__f), _Alloc(__a)); + _Ap; + _Ap __a(__a0); + typedef __allocator_destructor<_Ap> _Dp; + unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); + ::new (__hold.get()) _FF(_VSTD::forward<_Fp>(__f), _Alloc(__a)); __f_ = __hold.release(); } } -template -__packaged_task_function<_R(_ArgTypes...)>& -__packaged_task_function<_R(_ArgTypes...)>::operator=(__packaged_task_function&& __f) +template +__packaged_task_function<_Rp(_ArgTypes...)>& +__packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function&& __f) _NOEXCEPT { if (__f_ == (__base*)&__buf_) __f_->destroy(); @@ -1887,10 +1876,11 @@ __packaged_task_function<_R(_ArgTypes...)>::operator=(__packaged_task_function&& __f_ = __f.__f_; __f.__f_ = nullptr; } + return *this; } -template -__packaged_task_function<_R(_ArgTypes...)>::~__packaged_task_function() +template +__packaged_task_function<_Rp(_ArgTypes...)>::~__packaged_task_function() { if (__f_ == (__base*)&__buf_) __f_->destroy(); @@ -1898,9 +1888,9 @@ __packaged_task_function<_R(_ArgTypes...)>::~__packaged_task_function() __f_->destroy_deallocate(); } -template +template void -__packaged_task_function<_R(_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_) { @@ -1935,19 +1925,19 @@ __packaged_task_function<_R(_ArgTypes...)>::swap(__packaged_task_function& __f) _VSTD::swap(__f_, __f.__f_); } -template +template inline _LIBCPP_INLINE_VISIBILITY -_R -__packaged_task_function<_R(_ArgTypes...)>::operator()(_ArgTypes... __arg) const +_Rp +__packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const { return (*__f_)(_VSTD::forward<_ArgTypes>(__arg)...); } -template -class _LIBCPP_VISIBLE packaged_task<_R(_ArgTypes...)> +template +class _LIBCPP_VISIBLE packaged_task<_Rp(_ArgTypes...)> { public: - typedef _R result_type; + typedef _Rp result_type; private: __packaged_task_function __f_; @@ -1956,41 +1946,41 @@ private: public: // construction and destruction _LIBCPP_INLINE_VISIBILITY - packaged_task() : __p_(nullptr) {} - template + packaged_task() _NOEXCEPT : __p_(nullptr) {} + template _LIBCPP_INLINE_VISIBILITY - explicit packaged_task(_F&& __f) : __f_(_VSTD::forward<_F>(__f)) {} - template + explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {} + template _LIBCPP_INLINE_VISIBILITY - explicit packaged_task(allocator_arg_t, const _Allocator& __a, _F&& __f) - : __f_(allocator_arg, __a, _VSTD::forward<_F>(__f)), + explicit packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f) + : __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)), __p_(allocator_arg, __a) {} // ~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 @@ -2003,9 +1993,9 @@ public: void reset(); }; -template +template void -packaged_task<_R(_ArgTypes...)>::operator()(_ArgTypes... __args) +packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args) { #ifndef _LIBCPP_NO_EXCEPTIONS if (__p_.__state_ == nullptr) @@ -2025,9 +2015,9 @@ packaged_task<_R(_ArgTypes...)>::operator()(_ArgTypes... __args) #endif // _LIBCPP_NO_EXCEPTIONS } -template +template void -packaged_task<_R(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args) +packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args) { #ifndef _LIBCPP_NO_EXCEPTIONS if (__p_.__state_ == nullptr) @@ -2047,9 +2037,9 @@ packaged_task<_R(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args) #endif // _LIBCPP_NO_EXCEPTIONS } -template +template void -packaged_task<_R(_ArgTypes...)>::reset() +packaged_task<_Rp(_ArgTypes...)>::reset() { #ifndef _LIBCPP_NO_EXCEPTIONS if (!valid()) @@ -2071,41 +2061,41 @@ private: public: // construction and destruction _LIBCPP_INLINE_VISIBILITY - packaged_task() : __p_(nullptr) {} - template + packaged_task() _NOEXCEPT : __p_(nullptr) {} + template _LIBCPP_INLINE_VISIBILITY - explicit packaged_task(_F&& __f) : __f_(_VSTD::forward<_F>(__f)) {} - template + explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {} + template _LIBCPP_INLINE_VISIBILITY - explicit packaged_task(allocator_arg_t, const _Allocator& __a, _F&& __f) - : __f_(allocator_arg, __a, _VSTD::forward<_F>(__f)), + explicit packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f) + : __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)), __p_(allocator_arg, __a) {} // ~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 @@ -2178,7 +2168,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); } @@ -2187,84 +2177,84 @@ template struct _LIBCPP_VISIBLE uses_allocator, _Alloc> : public true_type {}; -template -future<_R> +template +future<_Rp> #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -__make_deferred_assoc_state(_F&& __f) +__make_deferred_assoc_state(_Fp&& __f) #else -__make_deferred_assoc_state(_F __f) +__make_deferred_assoc_state(_Fp __f) #endif { - unique_ptr<__deferred_assoc_state<_R, _F>, __release_shared_count> - __h(new __deferred_assoc_state<_R, _F>(_VSTD::forward<_F>(__f))); - return future<_R>(__h.get()); + unique_ptr<__deferred_assoc_state<_Rp, _Fp>, __release_shared_count> + __h(new __deferred_assoc_state<_Rp, _Fp>(_VSTD::forward<_Fp>(__f))); + return future<_Rp>(__h.get()); } -template -future<_R> +template +future<_Rp> #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -__make_async_assoc_state(_F&& __f) +__make_async_assoc_state(_Fp&& __f) #else -__make_async_assoc_state(_F __f) +__make_async_assoc_state(_Fp __f) #endif { - unique_ptr<__async_assoc_state<_R, _F>, __release_shared_count> - __h(new __async_assoc_state<_R, _F>(_VSTD::forward<_F>(__f))); - _VSTD::thread(&__async_assoc_state<_R, _F>::__execute, __h.get()).detach(); - return future<_R>(__h.get()); + unique_ptr<__async_assoc_state<_Rp, _Fp>, __release_shared_count> + __h(new __async_assoc_state<_Rp, _Fp>(_VSTD::forward<_Fp>(__f))); + _VSTD::thread(&__async_assoc_state<_Rp, _Fp>::__execute, __h.get()).detach(); + return future<_Rp>(__h.get()); } -template +template class __async_func { - tuple<_F, _Args...> __f_; + tuple<_Fp, _Args...> __f_; public: - typedef typename __invoke_of<_F, _Args...>::type _R; + typedef typename __invoke_of<_Fp, _Args...>::type _Rp; _LIBCPP_INLINE_VISIBILITY - explicit __async_func(_F&& __f, _Args&&... __args) + explicit __async_func(_Fp&& __f, _Args&&... __args) : __f_(_VSTD::move(__f), _VSTD::move(__args)...) {} _LIBCPP_INLINE_VISIBILITY __async_func(__async_func&& __f) : __f_(_VSTD::move(__f.__f_)) {} - _R operator()() + _Rp operator()() { typedef typename __make_tuple_indices<1+sizeof...(_Args), 1>::type _Index; return __execute(_Index()); } private: template - _R + _Rp __execute(__tuple_indices<_Indices...>) { return __invoke(_VSTD::move(_VSTD::get<0>(__f_)), _VSTD::move(_VSTD::get<_Indices>(__f_))...); } }; -template -future::type, typename decay<_Args>::type...>::type> -async(launch __policy, _F&& __f, _Args&&... __args) +template +future::type, typename decay<_Args>::type...>::type> +async(launch __policy, _Fp&& __f, _Args&&... __args) { - typedef __async_func::type, typename decay<_Args>::type...> _BF; - typedef typename _BF::_R _R; - future<_R> __r; - if (__policy & launch::async) - __r = _VSTD::__make_async_assoc_state<_R>(_BF(__decay_copy(_VSTD::forward<_F>(__f)), + typedef __async_func::type, typename decay<_Args>::type...> _BF; + typedef typename _BF::_Rp _Rp; + future<_Rp> __r; + if (int(__policy) & int(launch::async)) + __r = _VSTD::__make_async_assoc_state<_Rp>(_BF(__decay_copy(_VSTD::forward<_Fp>(__f)), __decay_copy(_VSTD::forward<_Args>(__args))...)); - else if (__policy & launch::deferred) - __r = _VSTD::__make_deferred_assoc_state<_R>(_BF(__decay_copy(_VSTD::forward<_F>(__f)), + else if (int(__policy) & int(launch::deferred)) + __r = _VSTD::__make_deferred_assoc_state<_Rp>(_BF(__decay_copy(_VSTD::forward<_Fp>(__f)), __decay_copy(_VSTD::forward<_Args>(__args))...)); return __r; } -template +template inline _LIBCPP_INLINE_VISIBILITY -future::type, typename decay<_Args>::type...>::type> -async(_F&& __f, _Args&&... __args) +future::type, typename decay<_Args>::type...>::type> +async(_Fp&& __f, _Args&&... __args) { - return _VSTD::async(launch::any, _VSTD::forward<_F>(__f), + return _VSTD::async(launch::any, _VSTD::forward<_Fp>(__f), _VSTD::forward<_Args>(__args)...); } @@ -2272,30 +2262,30 @@ async(_F&& __f, _Args&&... __args) // shared_future -template +template class _LIBCPP_VISIBLE shared_future { - __assoc_state<_R>* __state_; + __assoc_state<_Rp>* __state_; 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<_R>&& __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; @@ -2304,14 +2294,14 @@ public: // retrieving the value _LIBCPP_INLINE_VISIBILITY - const _R& get() const {return __state_->copy();} + 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();} @@ -2327,16 +2317,16 @@ public: {return __state_->wait_until(__abs_time);} }; -template -shared_future<_R>::~shared_future() +template +shared_future<_Rp>::~shared_future() { if (__state_) __state_->__release_shared(); } -template -shared_future<_R>& -shared_future<_R>::operator=(const shared_future& __rhs) +template +shared_future<_Rp>& +shared_future<_Rp>::operator=(const shared_future& __rhs) { if (__rhs.__state_) __rhs.__state_->__add_shared(); @@ -2346,30 +2336,30 @@ shared_future<_R>::operator=(const shared_future& __rhs) return *this; } -template -class _LIBCPP_VISIBLE shared_future<_R&> +template +class _LIBCPP_VISIBLE shared_future<_Rp&> { - __assoc_state<_R&>* __state_; + __assoc_state<_Rp&>* __state_; 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<_R&>&& __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; @@ -2378,14 +2368,14 @@ public: // retrieving the value _LIBCPP_INLINE_VISIBILITY - _R& get() const {return __state_->copy();} + _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();} @@ -2401,16 +2391,16 @@ public: {return __state_->wait_until(__abs_time);} }; -template -shared_future<_R&>::~shared_future() +template +shared_future<_Rp&>::~shared_future() { if (__state_) __state_->__release_shared(); } -template -shared_future<_R&>& -shared_future<_R&>::operator=(const shared_future& __rhs) +template +shared_future<_Rp&>& +shared_future<_Rp&>::operator=(const shared_future& __rhs) { if (__rhs.__state_) __rhs.__state_->__add_shared(); @@ -2427,23 +2417,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; @@ -2455,11 +2445,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();} @@ -2475,28 +2465,28 @@ public: {return __state_->wait_until(__abs_time);} }; -template +template inline _LIBCPP_INLINE_VISIBILITY void -swap(shared_future<_R>& __x, shared_future<_R>& __y) +swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y) _NOEXCEPT { __x.swap(__y); } -template +template inline _LIBCPP_INLINE_VISIBILITY -shared_future<_R> -future<_R>::share() +shared_future<_Rp> +future<_Rp>::share() { - return shared_future<_R>(_VSTD::move(*this)); + return shared_future<_Rp>(_VSTD::move(*this)); } -template +template inline _LIBCPP_INLINE_VISIBILITY -shared_future<_R&> -future<_R&>::share() +shared_future<_Rp&> +future<_Rp&>::share() { - return shared_future<_R&>(_VSTD::move(*this)); + return shared_future<_Rp&>(_VSTD::move(*this)); } #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES diff --git a/system/include/libcxx/initializer_list b/system/include/libcxx/initializer_list index 745d3bd787f89..2f88514b7f786 100644 --- a/system/include/libcxx/initializer_list +++ b/system/include/libcxx/initializer_list @@ -46,52 +46,54 @@ template const E* end(initializer_list il) noexcept; #include <__config> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif namespace std // purposefully not versioned { #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -template +template class _LIBCPP_VISIBLE initializer_list { - const _E* __begin_; + const _Ep* __begin_; size_t __size_; _LIBCPP_ALWAYS_INLINE - initializer_list(const _E* __b, size_t __s) _NOEXCEPT + initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT : __begin_(__b), __size_(__s) {} public: - typedef _E value_type; - typedef const _E& reference; - typedef const _E& const_reference; + typedef _Ep value_type; + typedef const _Ep& reference; + typedef const _Ep& const_reference; typedef size_t size_type; - typedef const _E* iterator; - typedef const _E* const_iterator; + typedef const _Ep* iterator; + typedef const _Ep* const_iterator; _LIBCPP_ALWAYS_INLINE initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {} _LIBCPP_ALWAYS_INLINE size_t size() const _NOEXCEPT {return __size_;} - _LIBCPP_ALWAYS_INLINE const _E* begin() const _NOEXCEPT {return __begin_;} - _LIBCPP_ALWAYS_INLINE const _E* end() const _NOEXCEPT {return __begin_ + __size_;} + _LIBCPP_ALWAYS_INLINE const _Ep* begin() const _NOEXCEPT {return __begin_;} + _LIBCPP_ALWAYS_INLINE const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;} }; -template +template inline _LIBCPP_INLINE_VISIBILITY -const _E* -begin(initializer_list<_E> __il) _NOEXCEPT +const _Ep* +begin(initializer_list<_Ep> __il) _NOEXCEPT { return __il.begin(); } -template +template inline _LIBCPP_INLINE_VISIBILITY -const _E* -end(initializer_list<_E> __il) _NOEXCEPT +const _Ep* +end(initializer_list<_Ep> __il) _NOEXCEPT { return __il.end(); } diff --git a/system/include/libcxx/iomanip b/system/include/libcxx/iomanip index a407360ff0e9c..0c58e1980f3f3 100644 --- a/system/include/libcxx/iomanip +++ b/system/include/libcxx/iomanip @@ -33,7 +33,9 @@ template T10 put_time(const struct tm* tmb, const charT* fmt); #include <__config> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -275,10 +277,10 @@ public: __iom_t7(_MoneyT& __mon, bool __intl) : __mon_(__mon), __intl_(__intl) {} - template + template friend basic_istream<_CharT, _Traits>& - operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_M>& __x); + operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_Mp>& __x); }; template @@ -292,11 +294,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x) typename basic_istream<_CharT, _Traits>::sentry __s(__is); if (__s) { - typedef istreambuf_iterator<_CharT, _Traits> _I; - typedef money_get<_CharT, _I> _F; + typedef istreambuf_iterator<_CharT, _Traits> _Ip; + typedef money_get<_CharT, _Ip> _Fp; ios_base::iostate __err = ios_base::goodbit; - const _F& __mf = use_facet<_F>(__is.getloc()); - __mf.get(_I(__is), _I(), __x.__intl_, __is, __err, __x.__mon_); + const _Fp& __mf = use_facet<_Fp>(__is.getloc()); + __mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_); __is.setstate(__err); } #ifndef _LIBCPP_NO_EXCEPTIONS @@ -335,10 +337,10 @@ public: __iom_t8(const _MoneyT& __mon, bool __intl) : __mon_(__mon), __intl_(__intl) {} - template + template friend basic_ostream<_CharT, _Traits>& - operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_M>& __x); + operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_Mp>& __x); }; template @@ -352,10 +354,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x) typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { - typedef ostreambuf_iterator<_CharT, _Traits> _O; - typedef money_put<_CharT, _O> _F; - const _F& __mf = use_facet<_F>(__os.getloc()); - if (__mf.put(_O(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed()) + typedef ostreambuf_iterator<_CharT, _Traits> _Op; + typedef money_put<_CharT, _Op> _Fp; + const _Fp& __mf = use_facet<_Fp>(__os.getloc()); + if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed()) __os.setstate(ios_base::badbit); } #ifndef _LIBCPP_NO_EXCEPTIONS @@ -394,10 +396,10 @@ public: __iom_t9(tm* __tm, const _CharT* __fmt) : __tm_(__tm), __fmt_(__fmt) {} - template + template friend - basic_istream<_C, _Traits>& - operator>>(basic_istream<_C, _Traits>& __is, const __iom_t9<_C>& __x); + basic_istream<_Cp, _Traits>& + operator>>(basic_istream<_Cp, _Traits>& __is, const __iom_t9<_Cp>& __x); }; template @@ -411,11 +413,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x) typename basic_istream<_CharT, _Traits>::sentry __s(__is); if (__s) { - typedef istreambuf_iterator<_CharT, _Traits> _I; - typedef time_get<_CharT, _I> _F; + typedef istreambuf_iterator<_CharT, _Traits> _Ip; + typedef time_get<_CharT, _Ip> _Fp; ios_base::iostate __err = ios_base::goodbit; - const _F& __tf = use_facet<_F>(__is.getloc()); - __tf.get(_I(__is), _I(), __is, __err, __x.__tm_, + const _Fp& __tf = use_facet<_Fp>(__is.getloc()); + __tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_, __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)); __is.setstate(__err); } @@ -455,10 +457,10 @@ public: __iom_t10(const tm* __tm, const _CharT* __fmt) : __tm_(__tm), __fmt_(__fmt) {} - template + template friend - basic_ostream<_C, _Traits>& - operator<<(basic_ostream<_C, _Traits>& __os, const __iom_t10<_C>& __x); + basic_ostream<_Cp, _Traits>& + operator<<(basic_ostream<_Cp, _Traits>& __os, const __iom_t10<_Cp>& __x); }; template @@ -472,10 +474,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x) typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { - typedef ostreambuf_iterator<_CharT, _Traits> _O; - typedef time_put<_CharT, _O> _F; - const _F& __tf = use_facet<_F>(__os.getloc()); - if (__tf.put(_O(__os), __os, __os.fill(), __x.__tm_, + typedef ostreambuf_iterator<_CharT, _Traits> _Op; + typedef time_put<_CharT, _Op> _Fp; + const _Fp& __tf = use_facet<_Fp>(__os.getloc()); + if (__tf.put(_Op(__os), __os, __os.fill(), __x.__tm_, __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed()) __os.setstate(ios_base::badbit); } diff --git a/system/include/libcxx/ios b/system/include/libcxx/ios index 477a51facb624..1474deb469b0f 100644 --- a/system/include/libcxx/ios +++ b/system/include/libcxx/ios @@ -8,12 +8,6 @@ // //===----------------------------------------------------------------------===// -// Emscripten note: -// __except has been renamed to __exceptXXX in this header to avoid compilation -// errors on windows using clang version 3.0 (tags/RELEASE_30/final). This can -// be reverted once emscripten upgrades to clang 3.1: -// http://comments.gmane.org/gmane.comp.compilers.clang.scm/41578 - #ifndef _LIBCPP_IOS #define _LIBCPP_IOS @@ -35,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; @@ -166,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); }; @@ -222,7 +216,9 @@ storage-class-specifier const error_category& iostream_category; #include <__locale> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -231,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; @@ -275,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; @@ -323,7 +319,7 @@ public: _LIBCPP_INLINE_VISIBILITY bool bad() const; _LIBCPP_INLINE_VISIBILITY iostate exceptions() const; - _LIBCPP_INLINE_VISIBILITY void exceptions(iostate __exceptXXX); + _LIBCPP_INLINE_VISIBILITY void exceptions(iostate __except); void __set_badbit_and_consider_rethrow(); void __set_failbit_and_consider_rethrow(); @@ -346,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) @@ -377,21 +373,19 @@ private: }; //enum class io_errc -struct _LIBCPP_VISIBLE io_errc +_LIBCPP_DECLARE_STRONG_ENUM(io_errc) { -enum _ { stream = 1 }; - _ __v_; - - _LIBCPP_ALWAYS_INLINE io_errc(_ __v) : __v_(__v) {} - _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} -}; +_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc) template <> struct _LIBCPP_VISIBLE is_error_code_enum : public true_type { }; + +#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS template <> -struct _LIBCPP_VISIBLE is_error_code_enum : public true_type { }; +struct _LIBCPP_VISIBLE is_error_code_enum : public true_type { }; +#endif _LIBCPP_VISIBLE const error_category& iostream_category(); @@ -559,9 +553,9 @@ ios_base::exceptions() const inline _LIBCPP_INLINE_VISIBILITY void -ios_base::exceptions(iostate __exceptXXX) +ios_base::exceptions(iostate __except) { - __exceptions_ = __exceptXXX; + __exceptions_ = __except; clear(__rdstate_); } @@ -578,7 +572,8 @@ public: typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; - _LIBCPP_ALWAYS_INLINE // explicit + _LIBCPP_ALWAYS_INLINE + _LIBCPP_EXPLICIT operator bool() const {return !fail();} _LIBCPP_ALWAYS_INLINE bool operator!() const {return fail();} _LIBCPP_ALWAYS_INLINE iostate rdstate() const {return ios_base::rdstate();} @@ -590,7 +585,7 @@ public: _LIBCPP_ALWAYS_INLINE bool bad() const {return ios_base::bad();} _LIBCPP_ALWAYS_INLINE iostate exceptions() const {return ios_base::exceptions();} - _LIBCPP_ALWAYS_INLINE void exceptions(iostate __exceptXXX) {ios_base::exceptions(__exceptXXX);} + _LIBCPP_ALWAYS_INLINE void exceptions(iostate __except) {ios_base::exceptions(__except);} // 27.5.4.1 Constructor/destructor: _LIBCPP_INLINE_VISIBILITY @@ -637,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 @@ -664,7 +659,7 @@ basic_ios<_CharT, _Traits>::init(basic_streambuf* __sb) { ios_base::init(__sb); __tie_ = 0; - __fill_ = widen(' '); + __fill_ = traits_type::eof(); } template @@ -736,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_; } @@ -779,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/system/include/libcxx/iosfwd b/system/include/libcxx/iosfwd index 852d9e5f3e8b5..efdff5f356591 100644 --- a/system/include/libcxx/iosfwd +++ b/system/include/libcxx/iosfwd @@ -89,11 +89,13 @@ typedef fpos::state_type> wstreampos; #include <__config> #include // for mbstate_t +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _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/system/include/libcxx/iostream b/system/include/libcxx/iostream index e828b54fa8988..53cd146cc5951 100644 --- a/system/include/libcxx/iostream +++ b/system/include/libcxx/iostream @@ -40,7 +40,9 @@ extern wostream wclog; #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/system/include/libcxx/istream b/system/include/libcxx/istream index de8aa1067235c..3979e1407061c 100644 --- a/system/include/libcxx/istream +++ b/system/include/libcxx/istream @@ -155,7 +155,11 @@ template #include <__config> #include +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -190,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&)); @@ -252,7 +256,7 @@ public: // ~sentry() = default; _LIBCPP_INLINE_VISIBILITY - // explicit + _LIBCPP_EXPLICIT operator bool() const {return __ok_;} }; @@ -267,10 +271,10 @@ basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& _ __is.tie()->flush(); if (!__noskipws && (__is.flags() & ios_base::skipws)) { - typedef istreambuf_iterator<_CharT, _Traits> _I; + typedef istreambuf_iterator<_CharT, _Traits> _Ip; const ctype<_CharT>& __ct = use_facet >(__is.getloc()); - _I __i(__is); - _I __eof; + _Ip __i(__is); + _Ip __eof; for (; __i != __eof; ++__i) if (!__ct.is(__ct.space, *__i)) break; @@ -338,10 +342,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n) sentry __s(*this); if (__s) { - typedef istreambuf_iterator _I; - typedef num_get _F; + typedef istreambuf_iterator _Ip; + typedef num_get _Fp; ios_base::iostate __err = ios_base::goodbit; - use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n); + use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); this->setstate(__err); } #ifndef _LIBCPP_NO_EXCEPTIONS @@ -365,10 +369,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n) sentry __s(*this); if (__s) { - typedef istreambuf_iterator _I; - typedef num_get _F; + typedef istreambuf_iterator _Ip; + typedef num_get _Fp; ios_base::iostate __err = ios_base::goodbit; - use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n); + use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); this->setstate(__err); } #ifndef _LIBCPP_NO_EXCEPTIONS @@ -392,10 +396,10 @@ basic_istream<_CharT, _Traits>::operator>>(long& __n) sentry __s(*this); if (__s) { - typedef istreambuf_iterator _I; - typedef num_get _F; + typedef istreambuf_iterator _Ip; + typedef num_get _Fp; ios_base::iostate __err = ios_base::goodbit; - use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n); + use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); this->setstate(__err); } #ifndef _LIBCPP_NO_EXCEPTIONS @@ -419,10 +423,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n) sentry __s(*this); if (__s) { - typedef istreambuf_iterator _I; - typedef num_get _F; + typedef istreambuf_iterator _Ip; + typedef num_get _Fp; ios_base::iostate __err = ios_base::goodbit; - use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n); + use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); this->setstate(__err); } #ifndef _LIBCPP_NO_EXCEPTIONS @@ -446,10 +450,10 @@ basic_istream<_CharT, _Traits>::operator>>(long long& __n) sentry __s(*this); if (__s) { - typedef istreambuf_iterator _I; - typedef num_get _F; + typedef istreambuf_iterator _Ip; + typedef num_get _Fp; ios_base::iostate __err = ios_base::goodbit; - use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n); + use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); this->setstate(__err); } #ifndef _LIBCPP_NO_EXCEPTIONS @@ -473,10 +477,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n) sentry __s(*this); if (__s) { - typedef istreambuf_iterator _I; - typedef num_get _F; + typedef istreambuf_iterator _Ip; + typedef num_get _Fp; ios_base::iostate __err = ios_base::goodbit; - use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n); + use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); this->setstate(__err); } #ifndef _LIBCPP_NO_EXCEPTIONS @@ -500,10 +504,10 @@ basic_istream<_CharT, _Traits>::operator>>(float& __n) sentry __s(*this); if (__s) { - typedef istreambuf_iterator _I; - typedef num_get _F; + typedef istreambuf_iterator _Ip; + typedef num_get _Fp; ios_base::iostate __err = ios_base::goodbit; - use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n); + use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); this->setstate(__err); } #ifndef _LIBCPP_NO_EXCEPTIONS @@ -527,10 +531,10 @@ basic_istream<_CharT, _Traits>::operator>>(double& __n) sentry __s(*this); if (__s) { - typedef istreambuf_iterator _I; - typedef num_get _F; + typedef istreambuf_iterator _Ip; + typedef num_get _Fp; ios_base::iostate __err = ios_base::goodbit; - use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n); + use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); this->setstate(__err); } #ifndef _LIBCPP_NO_EXCEPTIONS @@ -554,10 +558,10 @@ basic_istream<_CharT, _Traits>::operator>>(long double& __n) sentry __s(*this); if (__s) { - typedef istreambuf_iterator _I; - typedef num_get _F; + typedef istreambuf_iterator _Ip; + typedef num_get _Fp; ios_base::iostate __err = ios_base::goodbit; - use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n); + use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); this->setstate(__err); } #ifndef _LIBCPP_NO_EXCEPTIONS @@ -581,10 +585,10 @@ basic_istream<_CharT, _Traits>::operator>>(bool& __n) sentry __s(*this); if (__s) { - typedef istreambuf_iterator _I; - typedef num_get _F; + typedef istreambuf_iterator _Ip; + typedef num_get _Fp; ios_base::iostate __err = ios_base::goodbit; - use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n); + use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); this->setstate(__err); } #ifndef _LIBCPP_NO_EXCEPTIONS @@ -608,10 +612,10 @@ basic_istream<_CharT, _Traits>::operator>>(void*& __n) sentry __s(*this); if (__s) { - typedef istreambuf_iterator _I; - typedef num_get _F; + typedef istreambuf_iterator _Ip; + typedef num_get _Fp; ios_base::iostate __err = ios_base::goodbit; - use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n); + use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); this->setstate(__err); } #ifndef _LIBCPP_NO_EXCEPTIONS @@ -635,11 +639,11 @@ basic_istream<_CharT, _Traits>::operator>>(short& __n) sentry __s(*this); if (__s) { - typedef istreambuf_iterator _I; - typedef num_get _F; + typedef istreambuf_iterator _Ip; + typedef num_get _Fp; ios_base::iostate __err = ios_base::goodbit; long __temp; - use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __temp); + use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp); if (__temp < numeric_limits::min()) { __err |= ios_base::failbit; @@ -675,11 +679,11 @@ basic_istream<_CharT, _Traits>::operator>>(int& __n) sentry __s(*this); if (__s) { - typedef istreambuf_iterator _I; - typedef num_get _F; + typedef istreambuf_iterator _Ip; + typedef num_get _Fp; ios_base::iostate __err = ios_base::goodbit; long __temp; - use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __temp); + use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp); if (__temp < numeric_limits::min()) { __err |= ios_base::failbit; @@ -1141,7 +1145,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm) } ++__gc_; char_type __ch = traits_type::to_char_type(__i); - if (traits_type::eq(__ch, __dlm)) + if (traits_type::eq(__ch, static_cast(__dlm))) break; } } @@ -1157,7 +1161,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm) } ++__gc_; char_type __ch = traits_type::to_char_type(__i); - if (traits_type::eq(__ch, __dlm)) + if (traits_type::eq(__ch, static_cast(__dlm))) break; } } @@ -1185,7 +1189,11 @@ basic_istream<_CharT, _Traits>::peek() #endif // _LIBCPP_NO_EXCEPTIONS sentry __sen(*this, true); if (__sen) + { __r = this->rdbuf()->sgetc(); + if (traits_type::eq_int_type(__r, traits_type::eof())) + this->setstate(ios_base::eofbit); + } #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -1208,7 +1216,6 @@ basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n) sentry __sen(*this, true); if (__sen) { - ios_base::iostate __err = ios_base::goodbit; for (; __gc_ < __n; ++__gc_) { typename traits_type::int_type __i = this->rdbuf()->sbumpc(); @@ -1236,6 +1243,7 @@ template streamsize basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n) { + __gc_ = 0; streamsize __c = this->rdbuf()->in_avail(); switch (__c) { @@ -1260,6 +1268,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) { @@ -1287,6 +1296,7 @@ basic_istream<_CharT, _Traits>::unget() try { #endif // _LIBCPP_NO_EXCEPTIONS + this->clear(this->rdstate() & ~ios_base::eofbit); sentry __sen(*this, true); if (__sen) { @@ -1365,6 +1375,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)) @@ -1586,6 +1597,7 @@ getline(basic_istream<_CharT, _Traits>& __is, { __str.clear(); ios_base::iostate __err = ios_base::goodbit; + streamsize __extr = 0; while (true) { typename _Traits::int_type __i = __is.rdbuf()->sbumpc(); @@ -1594,6 +1606,7 @@ getline(basic_istream<_CharT, _Traits>& __is, __err |= ios_base::eofbit; break; } + ++__extr; _CharT __ch = _Traits::to_char_type(__i); if (_Traits::eq(__ch, __dlm)) break; @@ -1604,7 +1617,7 @@ getline(basic_istream<_CharT, _Traits>& __is, break; } } - if (__str.empty()) + if (__extr == 0) __err |= ios_base::failbit; __is.setstate(__err); } @@ -1698,9 +1711,9 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) return __is; } -extern template class basic_istream; -extern template class basic_istream; -extern template class basic_iostream; +_LIBCPP_EXTERN_TEMPLATE(class basic_istream) +_LIBCPP_EXTERN_TEMPLATE(class basic_istream) +_LIBCPP_EXTERN_TEMPLATE(class basic_iostream) _LIBCPP_END_NAMESPACE_STD diff --git a/system/include/libcxx/iterator b/system/include/libcxx/iterator index 05019fddcefe9..b23310b0940d6 100644 --- a/system/include/libcxx/iterator +++ b/system/include/libcxx/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()); @@ -317,11 +317,17 @@ template T* end(T (&array)[N]); #include #include #include +#if __APPLE__ +#include +#endif + #ifdef _LIBCPP_DEBUG #include #endif +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -335,7 +341,7 @@ template struct __has_iterator_category { private: - struct __two {char _; char __;}; + struct __two {char __lx; char __lxx;}; template static __two __test(...); template static char __test(typename _Up::iterator_category* = 0); public: @@ -624,11 +630,11 @@ public: typedef _Container container_type; _LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(&__x) {} - _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value) - {container->push_back(__value); return *this;} + _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value_) + {container->push_back(__value_); return *this;} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value) - {container->push_back(_VSTD::move(__value)); return *this;} + _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value_) + {container->push_back(_VSTD::move(__value_)); return *this;} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++() {return *this;} @@ -657,11 +663,11 @@ public: typedef _Container container_type; _LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(&__x) {} - _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value) - {container->push_front(__value); return *this;} + _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value_) + {container->push_front(__value_); return *this;} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value) - {container->push_front(_VSTD::move(__value)); return *this;} + _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value_) + {container->push_front(_VSTD::move(__value_)); return *this;} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++() {return *this;} @@ -692,11 +698,11 @@ public: _LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i) : container(&__x), iter(__i) {} - _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value) - {iter = container->insert(iter, __value); ++iter; return *this;} + _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value_) + {iter = container->insert(iter, __value_); ++iter; return *this;} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value) - {iter = container->insert(iter, _VSTD::move(__value)); ++iter; return *this;} + _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value_) + {iter = container->insert(iter, _VSTD::move(__value_)); ++iter; return *this;} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;} @@ -767,9 +773,9 @@ public: : __out_stream_(&__s), __delim_(0) {} _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter) : __out_stream_(&__s), __delim_(__delimiter) {} - _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value) + _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value_) { - *__out_stream_ << __value; + *__out_stream_ << __value_; if (__delim_) *__out_stream_ << __delim_; return *this; @@ -793,7 +799,7 @@ public: typedef basic_streambuf<_CharT,_Traits> streambuf_type; typedef basic_istream<_CharT,_Traits> istream_type; private: - streambuf_type* __sbuf_; + mutable streambuf_type* __sbuf_; class __proxy { @@ -807,37 +813,36 @@ private: }; _LIBCPP_INLINE_VISIBILITY - void __test_for_eof() + bool __test_for_eof() const { if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof())) __sbuf_ = 0; + return __sbuf_ == 0; } public: - _LIBCPP_INLINE_VISIBILITY istreambuf_iterator() throw() : __sbuf_(0) {} - _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) throw() - : __sbuf_(__s.rdbuf()) {__test_for_eof();} - _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) throw() - : __sbuf_(__s) {__test_for_eof();} - _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) throw() + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {} + _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT + : __sbuf_(__s.rdbuf()) {} + _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) _NOEXCEPT + : __sbuf_(__s) {} + _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) _NOEXCEPT : __sbuf_(__p.__sbuf_) {} - _LIBCPP_INLINE_VISIBILITY _CharT operator*() const {return __sbuf_->sgetc();} + _LIBCPP_INLINE_VISIBILITY char_type operator*() const + {return static_cast(__sbuf_->sgetc());} _LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;} _LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++() { - if (traits_type::eq_int_type(__sbuf_->snextc(), traits_type::eof())) - __sbuf_ = 0; + __sbuf_->sbumpc(); return *this; } _LIBCPP_INLINE_VISIBILITY __proxy operator++(int) { - char_type __c = __sbuf_->sgetc(); - ++(*this); - return __proxy(__c, __sbuf_); + return __proxy(__sbuf_->sbumpc(), __sbuf_); } _LIBCPP_INLINE_VISIBILITY bool equal(const istreambuf_iterator& __b) const - {return (__sbuf_ == 0) == (__b.__sbuf_ == 0);} + {return __test_for_eof() == __b.__test_for_eof();} }; template @@ -864,9 +869,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) { @@ -877,7 +882,20 @@ 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;} + +#if !defined(__APPLE__) || \ + (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \ + (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_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); +#endif }; template @@ -1006,43 +1024,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, const __wrap_iter<_Iter>&) _NOEXCEPT; +operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT; -template _O copy(_I, _I, _O); -template _B2 copy_backward(_B1, _B1, _B2); -template _O move(_I, _I, _O); -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, @@ -1208,11 +1235,11 @@ private: template friend __wrap_iter<_Iter1> - operator+(typename __wrap_iter<_Iter1>::difference_type, const __wrap_iter<_Iter1>&) _NOEXCEPT; + operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT; - template friend _O copy(_I, _I, _O); + template friend _Op copy(_Ip, _Ip, _Op); template friend _B2 copy_backward(_B1, _B1, _B2); - template friend _O move(_I, _I, _O); + template friend _Op move(_Ip, _Ip, _Op); template friend _B2 move_backward(_B1, _B1, _B2); template @@ -1281,6 +1308,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 @@ -1310,34 +1369,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>&); @@ -1713,88 +1780,88 @@ operator+(typename __debug_iter<_Container, _Iter>::difference_type __n, #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) -template +template inline _LIBCPP_INLINE_VISIBILITY auto -begin(_C& __c) -> decltype(__c.begin()) +begin(_Cp& __c) -> decltype(__c.begin()) { return __c.begin(); } -template +template inline _LIBCPP_INLINE_VISIBILITY auto -begin(const _C& __c) -> decltype(__c.begin()) +begin(const _Cp& __c) -> decltype(__c.begin()) { return __c.begin(); } -template +template inline _LIBCPP_INLINE_VISIBILITY auto -end(_C& __c) -> decltype(__c.end()) +end(_Cp& __c) -> decltype(__c.end()) { return __c.end(); } -template +template inline _LIBCPP_INLINE_VISIBILITY auto -end(const _C& __c) -> decltype(__c.end()) +end(const _Cp& __c) -> decltype(__c.end()) { return __c.end(); } #else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) -template +template inline _LIBCPP_INLINE_VISIBILITY -typename _C::iterator -begin(_C& __c) +typename _Cp::iterator +begin(_Cp& __c) { return __c.begin(); } -template +template inline _LIBCPP_INLINE_VISIBILITY -typename _C::const_iterator -begin(const _C& __c) +typename _Cp::const_iterator +begin(const _Cp& __c) { return __c.begin(); } -template +template inline _LIBCPP_INLINE_VISIBILITY -typename _C::iterator -end(_C& __c) +typename _Cp::iterator +end(_Cp& __c) { return __c.end(); } -template +template inline _LIBCPP_INLINE_VISIBILITY -typename _C::const_iterator -end(const _C& __c) +typename _Cp::const_iterator +end(const _Cp& __c) { return __c.end(); } #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) -template +template inline _LIBCPP_INLINE_VISIBILITY -_T* -begin(_T (&__array)[_N]) +_Tp* +begin(_Tp (&__array)[_Np]) { return __array; } -template +template inline _LIBCPP_INLINE_VISIBILITY -_T* -end(_T (&__array)[_N]) +_Tp* +end(_Tp (&__array)[_Np]) { - return __array + _N; + return __array + _Np; } _LIBCPP_END_NAMESPACE_STD diff --git a/system/include/libcxx/limits b/system/include/libcxx/limits index 989964e0a6aae..f089a794dc1ef 100644 --- a/system/include/libcxx/limits +++ b/system/include/libcxx/limits @@ -21,43 +21,43 @@ template class numeric_limits { public: - static const bool is_specialized = false; - static T min() noexcept; - static T max() noexcept; - static T lowest() noexcept; - - static const int digits = 0; - static const int digits10 = 0; - static const int max_digits10 = 0; - static const bool is_signed = false; - static const bool is_integer = false; - static const bool is_exact = false; - static const int radix = 0; - static T epsilon() noexcept; - static T round_error() noexcept; - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - static T infinity() noexcept; - static T quiet_NaN() noexcept; - static T signaling_NaN() noexcept; - static T denorm_min() noexcept; - - static const bool is_iec559 = false; - static const bool is_bounded = false; - static const bool is_modulo = false; - - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static constexpr bool is_specialized = false; + static constexpr T min() noexcept; + static constexpr T max() noexcept; + static constexpr T lowest() noexcept; + + static constexpr int digits = 0; + static constexpr int digits10 = 0; + static constexpr int max_digits10 = 0; + static constexpr bool is_signed = false; + static constexpr bool is_integer = false; + static constexpr bool is_exact = false; + static constexpr int radix = 0; + static constexpr T epsilon() noexcept; + static constexpr T round_error() noexcept; + + static constexpr int min_exponent = 0; + static constexpr int min_exponent10 = 0; + static constexpr int max_exponent = 0; + static constexpr int max_exponent10 = 0; + + static constexpr bool has_infinity = false; + static constexpr bool has_quiet_NaN = false; + static constexpr bool has_signaling_NaN = false; + static constexpr float_denorm_style has_denorm = denorm_absent; + static constexpr bool has_denorm_loss = false; + static constexpr T infinity() noexcept; + static constexpr T quiet_NaN() noexcept; + static constexpr T signaling_NaN() noexcept; + static constexpr T denorm_min() noexcept; + + static constexpr bool is_iec559 = false; + static constexpr bool is_bounded = false; + static constexpr bool is_modulo = false; + + static constexpr bool traps = false; + static constexpr bool tinyness_before = false; + static constexpr float_round_style round_style = round_toward_zero; }; enum float_round_style @@ -102,11 +102,19 @@ template<> class numeric_limits; */ +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif #include <__config> #include +#include <__undef_min_max> + +#if defined(_MSC_VER) +#include "support/win32/limits_win32.h" +#endif // _MSC_VER + _LIBCPP_BEGIN_NAMESPACE_STD enum float_round_style @@ -131,55 +139,55 @@ class __libcpp_numeric_limits protected: typedef _Tp type; - static const bool is_specialized = false; - _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return type();} - _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return type();} - _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return type();} - - static const int digits = 0; - static const int digits10 = 0; - static const int max_digits10 = 0; - static const bool is_signed = false; - static const bool is_integer = false; - static const bool is_exact = false; - static const int radix = 0; - _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return type();} - _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return type();} - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return type();} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return type();} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return type();} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return type();} - - static const bool is_iec559 = false; - static const bool is_bounded = false; - static const bool is_modulo = false; - - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static _LIBCPP_CONSTEXPR const bool is_specialized = false; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return type();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return type();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return type();} + + static _LIBCPP_CONSTEXPR const int digits = 0; + static _LIBCPP_CONSTEXPR const int digits10 = 0; + static _LIBCPP_CONSTEXPR const int max_digits10 = 0; + static _LIBCPP_CONSTEXPR const bool is_signed = false; + static _LIBCPP_CONSTEXPR const bool is_integer = false; + static _LIBCPP_CONSTEXPR const bool is_exact = false; + static _LIBCPP_CONSTEXPR const int radix = 0; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type();} + + static _LIBCPP_CONSTEXPR const int min_exponent = 0; + static _LIBCPP_CONSTEXPR const int min_exponent10 = 0; + static _LIBCPP_CONSTEXPR const int max_exponent = 0; + static _LIBCPP_CONSTEXPR const int max_exponent10 = 0; + + static _LIBCPP_CONSTEXPR const bool has_infinity = false; + static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false; + static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false; + static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent; + static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type();} + + static _LIBCPP_CONSTEXPR const bool is_iec559 = false; + static _LIBCPP_CONSTEXPR const bool is_bounded = false; + static _LIBCPP_CONSTEXPR const bool is_modulo = false; + + static _LIBCPP_CONSTEXPR const bool traps = false; + static _LIBCPP_CONSTEXPR const bool tinyness_before = false; + static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero; }; template struct __libcpp_compute_min { - static const _Tp value = _Tp(_Tp(1) << digits); + static _LIBCPP_CONSTEXPR const _Tp value = _Tp(_Tp(1) << digits); }; template struct __libcpp_compute_min<_Tp, digits, false> { - static const _Tp value = _Tp(0); + static _LIBCPP_CONSTEXPR const _Tp value = _Tp(0); }; template @@ -188,50 +196,50 @@ class __libcpp_numeric_limits<_Tp, true> protected: typedef _Tp type; - static const bool is_specialized = true; - - static const bool is_signed = type(-1) < type(0); - static const int digits = static_cast(sizeof(type) * __CHAR_BIT__ - is_signed); - static const int digits10 = digits * 3 / 10; - static const int max_digits10 = 0; - static const type __min = __libcpp_compute_min::value; - static const type __max = is_signed ? type(type(~0) ^ __min) : type(~0); - _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __min;} - _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __max;} - _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return min();} - - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return type(0);} - _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return type(0);} - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return type(0);} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return type(0);} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return type(0);} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return type(0);} - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; + static _LIBCPP_CONSTEXPR const bool is_specialized = true; + + static _LIBCPP_CONSTEXPR const bool is_signed = type(-1) < type(0); + static _LIBCPP_CONSTEXPR const int digits = static_cast(sizeof(type) * __CHAR_BIT__ - is_signed); + static _LIBCPP_CONSTEXPR const int digits10 = digits * 3 / 10; + static _LIBCPP_CONSTEXPR const int max_digits10 = 0; + static _LIBCPP_CONSTEXPR const type __min = __libcpp_compute_min::value; + static _LIBCPP_CONSTEXPR const type __max = is_signed ? type(type(~0) ^ __min) : type(~0); + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __min;} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __max;} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return min();} + + static _LIBCPP_CONSTEXPR const bool is_integer = true; + static _LIBCPP_CONSTEXPR const bool is_exact = true; + static _LIBCPP_CONSTEXPR const int radix = 2; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type(0);} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type(0);} + + static _LIBCPP_CONSTEXPR const int min_exponent = 0; + static _LIBCPP_CONSTEXPR const int min_exponent10 = 0; + static _LIBCPP_CONSTEXPR const int max_exponent = 0; + static _LIBCPP_CONSTEXPR const int max_exponent10 = 0; + + static _LIBCPP_CONSTEXPR const bool has_infinity = false; + static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false; + static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false; + static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent; + static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type(0);} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type(0);} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type(0);} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type(0);} + + static _LIBCPP_CONSTEXPR const bool is_iec559 = false; + static _LIBCPP_CONSTEXPR const bool is_bounded = true; + static _LIBCPP_CONSTEXPR const bool is_modulo = true; #if __i386__ || __x86_64__ - static const bool traps = true; + static _LIBCPP_CONSTEXPR const bool traps = true; #else - static const bool traps = false; + static _LIBCPP_CONSTEXPR const bool traps = false; #endif - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static _LIBCPP_CONSTEXPR const bool tinyness_before = false; + static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero; }; template <> @@ -240,46 +248,46 @@ class __libcpp_numeric_limits protected: typedef bool type; - static const bool is_specialized = true; - - static const bool is_signed = false; - static const int digits = 1; - static const int digits10 = 0; - static const int max_digits10 = 0; - static const type __min = false; - static const type __max = true; - _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __min;} - _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __max;} - _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return min();} - - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return type(0);} - _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return type(0);} - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return type(0);} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return type(0);} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return type(0);} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return type(0);} - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = false; - - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static _LIBCPP_CONSTEXPR const bool is_specialized = true; + + static _LIBCPP_CONSTEXPR const bool is_signed = false; + static _LIBCPP_CONSTEXPR const int digits = 1; + static _LIBCPP_CONSTEXPR const int digits10 = 0; + static _LIBCPP_CONSTEXPR const int max_digits10 = 0; + static _LIBCPP_CONSTEXPR const type __min = false; + static _LIBCPP_CONSTEXPR const type __max = true; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __min;} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __max;} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return min();} + + static _LIBCPP_CONSTEXPR const bool is_integer = true; + static _LIBCPP_CONSTEXPR const bool is_exact = true; + static _LIBCPP_CONSTEXPR const int radix = 2; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type(0);} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type(0);} + + static _LIBCPP_CONSTEXPR const int min_exponent = 0; + static _LIBCPP_CONSTEXPR const int min_exponent10 = 0; + static _LIBCPP_CONSTEXPR const int max_exponent = 0; + static _LIBCPP_CONSTEXPR const int max_exponent10 = 0; + + static _LIBCPP_CONSTEXPR const bool has_infinity = false; + static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false; + static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false; + static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent; + static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type(0);} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type(0);} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type(0);} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type(0);} + + static _LIBCPP_CONSTEXPR const bool is_iec559 = false; + static _LIBCPP_CONSTEXPR const bool is_bounded = true; + static _LIBCPP_CONSTEXPR const bool is_modulo = false; + + static _LIBCPP_CONSTEXPR const bool traps = false; + static _LIBCPP_CONSTEXPR const bool tinyness_before = false; + static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero; }; template <> @@ -288,44 +296,44 @@ class __libcpp_numeric_limits protected: typedef float type; - static const bool is_specialized = true; - - static const bool is_signed = true; - static const int digits = __FLT_MANT_DIG__; - static const int digits10 = __FLT_DIG__; - static const int max_digits10 = 2+(digits * 30103)/100000; - _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __FLT_MIN__;} - _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __FLT_MAX__;} - _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return -max();} - - static const bool is_integer = false; - static const bool is_exact = false; - static const int radix = __FLT_RADIX__; - _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __FLT_EPSILON__;} - _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return 0.5F;} - - static const int min_exponent = __FLT_MIN_EXP__; - static const int min_exponent10 = __FLT_MIN_10_EXP__; - static const int max_exponent = __FLT_MAX_EXP__; - static const int max_exponent10 = __FLT_MAX_10_EXP__; - - static const bool has_infinity = true; - static const bool has_quiet_NaN = true; - static const bool has_signaling_NaN = true; - static const float_denorm_style has_denorm = denorm_present; - static const bool has_denorm_loss = false; - _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __builtin_huge_valf();} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __builtin_nanf("");} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __builtin_nansf("");} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __FLT_DENORM_MIN__;} - - static const bool is_iec559 = true; - static const bool is_bounded = true; - static const bool is_modulo = false; - - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_to_nearest; + static _LIBCPP_CONSTEXPR const bool is_specialized = true; + + static _LIBCPP_CONSTEXPR const bool is_signed = true; + static _LIBCPP_CONSTEXPR const int digits = __FLT_MANT_DIG__; + static _LIBCPP_CONSTEXPR const int digits10 = __FLT_DIG__; + static _LIBCPP_CONSTEXPR const int max_digits10 = 2+(digits * 30103)/100000; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __FLT_MIN__;} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __FLT_MAX__;} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();} + + static _LIBCPP_CONSTEXPR const bool is_integer = false; + static _LIBCPP_CONSTEXPR const bool is_exact = false; + static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __FLT_EPSILON__;} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5F;} + + static _LIBCPP_CONSTEXPR const int min_exponent = __FLT_MIN_EXP__; + static _LIBCPP_CONSTEXPR const int min_exponent10 = __FLT_MIN_10_EXP__; + static _LIBCPP_CONSTEXPR const int max_exponent = __FLT_MAX_EXP__; + static _LIBCPP_CONSTEXPR const int max_exponent10 = __FLT_MAX_10_EXP__; + + static _LIBCPP_CONSTEXPR const bool has_infinity = true; + static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true; + static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true; + static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present; + static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_valf();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nanf("");} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansf("");} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __FLT_DENORM_MIN__;} + + static _LIBCPP_CONSTEXPR const bool is_iec559 = true; + static _LIBCPP_CONSTEXPR const bool is_bounded = true; + static _LIBCPP_CONSTEXPR const bool is_modulo = false; + + static _LIBCPP_CONSTEXPR const bool traps = false; + static _LIBCPP_CONSTEXPR const bool tinyness_before = false; + static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest; }; template <> @@ -334,44 +342,44 @@ class __libcpp_numeric_limits protected: typedef double type; - static const bool is_specialized = true; - - static const bool is_signed = true; - static const int digits = __DBL_MANT_DIG__; - static const int digits10 = __DBL_DIG__; - static const int max_digits10 = 2+(digits * 30103)/100000; - _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __DBL_MIN__;} - _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __DBL_MAX__;} - _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return -max();} - - static const bool is_integer = false; - static const bool is_exact = false; - static const int radix = __FLT_RADIX__; - _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __DBL_EPSILON__;} - _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return 0.5;} - - static const int min_exponent = __DBL_MIN_EXP__; - static const int min_exponent10 = __DBL_MIN_10_EXP__; - static const int max_exponent = __DBL_MAX_EXP__; - static const int max_exponent10 = __DBL_MAX_10_EXP__; - - static const bool has_infinity = true; - static const bool has_quiet_NaN = true; - static const bool has_signaling_NaN = true; - static const float_denorm_style has_denorm = denorm_present; - static const bool has_denorm_loss = false; - _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __builtin_huge_val();} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __builtin_nan("");} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __builtin_nans("");} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __DBL_DENORM_MIN__;} - - static const bool is_iec559 = true; - static const bool is_bounded = true; - static const bool is_modulo = false; - - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_to_nearest; + static _LIBCPP_CONSTEXPR const bool is_specialized = true; + + static _LIBCPP_CONSTEXPR const bool is_signed = true; + static _LIBCPP_CONSTEXPR const int digits = __DBL_MANT_DIG__; + static _LIBCPP_CONSTEXPR const int digits10 = __DBL_DIG__; + static _LIBCPP_CONSTEXPR const int max_digits10 = 2+(digits * 30103)/100000; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __DBL_MIN__;} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __DBL_MAX__;} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();} + + static _LIBCPP_CONSTEXPR const bool is_integer = false; + static _LIBCPP_CONSTEXPR const bool is_exact = false; + static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __DBL_EPSILON__;} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5;} + + static _LIBCPP_CONSTEXPR const int min_exponent = __DBL_MIN_EXP__; + static _LIBCPP_CONSTEXPR const int min_exponent10 = __DBL_MIN_10_EXP__; + static _LIBCPP_CONSTEXPR const int max_exponent = __DBL_MAX_EXP__; + static _LIBCPP_CONSTEXPR const int max_exponent10 = __DBL_MAX_10_EXP__; + + static _LIBCPP_CONSTEXPR const bool has_infinity = true; + static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true; + static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true; + static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present; + static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_val();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nan("");} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nans("");} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __DBL_DENORM_MIN__;} + + static _LIBCPP_CONSTEXPR const bool is_iec559 = true; + static _LIBCPP_CONSTEXPR const bool is_bounded = true; + static _LIBCPP_CONSTEXPR const bool is_modulo = false; + + static _LIBCPP_CONSTEXPR const bool traps = false; + static _LIBCPP_CONSTEXPR const bool tinyness_before = false; + static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest; }; template <> @@ -380,48 +388,48 @@ class __libcpp_numeric_limits protected: typedef long double type; - static const bool is_specialized = true; - - static const bool is_signed = true; - static const int digits = __LDBL_MANT_DIG__; - static const int digits10 = __LDBL_DIG__; - static const int max_digits10 = 2+(digits * 30103)/100000; - _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __LDBL_MIN__;} - _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __LDBL_MAX__;} - _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return -max();} - - static const bool is_integer = false; - static const bool is_exact = false; - static const int radix = __FLT_RADIX__; - _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;} - _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return 0.5;} - - static const int min_exponent = __LDBL_MIN_EXP__; - static const int min_exponent10 = __LDBL_MIN_10_EXP__; - static const int max_exponent = __LDBL_MAX_EXP__; - static const int max_exponent10 = __LDBL_MAX_10_EXP__; - - static const bool has_infinity = true; - static const bool has_quiet_NaN = true; - static const bool has_signaling_NaN = true; - static const float_denorm_style has_denorm = denorm_present; - static const bool has_denorm_loss = false; - _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __builtin_huge_vall();} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __builtin_nanl("");} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;} + static _LIBCPP_CONSTEXPR const bool is_specialized = true; + + static _LIBCPP_CONSTEXPR const bool is_signed = true; + static _LIBCPP_CONSTEXPR const int digits = __LDBL_MANT_DIG__; + static _LIBCPP_CONSTEXPR const int digits10 = __LDBL_DIG__; + static _LIBCPP_CONSTEXPR const int max_digits10 = 2+(digits * 30103)/100000; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __LDBL_MIN__;} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __LDBL_MAX__;} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();} + + static _LIBCPP_CONSTEXPR const bool is_integer = false; + static _LIBCPP_CONSTEXPR const bool is_exact = false; + static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5;} + + static _LIBCPP_CONSTEXPR const int min_exponent = __LDBL_MIN_EXP__; + static _LIBCPP_CONSTEXPR const int min_exponent10 = __LDBL_MIN_10_EXP__; + static _LIBCPP_CONSTEXPR const int max_exponent = __LDBL_MAX_EXP__; + static _LIBCPP_CONSTEXPR const int max_exponent10 = __LDBL_MAX_10_EXP__; + + static _LIBCPP_CONSTEXPR const bool has_infinity = true; + static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true; + static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true; + static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present; + static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_vall();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nanl("");} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;} #if (defined(__ppc__) || defined(__ppc64__)) - static const bool is_iec559 = false; + static _LIBCPP_CONSTEXPR const bool is_iec559 = false; #else - static const bool is_iec559 = true; + static _LIBCPP_CONSTEXPR const bool is_iec559 = true; #endif - static const bool is_bounded = true; - static const bool is_modulo = false; + static _LIBCPP_CONSTEXPR const bool is_bounded = true; + static _LIBCPP_CONSTEXPR const bool is_modulo = false; - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_to_nearest; + static _LIBCPP_CONSTEXPR const bool traps = false; + static _LIBCPP_CONSTEXPR const bool tinyness_before = false; + static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest; }; template @@ -431,45 +439,92 @@ class _LIBCPP_VISIBLE numeric_limits typedef __libcpp_numeric_limits::type> __base; typedef typename __base::type type; public: - static const bool is_specialized = __base::is_specialized; - _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();} - _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();} - _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();} - - static const int digits = __base::digits; - static const int digits10 = __base::digits10; - static const int max_digits10 = __base::max_digits10; - static const bool is_signed = __base::is_signed; - static const bool is_integer = __base::is_integer; - static const bool is_exact = __base::is_exact; - static const int radix = __base::radix; - _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();} - _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();} - - static const int min_exponent = __base::min_exponent; - static const int min_exponent10 = __base::min_exponent10; - static const int max_exponent = __base::max_exponent; - static const int max_exponent10 = __base::max_exponent10; - - static const bool has_infinity = __base::has_infinity; - static const bool has_quiet_NaN = __base::has_quiet_NaN; - static const bool has_signaling_NaN = __base::has_signaling_NaN; - static const float_denorm_style has_denorm = __base::has_denorm; - static const bool has_denorm_loss = __base::has_denorm_loss; - _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();} - - static const bool is_iec559 = __base::is_iec559; - static const bool is_bounded = __base::is_bounded; - static const bool is_modulo = __base::is_modulo; - - static const bool traps = __base::traps; - static const bool tinyness_before = __base::tinyness_before; - static const float_round_style round_style = __base::round_style; + static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();} + + static _LIBCPP_CONSTEXPR const int digits = __base::digits; + static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10; + static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10; + static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed; + static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer; + static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact; + static _LIBCPP_CONSTEXPR const int radix = __base::radix; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();} + + static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent; + static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10; + static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent; + static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10; + + static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity; + static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN; + static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN; + static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm; + static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();} + + static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559; + static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded; + static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo; + + static _LIBCPP_CONSTEXPR const bool traps = __base::traps; + static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before; + static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style; }; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_specialized; +template + _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits; +template + _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits10; +template + _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_digits10; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_signed; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_integer; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_exact; +template + _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::radix; +template + _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent; +template + _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent10; +template + _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent; +template + _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent10; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_infinity; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_quiet_NaN; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_signaling_NaN; +template + _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<_Tp>::has_denorm; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_denorm_loss; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_iec559; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_bounded; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_modulo; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::traps; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::tinyness_before; +template + _LIBCPP_CONSTEXPR const float_round_style numeric_limits<_Tp>::round_style; + template class _LIBCPP_VISIBLE numeric_limits : private numeric_limits<_Tp> @@ -477,45 +532,92 @@ class _LIBCPP_VISIBLE numeric_limits typedef numeric_limits<_Tp> __base; typedef _Tp type; public: - static const bool is_specialized = __base::is_specialized; - _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();} - _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();} - _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();} - - static const int digits = __base::digits; - static const int digits10 = __base::digits10; - static const int max_digits10 = __base::max_digits10; - static const bool is_signed = __base::is_signed; - static const bool is_integer = __base::is_integer; - static const bool is_exact = __base::is_exact; - static const int radix = __base::radix; - _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();} - _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();} - - static const int min_exponent = __base::min_exponent; - static const int min_exponent10 = __base::min_exponent10; - static const int max_exponent = __base::max_exponent; - static const int max_exponent10 = __base::max_exponent10; - - static const bool has_infinity = __base::has_infinity; - static const bool has_quiet_NaN = __base::has_quiet_NaN; - static const bool has_signaling_NaN = __base::has_signaling_NaN; - static const float_denorm_style has_denorm = __base::has_denorm; - static const bool has_denorm_loss = __base::has_denorm_loss; - _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();} - - static const bool is_iec559 = __base::is_iec559; - static const bool is_bounded = __base::is_bounded; - static const bool is_modulo = __base::is_modulo; - - static const bool traps = __base::traps; - static const bool tinyness_before = __base::tinyness_before; - static const float_round_style round_style = __base::round_style; + static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();} + + static _LIBCPP_CONSTEXPR const int digits = __base::digits; + static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10; + static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10; + static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed; + static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer; + static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact; + static _LIBCPP_CONSTEXPR const int radix = __base::radix; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();} + + static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent; + static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10; + static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent; + static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10; + + static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity; + static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN; + static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN; + static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm; + static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();} + + static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559; + static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded; + static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo; + + static _LIBCPP_CONSTEXPR const bool traps = __base::traps; + static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before; + static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style; }; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_specialized; +template + _LIBCPP_CONSTEXPR const int numeric_limits::digits; +template + _LIBCPP_CONSTEXPR const int numeric_limits::digits10; +template + _LIBCPP_CONSTEXPR const int numeric_limits::max_digits10; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_signed; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_integer; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_exact; +template + _LIBCPP_CONSTEXPR const int numeric_limits::radix; +template + _LIBCPP_CONSTEXPR const int numeric_limits::min_exponent; +template + _LIBCPP_CONSTEXPR const int numeric_limits::min_exponent10; +template + _LIBCPP_CONSTEXPR const int numeric_limits::max_exponent; +template + _LIBCPP_CONSTEXPR const int numeric_limits::max_exponent10; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_infinity; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_quiet_NaN; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_signaling_NaN; +template + _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits::has_denorm; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_denorm_loss; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_iec559; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_bounded; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_modulo; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::traps; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::tinyness_before; +template + _LIBCPP_CONSTEXPR const float_round_style numeric_limits::round_style; + template class _LIBCPP_VISIBLE numeric_limits : private numeric_limits<_Tp> @@ -523,45 +625,92 @@ class _LIBCPP_VISIBLE numeric_limits typedef numeric_limits<_Tp> __base; typedef _Tp type; public: - static const bool is_specialized = __base::is_specialized; - _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();} - _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();} - _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();} - - static const int digits = __base::digits; - static const int digits10 = __base::digits10; - static const int max_digits10 = __base::max_digits10; - static const bool is_signed = __base::is_signed; - static const bool is_integer = __base::is_integer; - static const bool is_exact = __base::is_exact; - static const int radix = __base::radix; - _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();} - _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();} - - static const int min_exponent = __base::min_exponent; - static const int min_exponent10 = __base::min_exponent10; - static const int max_exponent = __base::max_exponent; - static const int max_exponent10 = __base::max_exponent10; - - static const bool has_infinity = __base::has_infinity; - static const bool has_quiet_NaN = __base::has_quiet_NaN; - static const bool has_signaling_NaN = __base::has_signaling_NaN; - static const float_denorm_style has_denorm = __base::has_denorm; - static const bool has_denorm_loss = __base::has_denorm_loss; - _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();} - - static const bool is_iec559 = __base::is_iec559; - static const bool is_bounded = __base::is_bounded; - static const bool is_modulo = __base::is_modulo; - - static const bool traps = __base::traps; - static const bool tinyness_before = __base::tinyness_before; - static const float_round_style round_style = __base::round_style; + static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();} + + static _LIBCPP_CONSTEXPR const int digits = __base::digits; + static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10; + static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10; + static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed; + static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer; + static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact; + static _LIBCPP_CONSTEXPR const int radix = __base::radix; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();} + + static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent; + static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10; + static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent; + static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10; + + static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity; + static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN; + static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN; + static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm; + static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();} + + static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559; + static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded; + static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo; + + static _LIBCPP_CONSTEXPR const bool traps = __base::traps; + static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before; + static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style; }; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_specialized; +template + _LIBCPP_CONSTEXPR const int numeric_limits::digits; +template + _LIBCPP_CONSTEXPR const int numeric_limits::digits10; +template + _LIBCPP_CONSTEXPR const int numeric_limits::max_digits10; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_signed; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_integer; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_exact; +template + _LIBCPP_CONSTEXPR const int numeric_limits::radix; +template + _LIBCPP_CONSTEXPR const int numeric_limits::min_exponent; +template + _LIBCPP_CONSTEXPR const int numeric_limits::min_exponent10; +template + _LIBCPP_CONSTEXPR const int numeric_limits::max_exponent; +template + _LIBCPP_CONSTEXPR const int numeric_limits::max_exponent10; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_infinity; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_quiet_NaN; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_signaling_NaN; +template + _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits::has_denorm; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_denorm_loss; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_iec559; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_bounded; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_modulo; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::traps; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::tinyness_before; +template + _LIBCPP_CONSTEXPR const float_round_style numeric_limits::round_style; + template class _LIBCPP_VISIBLE numeric_limits : private numeric_limits<_Tp> @@ -569,45 +718,92 @@ class _LIBCPP_VISIBLE numeric_limits typedef numeric_limits<_Tp> __base; typedef _Tp type; public: - static const bool is_specialized = __base::is_specialized; - _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();} - _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();} - _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();} - - static const int digits = __base::digits; - static const int digits10 = __base::digits10; - static const int max_digits10 = __base::max_digits10; - static const bool is_signed = __base::is_signed; - static const bool is_integer = __base::is_integer; - static const bool is_exact = __base::is_exact; - static const int radix = __base::radix; - _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();} - _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();} - - static const int min_exponent = __base::min_exponent; - static const int min_exponent10 = __base::min_exponent10; - static const int max_exponent = __base::max_exponent; - static const int max_exponent10 = __base::max_exponent10; - - static const bool has_infinity = __base::has_infinity; - static const bool has_quiet_NaN = __base::has_quiet_NaN; - static const bool has_signaling_NaN = __base::has_signaling_NaN; - static const float_denorm_style has_denorm = __base::has_denorm; - static const bool has_denorm_loss = __base::has_denorm_loss; - _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();} - - static const bool is_iec559 = __base::is_iec559; - static const bool is_bounded = __base::is_bounded; - static const bool is_modulo = __base::is_modulo; - - static const bool traps = __base::traps; - static const bool tinyness_before = __base::tinyness_before; - static const float_round_style round_style = __base::round_style; + static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();} + + static _LIBCPP_CONSTEXPR const int digits = __base::digits; + static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10; + static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10; + static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed; + static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer; + static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact; + static _LIBCPP_CONSTEXPR const int radix = __base::radix; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();} + + static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent; + static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10; + static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent; + static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10; + + static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity; + static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN; + static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN; + static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm; + static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss; + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();} + _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();} + + static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559; + static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded; + static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo; + + static _LIBCPP_CONSTEXPR const bool traps = __base::traps; + static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before; + static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style; }; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_specialized; +template + _LIBCPP_CONSTEXPR const int numeric_limits::digits; +template + _LIBCPP_CONSTEXPR const int numeric_limits::digits10; +template + const int numeric_limits::max_digits10; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_signed; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_integer; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_exact; +template + _LIBCPP_CONSTEXPR const int numeric_limits::radix; +template + _LIBCPP_CONSTEXPR const int numeric_limits::min_exponent; +template + _LIBCPP_CONSTEXPR const int numeric_limits::min_exponent10; +template + _LIBCPP_CONSTEXPR const int numeric_limits::max_exponent; +template + _LIBCPP_CONSTEXPR const int numeric_limits::max_exponent10; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_infinity; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_quiet_NaN; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_signaling_NaN; +template + _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits::has_denorm; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_denorm_loss; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_iec559; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_bounded; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_modulo; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::traps; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::tinyness_before; +template + _LIBCPP_CONSTEXPR const float_round_style numeric_limits::round_style; + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_LIMITS diff --git a/system/include/libcxx/list b/system/include/libcxx/list index 900e2ec989771..8125886900147 100644 --- a/system/include/libcxx/list +++ b/system/include/libcxx/list @@ -176,7 +176,11 @@ template #include #include +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -209,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 @@ -225,8 +229,19 @@ class _LIBCPP_VISIBLE __list_iterator __node_pointer __ptr_; +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_INLINE_VISIBILITY + explicit __list_iterator(__node_pointer __p, const void* __c) _NOEXCEPT + : __ptr_(__p) + { + __get_db()->__insert_ic(this, __c); + } +#else _LIBCPP_INLINE_VISIBILITY explicit __list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {} +#endif + + template friend class list; template friend class __list_imp; @@ -245,25 +260,88 @@ public: typedef typename pointer_traits::difference_type difference_type; _LIBCPP_INLINE_VISIBILITY - __list_iterator() _NOEXCEPT {} + __list_iterator() _NOEXCEPT + { +#if _LIBCPP_DEBUG_LEVEL >= 2 + __get_db()->__insert_i(this); +#endif + } + +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_INLINE_VISIBILITY - reference operator*() const {return __ptr_->__value_;} + __list_iterator(const __list_iterator& __p) + : __ptr_(__p.__ptr_) + { + __get_db()->__iterator_copy(this, &__p); + } + + _LIBCPP_INLINE_VISIBILITY + ~__list_iterator() + { + __get_db()->__erase_i(this); + } + + _LIBCPP_INLINE_VISIBILITY + __list_iterator& operator=(const __list_iterator& __p) + { + if (this != &__p) + { + __get_db()->__iterator_copy(this, &__p); + __ptr_ = __p.__ptr_; + } + return *this; + } + +#endif // _LIBCPP_DEBUG_LEVEL >= 2 + + _LIBCPP_INLINE_VISIBILITY + reference operator*() const + { +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to dereference a non-dereferenceable list::iterator"); +#endif + return __ptr_->__value_; + } _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &(operator*());} _LIBCPP_INLINE_VISIBILITY - __list_iterator& operator++() {__ptr_ = __ptr_->__next_; return *this;} + __list_iterator& operator++() + { +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to increment non-incrementable list::iterator"); +#endif + __ptr_ = __ptr_->__next_; + return *this; + } _LIBCPP_INLINE_VISIBILITY __list_iterator operator++(int) {__list_iterator __t(*this); ++(*this); return __t;} _LIBCPP_INLINE_VISIBILITY - __list_iterator& operator--() {__ptr_ = __ptr_->__prev_; return *this;} + __list_iterator& operator--() + { +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_ASSERT(__get_const_db()->__decrementable(this), + "Attempted to decrement non-decrementable list::iterator"); +#endif + __ptr_ = __ptr_->__prev_; + return *this; + } _LIBCPP_INLINE_VISIBILITY __list_iterator operator--(int) {__list_iterator __t(*this); --(*this); return __t;} friend _LIBCPP_INLINE_VISIBILITY bool operator==(const __list_iterator& __x, const __list_iterator& __y) - {return __x.__ptr_ == __y.__ptr_;} + { +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y), + "Attempted to compare non-comparable list::iterator"); +#endif + return __x.__ptr_ == __y.__ptr_; + } friend _LIBCPP_INLINE_VISIBILITY bool operator!=(const __list_iterator& __x, const __list_iterator& __y) {return !(__x == __y);} @@ -281,8 +359,17 @@ class _LIBCPP_VISIBLE __list_const_iterator __node_pointer __ptr_; +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_INLINE_VISIBILITY + explicit __list_const_iterator(__node_pointer __p, const void* __c) _NOEXCEPT + : __ptr_(__p) + { + __get_db()->__insert_ic(this, __c); + } +#else _LIBCPP_INLINE_VISIBILITY explicit __list_const_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {} +#endif template friend class list; template friend class __list_imp; @@ -300,29 +387,95 @@ public: typedef typename pointer_traits::difference_type difference_type; _LIBCPP_INLINE_VISIBILITY - __list_const_iterator() _NOEXCEPT {} + __list_const_iterator() _NOEXCEPT + { +#if _LIBCPP_DEBUG_LEVEL >= 2 + __get_db()->__insert_i(this); +#endif + } _LIBCPP_INLINE_VISIBILITY __list_const_iterator(__list_iterator<_Tp, _VoidPtr> __p) _NOEXCEPT - : __ptr_(__p.__ptr_) {} + : __ptr_(__p.__ptr_) + { +#if _LIBCPP_DEBUG_LEVEL >= 2 + __get_db()->__iterator_copy(this, &__p); +#endif + } + +#if _LIBCPP_DEBUG_LEVEL >= 2 + + _LIBCPP_INLINE_VISIBILITY + __list_const_iterator(const __list_const_iterator& __p) + : __ptr_(__p.__ptr_) + { + __get_db()->__iterator_copy(this, &__p); + } + + _LIBCPP_INLINE_VISIBILITY + ~__list_const_iterator() + { + __get_db()->__erase_i(this); + } + + _LIBCPP_INLINE_VISIBILITY + __list_const_iterator& operator=(const __list_const_iterator& __p) + { + if (this != &__p) + { + __get_db()->__iterator_copy(this, &__p); + __ptr_ = __p.__ptr_; + } + return *this; + } +#endif // _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_INLINE_VISIBILITY - reference operator*() const {return __ptr_->__value_;} + reference operator*() const + { +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to dereference a non-dereferenceable list::const_iterator"); +#endif + return __ptr_->__value_; + } _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &(operator*());} _LIBCPP_INLINE_VISIBILITY - __list_const_iterator& operator++() {__ptr_ = __ptr_->__next_; return *this;} + __list_const_iterator& operator++() + { +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to increment non-incrementable list::const_iterator"); +#endif + __ptr_ = __ptr_->__next_; + return *this; + } _LIBCPP_INLINE_VISIBILITY __list_const_iterator operator++(int) {__list_const_iterator __t(*this); ++(*this); return __t;} _LIBCPP_INLINE_VISIBILITY - __list_const_iterator& operator--() {__ptr_ = __ptr_->__prev_; return *this;} + __list_const_iterator& operator--() + { +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_ASSERT(__get_const_db()->__decrementable(this), + "Attempted to decrement non-decrementable list::const_iterator"); +#endif + __ptr_ = __ptr_->__prev_; + return *this; + } _LIBCPP_INLINE_VISIBILITY __list_const_iterator operator--(int) {__list_const_iterator __t(*this); --(*this); return __t;} friend _LIBCPP_INLINE_VISIBILITY bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y) - {return __x.__ptr_ == __y.__ptr_;} + { +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y), + "Attempted to compare non-comparable list::const_iterator"); +#endif + return __x.__ptr_ == __y.__ptr_; + } friend _LIBCPP_INLINE_VISIBILITY bool operator!=(const __list_const_iterator& __x, const __list_const_iterator& __y) {return !(__x == __y);} @@ -383,17 +536,41 @@ protected: bool empty() const _NOEXCEPT {return __sz() == 0;} _LIBCPP_INLINE_VISIBILITY - iterator begin() _NOEXCEPT - {return iterator(__end_.__next_);} + iterator begin() _NOEXCEPT + { +#if _LIBCPP_DEBUG_LEVEL >= 2 + return iterator(__end_.__next_, this); +#else + return iterator(__end_.__next_); +#endif + } _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT - {return const_iterator(__end_.__next_);} + { +#if _LIBCPP_DEBUG_LEVEL >= 2 + return const_iterator(__end_.__next_, this); +#else + return const_iterator(__end_.__next_); +#endif + } _LIBCPP_INLINE_VISIBILITY - iterator end() _NOEXCEPT - {return iterator(static_cast<__node_pointer> (&__end_));} + iterator end() _NOEXCEPT + { +#if _LIBCPP_DEBUG_LEVEL >= 2 + return iterator(static_cast<__node_pointer>(&__end_), this); +#else + return iterator(static_cast<__node_pointer>(&__end_)); +#endif + } _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT - {return const_iterator(static_cast<__node_const_pointer>(&__end_));} + { +#if _LIBCPP_DEBUG_LEVEL >= 2 + return const_iterator(static_cast<__node_const_pointer>(&__end_), this); +#else + return const_iterator(static_cast<__node_const_pointer>(&__end_)); +#endif + } void swap(__list_imp& __c) _NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value || @@ -486,6 +663,9 @@ template __list_imp<_Tp, _Alloc>::~__list_imp() { clear(); +#if _LIBCPP_DEBUG_LEVEL >= 2 + __get_db()->__erase_c(this); +#endif } template @@ -495,17 +675,32 @@ __list_imp<_Tp, _Alloc>::clear() _NOEXCEPT if (!empty()) { __node_allocator& __na = __node_alloc(); - iterator __f = begin(); - iterator __l = end(); - __unlink_nodes(*__f.__ptr_, *__l.__ptr_->__prev_); + __node_pointer __f = __end_.__next_; + __node_pointer __l = static_cast<__node_pointer>(&__end_); + __unlink_nodes(*__f, *__l->__prev_); __sz() = 0; while (__f != __l) { - __node& __n = *__f.__ptr_; - ++__f; + __node& __n = *__f; + __f = __f->__next_; __node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_)); __node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1); } +#if _LIBCPP_DEBUG_LEVEL >= 2 + __c_node* __c = __get_db()->__find_c_and_lock(this); + for (__i_node** __p = __c->end_; __p != __c->beg_; ) + { + --__p; + const_iterator* __i = static_cast((*__p)->__i_); + if (__i->__ptr_ != __l) + { + (*__p)->__c_ = nullptr; + if (--__c->end_ != __p) + memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); + } + } + __get_db()->unlock(); +#endif } } @@ -515,6 +710,10 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c) _NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value) { + _LIBCPP_ASSERT(__alloc_traits::propagate_on_container_swap::value || + this->__node_alloc() == __c.__node_alloc(), + "list::swap: Either propagate_on_container_swap must be true" + " or the allocators must compare equal"); using _VSTD::swap; __swap_alloc(__node_alloc(), __c.__node_alloc()); swap(__sz(), __c.__sz()); @@ -530,6 +729,41 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c) else __c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = &static_cast<__node&>(__c.__end_); +#if _LIBCPP_DEBUG_LEVEL >= 2 + __libcpp_db* __db = __get_db(); + __c_node* __cn1 = __db->__find_c_and_lock(this); + __c_node* __cn2 = __db->__find_c(&__c); + std::swap(__cn1->beg_, __cn2->beg_); + std::swap(__cn1->end_, __cn2->end_); + std::swap(__cn1->cap_, __cn2->cap_); + for (__i_node** __p = __cn1->end_; __p != __cn1->beg_;) + { + --__p; + const_iterator* __i = static_cast((*__p)->__i_); + if (__i->__ptr_ == static_cast<__node_pointer>(&__c.__end_)) + { + __cn2->__add(*__p); + if (--__cn1->end_ != __p) + memmove(__p, __p+1, (__cn1->end_ - __p)*sizeof(__i_node*)); + } + else + (*__p)->__c_ = __cn1; + } + for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;) + { + --__p; + const_iterator* __i = static_cast((*__p)->__i_); + if (__i->__ptr_ == static_cast<__node_pointer>(&__end_)) + { + __cn1->__add(*__p); + if (--__cn2->end_ != __p) + memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*)); + } + else + (*__p)->__c_ = __cn2; + } + __db->unlock(); +#endif } template > @@ -561,9 +795,18 @@ public: _LIBCPP_INLINE_VISIBILITY list() _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) - {} + { +#if _LIBCPP_DEBUG_LEVEL >= 2 + __get_db()->__insert_c(this); +#endif + } _LIBCPP_INLINE_VISIBILITY - list(const allocator_type& __a) : base(__a) {} + list(const allocator_type& __a) : base(__a) + { +#if _LIBCPP_DEBUG_LEVEL >= 2 + __get_db()->__insert_c(this); +#endif + } list(size_type __n); list(size_type __n, const value_type& __x); list(size_type __n, const value_type& __x, const allocator_type& __a); @@ -649,13 +892,29 @@ public: {return const_reverse_iterator(begin());} _LIBCPP_INLINE_VISIBILITY - reference front() {return base::__end_.__next_->__value_;} + reference front() + { + _LIBCPP_ASSERT(!empty(), "list::front called on empty list"); + return base::__end_.__next_->__value_; + } _LIBCPP_INLINE_VISIBILITY - const_reference front() const {return base::__end_.__next_->__value_;} + const_reference front() const + { + _LIBCPP_ASSERT(!empty(), "list::front called on empty list"); + return base::__end_.__next_->__value_; + } _LIBCPP_INLINE_VISIBILITY - reference back() {return base::__end_.__prev_->__value_;} + reference back() + { + _LIBCPP_ASSERT(!empty(), "list::back called on empty list"); + return base::__end_.__prev_->__value_; + } _LIBCPP_INLINE_VISIBILITY - const_reference back() const {return base::__end_.__prev_->__value_;} + const_reference back() const + { + _LIBCPP_ASSERT(!empty(), "list::back called on empty list"); + return base::__end_.__prev_->__value_; + } #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES void push_front(value_type&& __x); @@ -743,6 +1002,17 @@ public: void reverse() _NOEXCEPT; + bool __invariants() const; + +#if _LIBCPP_DEBUG_LEVEL >= 2 + + bool __dereferenceable(const const_iterator* __i) const; + bool __decrementable(const const_iterator* __i) const; + bool __addable(const const_iterator* __i, ptrdiff_t __n) const; + bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const; + +#endif // _LIBCPP_DEBUG_LEVEL >= 2 + private: static void __link_nodes(__node& __p, __node& __f, __node& __l); iterator __iterator(size_type __n); @@ -778,6 +1048,9 @@ list<_Tp, _Alloc>::__iterator(size_type __n) template list<_Tp, _Alloc>::list(size_type __n) { +#if _LIBCPP_DEBUG_LEVEL >= 2 + __get_db()->__insert_c(this); +#endif for (; __n > 0; --__n) #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES emplace_back(); @@ -789,6 +1062,9 @@ list<_Tp, _Alloc>::list(size_type __n) template list<_Tp, _Alloc>::list(size_type __n, const value_type& __x) { +#if _LIBCPP_DEBUG_LEVEL >= 2 + __get_db()->__insert_c(this); +#endif for (; __n > 0; --__n) push_back(__x); } @@ -797,6 +1073,9 @@ template list<_Tp, _Alloc>::list(size_type __n, const value_type& __x, const allocator_type& __a) : base(__a) { +#if _LIBCPP_DEBUG_LEVEL >= 2 + __get_db()->__insert_c(this); +#endif for (; __n > 0; --__n) push_back(__x); } @@ -806,6 +1085,9 @@ template list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, typename enable_if<__is_input_iterator<_InpIter>::value>::type*) { +#if _LIBCPP_DEBUG_LEVEL >= 2 + __get_db()->__insert_c(this); +#endif for (; __f != __l; ++__f) push_back(*__f); } @@ -816,6 +1098,9 @@ list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a, typename enable_if<__is_input_iterator<_InpIter>::value>::type*) : base(__a) { +#if _LIBCPP_DEBUG_LEVEL >= 2 + __get_db()->__insert_c(this); +#endif for (; __f != __l; ++__f) push_back(*__f); } @@ -826,6 +1111,9 @@ list<_Tp, _Alloc>::list(const list& __c) __node_alloc_traits::select_on_container_copy_construction( __c.__node_alloc()))) { +#if _LIBCPP_DEBUG_LEVEL >= 2 + __get_db()->__insert_c(this); +#endif for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i) push_back(*__i); } @@ -834,6 +1122,9 @@ template list<_Tp, _Alloc>::list(const list& __c, const allocator_type& __a) : base(__a) { +#if _LIBCPP_DEBUG_LEVEL >= 2 + __get_db()->__insert_c(this); +#endif for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i) push_back(*__i); } @@ -844,6 +1135,9 @@ template list<_Tp, _Alloc>::list(initializer_list __il, const allocator_type& __a) : base(__a) { +#if _LIBCPP_DEBUG_LEVEL >= 2 + __get_db()->__insert_c(this); +#endif for (typename initializer_list::const_iterator __i = __il.begin(), __e = __il.end(); __i != __e; ++__i) push_back(*__i); @@ -852,6 +1146,9 @@ list<_Tp, _Alloc>::list(initializer_list __il, const allocator_type& template list<_Tp, _Alloc>::list(initializer_list __il) { +#if _LIBCPP_DEBUG_LEVEL >= 2 + __get_db()->__insert_c(this); +#endif for (typename initializer_list::const_iterator __i = __il.begin(), __e = __il.end(); __i != __e; ++__i) push_back(*__i); @@ -880,6 +1177,9 @@ list<_Tp, _Alloc>::list(list&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value) : base(allocator_type(_VSTD::move(__c.__node_alloc()))) { +#if _LIBCPP_DEBUG_LEVEL >= 2 + __get_db()->__insert_c(this); +#endif splice(end(), __c); } @@ -888,12 +1188,15 @@ inline _LIBCPP_INLINE_VISIBILITY list<_Tp, _Alloc>::list(list&& __c, const allocator_type& __a) : base(__a) { +#if _LIBCPP_DEBUG_LEVEL >= 2 + __get_db()->__insert_c(this); +#endif if (__a == __c.get_allocator()) splice(end(), __c); else { - typedef move_iterator _I; - assign(_I(__c.begin()), _I(__c.end())); + typedef move_iterator _Ip; + assign(_Ip(__c.begin()), _Ip(__c.end())); } } @@ -916,8 +1219,8 @@ list<_Tp, _Alloc>::__move_assign(list& __c, false_type) { if (base::__node_alloc() != __c.__node_alloc()) { - typedef move_iterator _I; - assign(_I(__c.begin()), _I(__c.end())); + typedef move_iterator _Ip; + assign(_Ip(__c.begin()), _Ip(__c.end())); } else __move_assign(__c, true_type()); @@ -977,9 +1280,14 @@ template typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x) { +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "list::insert(iterator, x) called with an iterator not" + " referring to this list"); +#endif __node_allocator& __na = base::__node_alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __hold->__prev_ = 0; __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); __link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold); @@ -991,17 +1299,28 @@ template typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& __x) { +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "list::insert(iterator, n, x) called with an iterator not" + " referring to this list"); + iterator __r(const_cast<__node_pointer>(__p.__ptr_), this); +#else iterator __r(const_cast<__node_pointer>(__p.__ptr_)); +#endif if (__n > 0) { size_type __ds = 0; __node_allocator& __na = base::__node_alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __hold->__prev_ = 0; __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); ++__ds; +#if _LIBCPP_DEBUG_LEVEL >= 2 + __r = iterator(__hold.get(), this); +#else __r = iterator(__hold.get()); +#endif __hold.release(); iterator __e = __r; #ifndef _LIBCPP_NO_EXCEPTIONS @@ -1027,7 +1346,11 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _ __node_alloc_traits::deallocate(__na, __e.__ptr_, 1); if (__prev == 0) break; +#if _LIBCPP_DEBUG_LEVEL >= 2 + __e = iterator(__prev, this); +#else __e = iterator(__prev); +#endif } throw; } @@ -1044,17 +1367,28 @@ typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l, typename enable_if<__is_input_iterator<_InpIter>::value>::type*) { +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "list::insert(iterator, range) called with an iterator not" + " referring to this list"); + iterator __r(const_cast<__node_pointer>(__p.__ptr_), this); +#else iterator __r(const_cast<__node_pointer>(__p.__ptr_)); +#endif if (__f != __l) { size_type __ds = 0; __node_allocator& __na = base::__node_alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __hold->__prev_ = 0; __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f); ++__ds; +#if _LIBCPP_DEBUG_LEVEL >= 2 + __r = iterator(__hold.get(), this); +#else __r = iterator(__hold.get()); +#endif __hold.release(); iterator __e = __r; #ifndef _LIBCPP_NO_EXCEPTIONS @@ -1080,7 +1414,11 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l, __node_alloc_traits::deallocate(__na, __e.__ptr_, 1); if (__prev == 0) break; +#if _LIBCPP_DEBUG_LEVEL >= 2 + __e = iterator(__prev, this); +#else __e = iterator(__prev); +#endif } throw; } @@ -1096,8 +1434,8 @@ void list<_Tp, _Alloc>::push_front(const value_type& __x) { __node_allocator& __na = base::__node_alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); __link_nodes(*base::__end_.__next_, *__hold, *__hold); ++base::__sz(); @@ -1109,8 +1447,8 @@ void list<_Tp, _Alloc>::push_back(const value_type& __x) { __node_allocator& __na = base::__node_alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); __link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold); ++base::__sz(); @@ -1124,8 +1462,8 @@ void list<_Tp, _Alloc>::push_front(value_type&& __x) { __node_allocator& __na = base::__node_alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x)); __link_nodes(*base::__end_.__next_, *__hold, *__hold); ++base::__sz(); @@ -1137,8 +1475,8 @@ void list<_Tp, _Alloc>::push_back(value_type&& __x) { __node_allocator& __na = base::__node_alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x)); __link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold); ++base::__sz(); @@ -1153,8 +1491,8 @@ void list<_Tp, _Alloc>::emplace_front(_Args&&... __args) { __node_allocator& __na = base::__node_alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...); __link_nodes(*base::__end_.__next_, *__hold, *__hold); ++base::__sz(); @@ -1167,8 +1505,8 @@ void list<_Tp, _Alloc>::emplace_back(_Args&&... __args) { __node_allocator& __na = base::__node_alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...); __link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold); ++base::__sz(); @@ -1181,13 +1519,17 @@ typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args) { __node_allocator& __na = base::__node_alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __hold->__prev_ = 0; __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...); __link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold); ++base::__sz(); +#if _LIBCPP_DEBUG_LEVEL >= 2 + return iterator(__hold.release(), this); +#else return iterator(__hold.release()); +#endif } #endif // _LIBCPP_HAS_NO_VARIADICS @@ -1196,14 +1538,23 @@ template typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x) { +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "list::insert(iterator, x) called with an iterator not" + " referring to this list"); +#endif __node_allocator& __na = base::__node_alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __hold->__prev_ = 0; __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x)); __link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold); ++base::__sz(); +#if _LIBCPP_DEBUG_LEVEL >= 2 + return iterator(__hold.release(), this); +#else return iterator(__hold.release()); +#endif } #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -1212,10 +1563,26 @@ template void list<_Tp, _Alloc>::pop_front() { + _LIBCPP_ASSERT(!empty(), "list::pop_front() called with empty list"); __node_allocator& __na = base::__node_alloc(); __node& __n = *base::__end_.__next_; base::__unlink_nodes(__n, __n); --base::__sz(); +#if _LIBCPP_DEBUG_LEVEL >= 2 + __c_node* __c = __get_db()->__find_c_and_lock(this); + for (__i_node** __p = __c->end_; __p != __c->beg_; ) + { + --__p; + iterator* __i = static_cast((*__p)->__i_); + if (__i->__ptr_ == &__n) + { + (*__p)->__c_ = nullptr; + if (--__c->end_ != __p) + memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); + } + } + __get_db()->unlock(); +#endif __node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_)); __node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1); } @@ -1224,10 +1591,26 @@ template void list<_Tp, _Alloc>::pop_back() { + _LIBCPP_ASSERT(!empty(), "list::pop_front() called with empty list"); __node_allocator& __na = base::__node_alloc(); __node& __n = *base::__end_.__prev_; base::__unlink_nodes(__n, __n); --base::__sz(); +#if _LIBCPP_DEBUG_LEVEL >= 2 + __c_node* __c = __get_db()->__find_c_and_lock(this); + for (__i_node** __p = __c->end_; __p != __c->beg_; ) + { + --__p; + iterator* __i = static_cast((*__p)->__i_); + if (__i->__ptr_ == &__n) + { + (*__p)->__c_ = nullptr; + if (--__c->end_ != __p) + memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); + } + } + __get_db()->unlock(); +#endif __node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_)); __node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1); } @@ -1236,20 +1619,49 @@ template typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::erase(const_iterator __p) { +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "list::erase(iterator) called with an iterator not" + " referring to this list"); +#endif __node_allocator& __na = base::__node_alloc(); __node& __n = const_cast<__node&>(*__p.__ptr_); __node_pointer __r = __n.__next_; base::__unlink_nodes(__n, __n); --base::__sz(); +#if _LIBCPP_DEBUG_LEVEL >= 2 + __c_node* __c = __get_db()->__find_c_and_lock(this); + for (__i_node** __p = __c->end_; __p != __c->beg_; ) + { + --__p; + iterator* __i = static_cast((*__p)->__i_); + if (__i->__ptr_ == &__n) + { + (*__p)->__c_ = nullptr; + if (--__c->end_ != __p) + memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); + } + } + __get_db()->unlock(); +#endif __node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_)); __node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1); +#if _LIBCPP_DEBUG_LEVEL >= 2 + return iterator(__r, this); +#else return iterator(__r); +#endif } template typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l) { +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__f) == this, + "list::erase(iterator, iterator) called with an iterator not" + " referring to this list"); +#endif if (__f != __l) { __node_allocator& __na = base::__node_alloc(); @@ -1259,11 +1671,30 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l) __node& __n = const_cast<__node&>(*__f.__ptr_); ++__f; --base::__sz(); +#if _LIBCPP_DEBUG_LEVEL >= 2 + __c_node* __c = __get_db()->__find_c_and_lock(this); + for (__i_node** __p = __c->end_; __p != __c->beg_; ) + { + --__p; + iterator* __i = static_cast((*__p)->__i_); + if (__i->__ptr_ == &__n) + { + (*__p)->__c_ = nullptr; + if (--__c->end_ != __p) + memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); + } + } + __get_db()->unlock(); +#endif __node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_)); __node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1); } } +#if _LIBCPP_DEBUG_LEVEL >= 2 + return iterator(const_cast<__node_pointer>(__l.__ptr_), this); +#else return iterator(const_cast<__node_pointer>(__l.__ptr_)); +#endif } template @@ -1277,12 +1708,16 @@ list<_Tp, _Alloc>::resize(size_type __n) __n -= base::__sz(); size_type __ds = 0; __node_allocator& __na = base::__node_alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __hold->__prev_ = 0; __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_)); ++__ds; +#if _LIBCPP_DEBUG_LEVEL >= 2 + iterator __r = iterator(__hold.release(), this); +#else iterator __r = iterator(__hold.release()); +#endif iterator __e = __r; #ifndef _LIBCPP_NO_EXCEPTIONS try @@ -1307,7 +1742,11 @@ list<_Tp, _Alloc>::resize(size_type __n) __node_alloc_traits::deallocate(__na, __e.__ptr_, 1); if (__prev == 0) break; +#if _LIBCPP_DEBUG_LEVEL >= 2 + __e = iterator(__prev, this); +#else __e = iterator(__prev); +#endif } throw; } @@ -1328,12 +1767,16 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x) __n -= base::__sz(); size_type __ds = 0; __node_allocator& __na = base::__node_alloc(); - typedef __allocator_destructor<__node_allocator> _D; - unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1)); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __hold->__prev_ = 0; __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); ++__ds; +#if _LIBCPP_DEBUG_LEVEL >= 2 + iterator __r = iterator(__hold.release(), this); +#else iterator __r = iterator(__hold.release()); +#endif iterator __e = __r; #ifndef _LIBCPP_NO_EXCEPTIONS try @@ -1358,7 +1801,11 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x) __node_alloc_traits::deallocate(__na, __e.__ptr_, 1); if (__prev == 0) break; +#if _LIBCPP_DEBUG_LEVEL >= 2 + __e = iterator(__prev, this); +#else __e = iterator(__prev); +#endif } throw; } @@ -1372,6 +1819,13 @@ template void list<_Tp, _Alloc>::splice(const_iterator __p, list& __c) { + _LIBCPP_ASSERT(this != &__c, + "list::splice(iterator, list) called with this == &list"); +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "list::splice(iterator, list) called with an iterator not" + " referring to this list"); +#endif if (!__c.empty()) { __node& __f = *__c.__end_.__next_; @@ -1380,6 +1834,24 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c) __link_nodes(const_cast<__node&>(*__p.__ptr_), __f, __l); base::__sz() += __c.__sz(); __c.__sz() = 0; +#if _LIBCPP_DEBUG_LEVEL >= 2 + __libcpp_db* __db = __get_db(); + __c_node* __cn1 = __db->__find_c_and_lock(this); + __c_node* __cn2 = __db->__find_c(&__c); + for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;) + { + --__p; + iterator* __i = static_cast((*__p)->__i_); + if (__i->__ptr_ != static_cast<__node_pointer>(&__c.__end_)) + { + __cn1->__add(*__p); + (*__p)->__c_ = __cn1; + if (--__cn2->end_ != __p) + memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*)); + } + } + __db->unlock(); +#endif } } @@ -1387,13 +1859,42 @@ template void list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i) { - if (__p != __i && __p != _VSTD::next(__i)) +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "list::splice(iterator, list, iterator) called with first iterator not" + " referring to this list"); + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__i) == &__c, + "list::splice(iterator, list, iterator) called with second iterator not" + " referring to list argument"); + _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(&__i), + "list::splice(iterator, list, iterator) called with second iterator not" + " derefereceable"); +#endif + if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_) { __node& __f = const_cast<__node&>(*__i.__ptr_); base::__unlink_nodes(__f, __f); __link_nodes(const_cast<__node&>(*__p.__ptr_), __f, __f); --__c.__sz(); ++base::__sz(); +#if _LIBCPP_DEBUG_LEVEL >= 2 + __libcpp_db* __db = __get_db(); + __c_node* __cn1 = __db->__find_c_and_lock(this); + __c_node* __cn2 = __db->__find_c(&__c); + for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;) + { + --__p; + iterator* __j = static_cast((*__p)->__i_); + if (__j->__ptr_ == &__f) + { + __cn1->__add(*__p); + (*__p)->__c_ = __cn1; + if (--__cn2->end_ != __p) + memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*)); + } + } + __db->unlock(); +#endif } } @@ -1401,6 +1902,22 @@ template void list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l) { +#if _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "list::splice(iterator, list, iterator, iterator) called with first iterator not" + " referring to this list"); + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__f) == &__c, + "list::splice(iterator, list, iterator, iterator) called with second iterator not" + " referring to list argument"); + if (this == &__c) + { + for (const_iterator __i = __f; __i != __l; ++__i) + _LIBCPP_ASSERT(__i != __p, + "list::splice(iterator, list, iterator, iterator)" + " called with the first iterator within the range" + " of the second and third iterators"); + } +#endif if (__f != __l) { if (this != &__c) @@ -1414,6 +1931,28 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con __node& __last = const_cast<__node&>(*__l.__ptr_); base::__unlink_nodes(__first, __last); __link_nodes(const_cast<__node&>(*__p.__ptr_), __first, __last); +#if _LIBCPP_DEBUG_LEVEL >= 2 + __libcpp_db* __db = __get_db(); + __c_node* __cn1 = __db->__find_c_and_lock(this); + __c_node* __cn2 = __db->__find_c(&__c); + for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;) + { + --__p; + iterator* __j = static_cast((*__p)->__i_); + for (__node_pointer __k = const_cast<__node_pointer>(__f.__ptr_); + __k != __l.__ptr_; __k = __k->__next_) + { + if (__j->__ptr_ == __k) + { + __cn1->__add(*__p); + (*__p)->__c_ = __cn1; + if (--__cn2->end_ != __p) + memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*)); + } + } + } + __db->unlock(); +#endif } } @@ -1518,6 +2057,24 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp) ++__f1; } splice(__e1, __c); +#if _LIBCPP_DEBUG_LEVEL >= 2 + __libcpp_db* __db = __get_db(); + __c_node* __cn1 = __db->__find_c_and_lock(this); + __c_node* __cn2 = __db->__find_c(&__c); + for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;) + { + --__p; + iterator* __i = static_cast((*__p)->__i_); + if (__i->__ptr_ != static_cast<__node_pointer>(&__c.__end_)) + { + __cn1->__add(*__p); + (*__p)->__c_ = __cn1; + if (--__cn2->end_ != __p) + memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*)); + } + } + __db->unlock(); +#endif } } @@ -1608,12 +2165,54 @@ list<_Tp, _Alloc>::reverse() _NOEXCEPT if (base::__sz() > 1) { iterator __e = end(); - for (iterator __i = begin(); __i != __e; --__i) + for (iterator __i = begin(); __i.__ptr_ != __e.__ptr_;) + { _VSTD::swap(__i.__ptr_->__prev_, __i.__ptr_->__next_); + __i.__ptr_ = __i.__ptr_->__prev_; + } _VSTD::swap(__e.__ptr_->__prev_, __e.__ptr_->__next_); } } +template +bool +list<_Tp, _Alloc>::__invariants() const +{ + return size() == _VSTD::distance(begin(), end()); +} + +#if _LIBCPP_DEBUG_LEVEL >= 2 + +template +bool +list<_Tp, _Alloc>::__dereferenceable(const const_iterator* __i) const +{ + return __i->__ptr_ != &this->__end_; +} + +template +bool +list<_Tp, _Alloc>::__decrementable(const const_iterator* __i) const +{ + return !empty() && __i->__ptr_ != base::__end_.__next_; +} + +template +bool +list<_Tp, _Alloc>::__addable(const const_iterator* __i, ptrdiff_t __n) const +{ + return false; +} + +template +bool +list<_Tp, _Alloc>::__subscriptable(const const_iterator* __i, ptrdiff_t __n) const +{ + return false; +} + +#endif // _LIBCPP_DEBUG_LEVEL >= 2 + template inline _LIBCPP_INLINE_VISIBILITY bool diff --git a/system/include/libcxx/locale b/system/include/libcxx/locale index e9a18e321268e..8325921487cb7 100644 --- a/system/include/libcxx/locale +++ b/system/include/libcxx/locale @@ -187,28 +187,42 @@ template class messages_byname; #include #include #if _WIN32 -#include // vasprintf +#include #else // _WIN32 #include #endif // !_WIN32 +#if __APPLE__ +#include +#endif + +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD -#ifndef _LIBCPP_STABLE_APPLE_ABI -// Get the C locale object -locale_t __cloc(); +#if __APPLE__ || __FreeBSD__ +# define _LIBCPP_GET_C_LOCALE 0 +#else +# define _LIBCPP_GET_C_LOCALE __cloc() + // Get the C locale object + locale_t __cloc(); +#define __cloc_defined #endif typedef _VSTD::remove_pointer::type __locale_struct; typedef _VSTD::unique_ptr<__locale_struct, decltype(&freelocale)> __locale_unique_ptr; +#ifndef _LIBCPP_LOCALE__L_EXTENSIONS typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii; +#endif // OSX has nice foo_l() functions that let you turn off use of the global // locale. Linux, not so much. The following functions avoid the locale when // that's possible and otherwise do the wrong thing. FIXME. -#ifndef _LIBCPP_STABLE_APPLE_ABI +#if defined(__linux__) || defined(EMSCRIPTEN) #ifdef _LIBCPP_LOCALE__L_EXTENSIONS decltype(MB_CUR_MAX_L(_VSTD::declval())) @@ -229,7 +243,7 @@ decltype(MB_CUR_MAX) __mb_cur_max_l(locale_t __l) _LIBCPP_ALWAYS_INLINE inline wint_t __btowc_l(int __c, locale_t __l) { -#ifdef _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS return btowc_l(__c, __l); #else __locale_raii __current(uselocale(__l), uselocale); @@ -340,7 +354,7 @@ size_t __mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len, #endif } -_LIBCPP_ALWAYS_INLINE inline +inline int __sprintf_l(char *__s, locale_t __l, const char *__format, ...) { va_list __va; va_start(__va, __format); @@ -354,7 +368,7 @@ int __sprintf_l(char *__s, locale_t __l, const char *__format, ...) { return __res; } -_LIBCPP_ALWAYS_INLINE inline +inline int __snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) { va_list __va; va_start(__va, __format); @@ -368,7 +382,7 @@ int __snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) return __res; } -_LIBCPP_ALWAYS_INLINE inline +inline int __asprintf_l(char **__s, locale_t __l, const char *__format, ...) { va_list __va; va_start(__va, __format); @@ -382,7 +396,7 @@ int __asprintf_l(char **__s, locale_t __l, const char *__format, ...) { return __res; } -_LIBCPP_ALWAYS_INLINE inline +inline int __sscanf_l(const char *__s, locale_t __l, const char *__format, ...) { va_list __va; va_start(__va, __format); @@ -396,7 +410,7 @@ int __sscanf_l(const char *__s, locale_t __l, const char *__format, ...) { return __res; } -#endif // _LIBCPP_STABLE_APPLE_ABI +#endif // __linux__ // __scan_keyword // Scans [__b, __e) until a match is found in the basic_strings range @@ -425,7 +439,7 @@ __scan_keyword(_InputIterator& __b, _InputIterator __e, bool __case_sensitive = true) { typedef typename iterator_traits<_InputIterator>::value_type _CharT; - size_t __nkw = _VSTD::distance(__kb, __ke); + size_t __nkw = static_cast(_VSTD::distance(__kb, __ke)); const unsigned char __doesnt_match = '\0'; const unsigned char __might_match = '\1'; const unsigned char __does_match = '\2'; @@ -590,7 +604,7 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __dc = 0; return 0; } - if (__ct == __thousands_sep && __grouping.size() != 0) + if (__grouping.size() != 0 && __ct == __thousands_sep) { if (__g_end-__g < __num_get_buf_sz) { @@ -657,6 +671,15 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex if (__f >= 32) return -1; char __x = __src[__f]; + if (__x == '-' || __x == '+') + { + if (__a_end == __a || (__a_end[-1] & 0xDF) == __exp) + { + *__a_end++ = __x; + return 0; + } + return -1; + } if (__a_end-__a < __num_get_buf_sz - 1) *__a_end++ = __x; if (__x == 'x' || __x == 'X') @@ -673,8 +696,8 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex return 0; } -extern template class __num_get; -extern template class __num_get; +_LIBCPP_EXTERN_TEMPLATE(struct __num_get) +_LIBCPP_EXTERN_TEMPLATE(struct __num_get) template > class _LIBCPP_VISIBLE num_get @@ -807,15 +830,11 @@ __num_get_signed_integral(const char* __a, const char* __a_end, { if (__a != __a_end) { - int __save_errno = errno; + typename remove_reference::type __save_errno = errno; errno = 0; char *__p2; -#ifdef _LIBCPP_STABLE_APPLE_ABI - long long __ll = strtoll_l(__a, &__p2, __base, 0); -#else - long long __ll = strtoll_l(__a, &__p2, __base, __cloc()); -#endif - int __current_errno = errno; + long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE); + typename remove_reference::type __current_errno = errno; if (__current_errno == 0) errno = __save_errno; if (__p2 != __a_end) @@ -851,15 +870,11 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end, __err = ios_base::failbit; return 0; } - int __save_errno = errno; + typename remove_reference::type __save_errno = errno; errno = 0; char *__p2; -#ifdef _LIBCPP_STABLE_APPLE_ABI - unsigned long long __ll = strtoull_l(__a, &__p2, __base, 0); -#else - unsigned long long __ll = strtoull_l(__a, &__p2, __base, __cloc()); -#endif - int __current_errno = errno; + unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE); + typename remove_reference::type __current_errno = errno; if (__current_errno == 0) errno = __save_errno; if (__p2 != __a_end) @@ -886,11 +901,7 @@ __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err) if (__a != __a_end) { char *__p2; -#ifdef _LIBCPP_STABLE_APPLE_ABI - long double __ld = strtold_l(__a, &__p2, 0); -#else - long double __ld = strtold_l(__a, &__p2, __cloc()); -#endif + long double __ld = strtold_l(__a, &__p2, _LIBCPP_GET_C_LOCALE); if (__p2 != __a_end) { __err = ios_base::failbit; @@ -1279,7 +1290,7 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, int __base = 16; // Stage 2 char_type __atoms[26]; - char_type __thousands_sep; + char_type __thousands_sep = 0; string __grouping; use_facet >(__iob.getloc()).widen(__num_get_base::__src, __num_get_base::__src + 26, __atoms); @@ -1295,8 +1306,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, break; // Stage 3 __a[sizeof(__a)-1] = 0; -#ifdef _LIBCPP_STABLE_APPLE_ABI - if (sscanf_l(__a, 0, "%p", &__v) != 1) +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + if (sscanf_l(__a, _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1) #else if (__sscanf_l(__a, __cloc(), "%p", &__v) != 1) #endif @@ -1307,8 +1318,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, return __b; } -extern template class num_get; -extern template class num_get; +_LIBCPP_EXTERN_TEMPLATE(class num_get) +_LIBCPP_EXTERN_TEMPLATE(class num_get) struct __num_put_base { @@ -1404,21 +1415,13 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne, *__oe++ = __ct.widen(*__nf++); *__oe++ = __ct.widen(*__nf++); for (__ns = __nf; __ns < __ne; ++__ns) -#ifdef _LIBCPP_STABLE_APPLE_ABI - if (!isxdigit_l(*__ns, 0)) -#else - if (!isxdigit_l(*__ns, __cloc())) -#endif + if (!isxdigit_l(*__ns, _LIBCPP_GET_C_LOCALE)) break; } else { for (__ns = __nf; __ns < __ne; ++__ns) -#ifdef _LIBCPP_STABLE_APPLE_ABI - if (!isdigit_l(*__ns, 0)) -#else - if (!isdigit_l(*__ns, __cloc())) -#endif + if (!isdigit_l(*__ns, _LIBCPP_GET_C_LOCALE)) break; } if (__grouping.empty()) @@ -1465,8 +1468,8 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne, __op = __ob + (__np - __nb); } -extern template class __num_put; -extern template class __num_put; +_LIBCPP_EXTERN_TEMPLATE(struct __num_put) +_LIBCPP_EXTERN_TEMPLATE(struct __num_put) template > class _LIBCPP_VISIBLE num_put @@ -1588,6 +1591,58 @@ __pad_and_output(_OutputIterator __s, return __s; } +#if !defined(__APPLE__) || \ + (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \ + (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0) + +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; +} + +#endif + template _OutputIterator num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, @@ -1616,8 +1671,8 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, + ((numeric_limits::digits % 3) != 0) + 1; char __nar[__nbuf]; -#ifdef _LIBCPP_STABLE_APPLE_ABI - int __nc = sprintf_l(__nar, 0, __fmt, __v); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v); #else int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v); #endif @@ -1646,8 +1701,8 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, + ((numeric_limits::digits % 3) != 0) + 1; char __nar[__nbuf]; -#ifdef _LIBCPP_STABLE_APPLE_ABI - int __nc = sprintf_l(__nar, 0, __fmt, __v); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v); #else int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v); #endif @@ -1676,8 +1731,8 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, + ((numeric_limits::digits % 3) != 0) + 1; char __nar[__nbuf]; -#ifdef _LIBCPP_STABLE_APPLE_ABI - int __nc = sprintf_l(__nar, 0, __fmt, __v); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v); #else int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v); #endif @@ -1706,8 +1761,8 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, + ((numeric_limits::digits % 3) != 0) + 1; char __nar[__nbuf]; -#ifdef _LIBCPP_STABLE_APPLE_ABI - int __nc = sprintf_l(__nar, 0, __fmt, __v); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v); #else int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v); #endif @@ -1737,16 +1792,16 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char* __nb = __nar; int __nc; if (__specify_precision) -#ifdef _LIBCPP_STABLE_APPLE_ABI - __nc = snprintf_l(__nb, __nbuf, 0, __fmt, +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + __nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v); #else __nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, (int)__iob.precision(), __v); #endif else -#ifdef _LIBCPP_STABLE_APPLE_ABI - __nc = snprintf_l(__nb, __nbuf, 0, __fmt, __v); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + __nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v); #else __nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v); #endif @@ -1754,15 +1809,15 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, if (__nc > static_cast(__nbuf-1)) { if (__specify_precision) -#ifdef _LIBCPP_STABLE_APPLE_ABI - __nc = asprintf_l(&__nb, 0, __fmt, (int)__iob.precision(), __v); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + __nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v); #else __nc = __asprintf_l(&__nb, __cloc(), __fmt, (int)__iob.precision(), __v); #endif else -#ifdef _LIBCPP_STABLE_APPLE_ABI - __nc = asprintf_l(&__nb, 0, __fmt, __v); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + __nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v); #else __nc = __asprintf_l(&__nb, __cloc(), __fmt, (int)__iob.precision(), __v); #endif @@ -1778,7 +1833,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, unique_ptr __obh(0, free); if (__nb != __nar) { - __ob = (char_type*)malloc((2*__nc)*sizeof(char_type)); + __ob = (char_type*)malloc(2*static_cast(__nc)*sizeof(char_type)); if (__ob == 0) __throw_bad_alloc(); __obh.reset(__ob); @@ -1806,16 +1861,16 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char* __nb = __nar; int __nc; if (__specify_precision) -#ifdef _LIBCPP_STABLE_APPLE_ABI - __nc = snprintf_l(__nb, __nbuf, 0, __fmt, +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + __nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v); #else __nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, (int)__iob.precision(), __v); #endif else -#ifdef _LIBCPP_STABLE_APPLE_ABI - __nc = snprintf_l(__nb, __nbuf, 0, __fmt, __v); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + __nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v); #else __nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v); #endif @@ -1823,15 +1878,15 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, if (__nc > static_cast(__nbuf-1)) { if (__specify_precision) -#ifdef _LIBCPP_STABLE_APPLE_ABI - __nc = asprintf_l(&__nb, 0, __fmt, (int)__iob.precision(), __v); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + __nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v); #else __nc = __asprintf_l(&__nb, __cloc(), __fmt, (int)__iob.precision(), __v); #endif else -#ifdef _LIBCPP_STABLE_APPLE_ABI - __nc = asprintf_l(&__nb, 0, __fmt, __v); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + __nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v); #else __nc = __asprintf_l(&__nb, __cloc(), __fmt, __v); #endif @@ -1847,7 +1902,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, unique_ptr __obh(0, free); if (__nb != __nar) { - __ob = (char_type*)malloc((2*__nc)*sizeof(char_type)); + __ob = (char_type*)malloc(2*static_cast(__nc)*sizeof(char_type)); if (__ob == 0) __throw_bad_alloc(); __obh.reset(__ob); @@ -1870,8 +1925,8 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char __fmt[6] = "%p"; const unsigned __nbuf = 20; char __nar[__nbuf]; -#ifdef _LIBCPP_STABLE_APPLE_ABI - int __nc = sprintf_l(__nar, 0, __fmt, __v); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v); #else int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v); #endif @@ -1893,8 +1948,8 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); } -extern template class num_put; -extern template class num_put; +_LIBCPP_EXTERN_TEMPLATE(class num_put) +_LIBCPP_EXTERN_TEMPLATE(class num_put) template _LIBCPP_HIDDEN @@ -2114,7 +2169,7 @@ time_get<_CharT, _InputIterator>::__get_weekdayname(int& __w, { // Note: ignoring case comes from the POSIX strptime spec const string_type* __wk = this->__weeks(); - int __i = __scan_keyword(__b, __e, __wk, __wk+14, __ct, __err, false) - __wk; + ptrdiff_t __i = __scan_keyword(__b, __e, __wk, __wk+14, __ct, __err, false) - __wk; if (__i < 14) __w = __i % 7; } @@ -2128,7 +2183,7 @@ time_get<_CharT, _InputIterator>::__get_monthname(int& __m, { // Note: ignoring case comes from the POSIX strptime spec const string_type* __month = this->__months(); - int __i = __scan_keyword(__b, __e, __month, __month+24, __ct, __err, false) - __month; + ptrdiff_t __i = __scan_keyword(__b, __e, __month, __month+24, __ct, __err, false) - __month; if (__i < 24) __m = __i % 12; } @@ -2300,7 +2355,7 @@ time_get<_CharT, _InputIterator>::__get_am_pm(int& __h, __err |= ios_base::failbit; return; } - int __i = __scan_keyword(__b, __e, __ap, __ap+2, __ct, __err, false) - __ap; + ptrdiff_t __i = __scan_keyword(__b, __e, __ap, __ap+2, __ct, __err, false) - __ap; if (__i == 0 && __h == 12) __h = 0; else if (__i == 1 && __h < 12) @@ -2409,7 +2464,6 @@ time_get<_CharT, _InputIterator>::do_get_date(iter_type __b, iter_type __e, ios_base::iostate& __err, tm* __tm) const { - const ctype& __ct = use_facet >(__iob.getloc()); const string_type& __fmt = this->__x(); return get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size()); } @@ -2472,8 +2526,8 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, break; case 'c': { - const string_type& __fmt = this->__c(); - __b = get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size()); + const string_type& __fm = this->__c(); + __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size()); } break; case 'd': @@ -2482,14 +2536,14 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, break; case 'D': { - const char_type __fmt[] = {'%', 'm', '/', '%', 'd', '/', '%', 'y'}; - __b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0])); + const char_type __fm[] = {'%', 'm', '/', '%', 'd', '/', '%', 'y'}; + __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0])); } break; case 'F': { - const char_type __fmt[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'}; - __b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0])); + const char_type __fm[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'}; + __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0])); } break; case 'H': @@ -2516,14 +2570,14 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, break; case 'r': { - const char_type __fmt[] = {'%', 'I', ':', '%', 'M', ':', '%', 'S', ' ', '%', 'p'}; - __b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0])); + const char_type __fm[] = {'%', 'I', ':', '%', 'M', ':', '%', 'S', ' ', '%', 'p'}; + __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0])); } break; case 'R': { - const char_type __fmt[] = {'%', 'H', ':', '%', 'M'}; - __b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0])); + const char_type __fm[] = {'%', 'H', ':', '%', 'M'}; + __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0])); } break; case 'S': @@ -2531,8 +2585,8 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, break; case 'T': { - const char_type __fmt[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'}; - __b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0])); + const char_type __fm[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'}; + __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0])); } break; case 'w': @@ -2542,8 +2596,8 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, return do_get_date(__b, __e, __iob, __err, __tm); case 'X': { - const string_type& __fmt = this->__X(); - __b = get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size()); + const string_type& __fm = this->__X(); + __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size()); } break; case 'y': @@ -2561,8 +2615,8 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, return __b; } -extern template class time_get; -extern template class time_get; +_LIBCPP_EXTERN_TEMPLATE(class time_get) +_LIBCPP_EXTERN_TEMPLATE(class time_get) class __time_get { @@ -2644,18 +2698,14 @@ private: virtual const string_type& __X() const {return this->__X_;} }; -extern template class time_get_byname; -extern template class time_get_byname; +_LIBCPP_EXTERN_TEMPLATE(class time_get_byname) +_LIBCPP_EXTERN_TEMPLATE(class time_get_byname) class __time_put { locale_t __loc_; protected: -#ifdef _LIBCPP_STABLE_APPLE_ABI - _LIBCPP_ALWAYS_INLINE __time_put() : __loc_(0) {} -#else // _LIBCPP_STABLE_APPLE_ABI - _LIBCPP_ALWAYS_INLINE __time_put() : __loc_(__cloc()) {} -#endif // _LIBCPP_STABLE_APPLE_ABI + _LIBCPP_ALWAYS_INLINE __time_put() : __loc_(_LIBCPP_GET_C_LOCALE) {} __time_put(const char* __nm); __time_put(const string& __nm); ~__time_put(); @@ -2750,7 +2800,7 @@ time_put<_CharT, _OutputIterator>::put(iter_type __s, ios_base& __iob, template _OutputIterator -time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, +time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base&, char_type, const tm* __tm, char __fmt, char __mod) const { @@ -2761,8 +2811,8 @@ time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, return _VSTD::copy(__nb, __ne, __s); } -extern template class time_put; -extern template class time_put; +_LIBCPP_EXTERN_TEMPLATE(class time_put) +_LIBCPP_EXTERN_TEMPLATE(class time_put) template > class _LIBCPP_VISIBLE time_put_byname @@ -2782,8 +2832,8 @@ protected: ~time_put_byname() {} }; -extern template class time_put_byname; -extern template class time_put_byname; +_LIBCPP_EXTERN_TEMPLATE(class time_put_byname) +_LIBCPP_EXTERN_TEMPLATE(class time_put_byname) // money_base @@ -2836,19 +2886,23 @@ 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 locale::id moneypunct<_CharT, _International>::id; -extern template class moneypunct; -extern template class moneypunct; -extern template class moneypunct; -extern template class moneypunct; +template +const bool +moneypunct<_CharT, _International>::intl; + +_LIBCPP_EXTERN_TEMPLATE(class moneypunct) +_LIBCPP_EXTERN_TEMPLATE(class moneypunct) +_LIBCPP_EXTERN_TEMPLATE(class moneypunct) +_LIBCPP_EXTERN_TEMPLATE(class moneypunct) // moneypunct_byname @@ -2902,10 +2956,10 @@ template<> void moneypunct_byname::init(const char*); template<> void moneypunct_byname::init(const char*); template<> void moneypunct_byname::init(const char*); -extern template class moneypunct_byname; -extern template class moneypunct_byname; -extern template class moneypunct_byname; -extern template class moneypunct_byname; +_LIBCPP_EXTERN_TEMPLATE(class moneypunct_byname) +_LIBCPP_EXTERN_TEMPLATE(class moneypunct_byname) +_LIBCPP_EXTERN_TEMPLATE(class moneypunct_byname) +_LIBCPP_EXTERN_TEMPLATE(class moneypunct_byname) // money_get @@ -2961,8 +3015,8 @@ __money_get<_CharT>::__gather_info(bool __intl, const locale& __loc, } } -extern template class __money_get; -extern template class __money_get; +_LIBCPP_EXTERN_TEMPLATE(class __money_get) +_LIBCPP_EXTERN_TEMPLATE(class __money_get) template > class _LIBCPP_VISIBLE money_get @@ -3027,10 +3081,10 @@ void __double_or_nothing(unique_ptr<_Tp, void(*)(void*)>& __b, _Tp*& __n, _Tp*& __e) { bool __owns = __b.get_deleter() != __do_nothing; - size_t __cur_cap = (__e-__b.get()) * sizeof(_Tp); + size_t __cur_cap = static_cast(__e-__b.get()) * sizeof(_Tp); size_t __new_cap = __cur_cap < numeric_limits::max() / 2 ? 2 * __cur_cap : numeric_limits::max(); - size_t __n_off = __n - __b.get(); + size_t __n_off = static_cast(__n - __b.get()); _Tp* __t = (_Tp*)realloc(__owns ? __b.get() : 0, __new_cap); if (__t == 0) __throw_bad_alloc(); @@ -3066,6 +3120,9 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e, string_type __sym; string_type __psn; string_type __nsn; + // Capture the spaces read into money_base::{space,none} so they + // can be compared to initial spaces in __sym. + string_type __spaces; int __fd; __money_get<_CharT>::__gather_info(__intl, __loc, __pat, __dp, __ts, __grp, __sym, __psn, __nsn, __fd); @@ -3079,7 +3136,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e, if (__p != 3) { if (__ct.is(ctype_base::space, *__b)) - ++__b; + __spaces.push_back(*__b++); else { __err |= ios_base::failbit; @@ -3091,7 +3148,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e, if (__p != 3) { while (__b != __e && __ct.is(ctype_base::space, *__b)) - ++__b; + __spaces.push_back(*__b++); } break; case money_base::sign: @@ -3149,10 +3206,31 @@ 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; - string_type* __k = __scan_keyword(__b, __e, &__sym, &__sym+1, - __ct, __et); - if (__sb && __k != &__sym) + 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)) { + // Match spaces we've already read against spaces at + // the beginning of __sym. + while (__sym_space_end != __sym.end() && + __ct.is(ctype_base::space, *__sym_space_end)) + ++__sym_space_end; + const size_t __num_spaces = __sym_space_end - __sym.begin(); + if (__num_spaces > __spaces.size() || + !equal(__spaces.end() - __num_spaces, __spaces.end(), + __sym.begin())) { + // No match. Put __sym_space_end back at the + // beginning of __sym, which will prevent a + // match in the next loop. + __sym_space_end = __sym.begin(); + } + } + typename string_type::const_iterator __sym_curr_char = __sym_space_end; + while (__sym_curr_char != __sym.end() && __b != __e && + *__b == *__sym_curr_char) { + ++__b; + ++__sym_curr_char; + } + if (__sb && __sym_curr_char != __sym.end()) { __err |= ios_base::failbit; return false; @@ -3248,7 +3326,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, ios_base::iostate& __err, long double& __v) const { - const unsigned __bz = 100; + const int __bz = 100; char_type __wbuf[__bz]; unique_ptr __wb(__wbuf, __do_nothing); char_type* __wn; @@ -3267,7 +3345,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, unique_ptr __h(0, free); if (__wn - __wb.get() > __bz-2) { - __h.reset((char*)malloc(__wn - __wb.get() + 2)); + __h.reset((char*)malloc(static_cast(__wn - __wb.get() + 2))); if (__h.get() == 0) __throw_bad_alloc(); __nc = __h.get(); @@ -3292,7 +3370,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, ios_base::iostate& __err, string_type& __v) const { - const unsigned __bz = 100; + const int __bz = 100; char_type __wbuf[__bz]; unique_ptr __wb(__wbuf, __do_nothing); char_type* __wn; @@ -3318,8 +3396,8 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, return __b; } -extern template class money_get; -extern template class money_get; +_LIBCPP_EXTERN_TEMPLATE(class money_get) +_LIBCPP_EXTERN_TEMPLATE(class money_get) // money_put @@ -3493,8 +3571,8 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m __mi = __mb; } -extern template class __money_put; -extern template class __money_put; +_LIBCPP_EXTERN_TEMPLATE(class __money_put) +_LIBCPP_EXTERN_TEMPLATE(class __money_put) template > class _LIBCPP_VISIBLE money_put @@ -3552,14 +3630,14 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, char* __bb = __buf; char_type __digits[__bs]; char_type* __db = __digits; - size_t __n = snprintf(__bb, __bs, "%.0Lf", __units); + size_t __n = static_cast(snprintf(__bb, __bs, "%.0Lf", __units)); unique_ptr __hn(0, free); unique_ptr __hd(0, free); // secure memory for digit storage if (__n > __bs-1) { -#ifdef _LIBCPP_STABLE_APPLE_ABI - __n = asprintf_l(&__bb, 0, "%.0Lf", __units); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + __n = static_cast(asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units)); #else __n = __asprintf_l(&__bb, __cloc(), "%.0Lf", __units); #endif @@ -3567,7 +3645,7 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, __throw_bad_alloc(); __hn.reset(__bb); __hd.reset((char_type*)malloc(__n * sizeof(char_type))); - if (__hd == 0) + if (__hd == nullptr) __throw_bad_alloc(); __db = __hd.get(); } @@ -3589,8 +3667,9 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, char_type* __mb = __mbuf; unique_ptr __hw(0, free); size_t __exn = static_cast(__n) > __fd ? - (__n - __fd) * 2 + __sn.size() + __sym.size() + __fd + 1 - : __sn.size() + __sym.size() + __fd + 2; + (__n - static_cast(__fd)) * 2 + __sn.size() + + __sym.size() + static_cast(__fd) + 1 + : __sn.size() + __sym.size() + static_cast(__fd) + 2; if (__exn > __bs) { __hw.reset((char_type*)malloc(__exn * sizeof(char_type))); @@ -3629,9 +3708,10 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, char_type __mbuf[100]; char_type* __mb = __mbuf; unique_ptr __h(0, free); - size_t __exn = __digits.size() > __fd ? - (__digits.size() - __fd) * 2 + __sn.size() + __sym.size() + __fd + 1 - : __sn.size() + __sym.size() + __fd + 2; + size_t __exn = static_cast(__digits.size()) > __fd ? + (__digits.size() - static_cast(__fd)) * 2 + + __sn.size() + __sym.size() + static_cast(__fd) + 1 + : __sn.size() + __sym.size() + static_cast(__fd) + 2; if (__exn > 100) { __h.reset((char_type*)malloc(__exn * sizeof(char_type))); @@ -3648,8 +3728,8 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, return __pad_and_output(__s, __mb, __mi, __me, __iob, __fl); } -extern template class money_put; -extern template class money_put; +_LIBCPP_EXTERN_TEMPLATE(class money_put) +_LIBCPP_EXTERN_TEMPLATE(class money_put) // messages @@ -3716,7 +3796,7 @@ messages<_CharT>::do_open(const basic_string& __nm, const locale&) const #if _WIN32 return -1; #else // _WIN32 - catalog __cat = reinterpret_cast(catopen(__nm.c_str(), NL_CAT_LOCALE)); + catalog __cat = (catalog)catopen(__nm.c_str(), NL_CAT_LOCALE); if (__cat != -1) __cat = static_cast((static_cast(__cat) >> 1)); return __cat; @@ -3737,7 +3817,7 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid, __dflt.c_str() + __dflt.size()); if (__c != -1) __c <<= 1; - nl_catd __cat = reinterpret_cast(__c); + nl_catd __cat = (nl_catd)__c; char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str()); string_type __w; __widen_from_utf8()(back_inserter(__w), @@ -3753,13 +3833,13 @@ messages<_CharT>::do_close(catalog __c) const #if !_WIN32 if (__c != -1) __c <<= 1; - nl_catd __cat = reinterpret_cast(__c); + nl_catd __cat = (nl_catd)__c; catclose(__cat); #endif // !_WIN32 } -extern template class messages; -extern template class messages; +_LIBCPP_EXTERN_TEMPLATE(class messages) +_LIBCPP_EXTERN_TEMPLATE(class messages) template class _LIBCPP_VISIBLE messages_byname @@ -3782,8 +3862,8 @@ protected: ~messages_byname() {} }; -extern template class messages_byname; -extern template class messages_byname; +_LIBCPP_EXTERN_TEMPLATE(class messages_byname) +_LIBCPP_EXTERN_TEMPLATE(class messages_byname) template, @@ -3899,7 +3979,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) @@ -3959,7 +4040,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) @@ -4021,9 +4103,9 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: } else if (__r == codecvt_base::partial) { - ptrdiff_t __s = __to_nxt - &__bs[0]; - __bs.resize(2 * __s); - __to = &__bs[0] + __s; + ptrdiff_t __sp = __to_nxt - &__bs[0]; + __bs.resize(2 * __sp); + __to = &__bs[0] + __sp; __to_end = &__bs[0] + __bs.size(); } } while (__r == codecvt_base::partial); diff --git a/system/include/libcxx/map b/system/include/libcxx/map index 886aecf2c9f44..dd98da5e7ae88 100644 --- a/system/include/libcxx/map +++ b/system/include/libcxx/map @@ -375,15 +375,21 @@ swap(multimap& x, #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD -template ::value> +template ::value +#if __has_feature(is_final) + && !__is_final(_Compare) +#endif + > class __map_value_compare : private _Compare { - typedef pair::type, _Tp> _P; + typedef pair::type, _Tp> _Pp; typedef pair _CP; public: _LIBCPP_INLINE_VISIBILITY @@ -400,25 +406,25 @@ public: bool operator()(const _CP& __x, const _CP& __y) const {return static_cast(*this)(__x.first, __y.first);} _LIBCPP_INLINE_VISIBILITY - bool operator()(const _CP& __x, const _P& __y) const + bool operator()(const _CP& __x, const _Pp& __y) const {return static_cast(*this)(__x.first, __y.first);} _LIBCPP_INLINE_VISIBILITY bool operator()(const _CP& __x, const _Key& __y) const {return static_cast(*this)(__x.first, __y);} _LIBCPP_INLINE_VISIBILITY - bool operator()(const _P& __x, const _CP& __y) const + bool operator()(const _Pp& __x, const _CP& __y) const {return static_cast(*this)(__x.first, __y.first);} _LIBCPP_INLINE_VISIBILITY - bool operator()(const _P& __x, const _P& __y) const + bool operator()(const _Pp& __x, const _Pp& __y) const {return static_cast(*this)(__x.first, __y.first);} _LIBCPP_INLINE_VISIBILITY - bool operator()(const _P& __x, const _Key& __y) const + bool operator()(const _Pp& __x, const _Key& __y) const {return static_cast(*this)(__x.first, __y);} _LIBCPP_INLINE_VISIBILITY bool operator()(const _Key& __x, const _CP& __y) const {return static_cast(*this)(__x, __y.first);} _LIBCPP_INLINE_VISIBILITY - bool operator()(const _Key& __x, const _P& __y) const + bool operator()(const _Key& __x, const _Pp& __y) const {return static_cast(*this)(__x, __y.first);} _LIBCPP_INLINE_VISIBILITY bool operator()(const _Key& __x, const _Key& __y) const @@ -430,7 +436,7 @@ class __map_value_compare<_Key, _Tp, _Compare, false> { _Compare comp; - typedef pair::type, _Tp> _P; + typedef pair::type, _Tp> _Pp; typedef pair _CP; public: @@ -449,25 +455,25 @@ public: bool operator()(const _CP& __x, const _CP& __y) const {return comp(__x.first, __y.first);} _LIBCPP_INLINE_VISIBILITY - bool operator()(const _CP& __x, const _P& __y) const + bool operator()(const _CP& __x, const _Pp& __y) const {return comp(__x.first, __y.first);} _LIBCPP_INLINE_VISIBILITY bool operator()(const _CP& __x, const _Key& __y) const {return comp(__x.first, __y);} _LIBCPP_INLINE_VISIBILITY - bool operator()(const _P& __x, const _CP& __y) const + bool operator()(const _Pp& __x, const _CP& __y) const {return comp(__x.first, __y.first);} _LIBCPP_INLINE_VISIBILITY - bool operator()(const _P& __x, const _P& __y) const + bool operator()(const _Pp& __x, const _Pp& __y) const {return comp(__x.first, __y.first);} _LIBCPP_INLINE_VISIBILITY - bool operator()(const _P& __x, const _Key& __y) const + bool operator()(const _Pp& __x, const _Key& __y) const {return comp(__x.first, __y);} _LIBCPP_INLINE_VISIBILITY bool operator()(const _Key& __x, const _CP& __y) const {return comp(__x, __y.first);} _LIBCPP_INLINE_VISIBILITY - bool operator()(const _Key& __x, const _P& __y) const + bool operator()(const _Key& __x, const _Pp& __y) const {return comp(__x, __y.first);} _LIBCPP_INLINE_VISIBILITY bool operator()(const _Key& __x, const _Key& __y) const @@ -874,59 +880,29 @@ 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 - template ::value>::type> + template ::value>::type> _LIBCPP_INLINE_VISIBILITY - pair insert(_P&& __p) - {return __tree_.__insert_unique(_VSTD::forward<_P>(__p));} + pair insert(_Pp&& __p) + {return __tree_.__insert_unique(_VSTD::forward<_Pp>(__p));} - template ::value>::type> + template ::value>::type> _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __pos, _P&& __p) - {return __tree_.__insert_unique(__pos.__i_, _VSTD::forward<_P>(__p));} + iterator insert(const_iterator __pos, _Pp&& __p) + {return __tree_.__insert_unique(__pos.__i_, _VSTD::forward<_Pp>(__p));} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -1004,18 +980,28 @@ private: typedef typename __base::__node_const_pointer __node_const_pointer; typedef typename __base::__node_base_pointer __node_base_pointer; typedef typename __base::__node_base_const_pointer __node_base_const_pointer; - typedef __map_node_destructor<__node_allocator> _D; - typedef unique_ptr<__node, _D> __node_holder; + typedef __map_node_destructor<__node_allocator> _Dp; + typedef unique_ptr<__node, _Dp> __node_holder; #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); @@ -1200,7 +1186,7 @@ typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder map<_Key, _Tp, _Compare, _Allocator>::__construct_node() { __node_allocator& __na = __tree_.__node_alloc(); - __node_holder __h(__node_traits::allocate(__na, 1), _D(__na)); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first)); __h.get_deleter().__first_constructed = true; __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second)); @@ -1209,32 +1195,53 @@ 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(); - __node_holder __h(__node_traits::allocate(__na, 1), _D(__na)); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0)); __h.get_deleter().__first_constructed = true; __h.get_deleter().__second_constructed = true; 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), _D(__na)); - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0)); + __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; - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), _VSTD::forward<_Args>(__args)...); __h.get_deleter().__second_constructed = true; return __h; } @@ -1248,7 +1255,7 @@ typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder map<_Key, _Tp, _Compare, _Allocator>::__construct_node(const key_type& __k) { __node_allocator& __na = __tree_.__node_alloc(); - __node_holder __h(__node_traits::allocate(__na, 1), _D(__na)); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k); __h.get_deleter().__first_constructed = true; __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second)); @@ -1323,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(); @@ -1338,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(); @@ -1623,57 +1624,29 @@ 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 - template ::value>::type> + template ::value>::type> _LIBCPP_INLINE_VISIBILITY - iterator insert(_P&& __p) - {return __tree_.__insert_multi(_VSTD::forward<_P>(__p));} + iterator insert(_Pp&& __p) + {return __tree_.__insert_multi(_VSTD::forward<_Pp>(__p));} - template ::value>::type> + template ::value>::type> _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __pos, _P&& __p) - {return __tree_.__insert_multi(__pos.__i_, _VSTD::forward<_P>(__p));} + iterator insert(const_iterator __pos, _Pp&& __p) + {return __tree_.__insert_multi(__pos.__i_, _VSTD::forward<_Pp>(__p));} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -1746,18 +1719,28 @@ private: typedef typename __base::__node_allocator __node_allocator; typedef typename __base::__node_pointer __node_pointer; typedef typename __base::__node_const_pointer __node_const_pointer; - typedef __map_node_destructor<__node_allocator> _D; - typedef unique_ptr<__node, _D> __node_holder; + typedef __map_node_destructor<__node_allocator> _Dp; + typedef unique_ptr<__node, _Dp> __node_holder; #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 }; @@ -1782,7 +1765,7 @@ typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node() { __node_allocator& __na = __tree_.__node_alloc(); - __node_holder __h(__node_traits::allocate(__na, 1), _D(__na)); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first)); __h.get_deleter().__first_constructed = true; __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second)); @@ -1791,34 +1774,53 @@ 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(); - __node_holder __h(__node_traits::allocate(__na, 1), _D(__na)); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0)); __h.get_deleter().__first_constructed = true; __h.get_deleter().__second_constructed = true; 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), _D(__na)); - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0)); + __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; - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), _VSTD::forward<_Args>(__args)...); __h.get_deleter().__second_constructed = true; return __h; } @@ -1829,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/system/include/libcxx/memory b/system/include/libcxx/memory index d272c08c91cb1..4e1f704681b5b 100644 --- a/system/include/libcxx/memory +++ b/system/include/libcxx/memory @@ -596,19 +596,23 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space); #include #include <__functional_base> #include +#include +#include #if defined(_LIBCPP_NO_EXCEPTIONS) #include #endif -#pragma GCC system_header - -_LIBCPP_BEGIN_NAMESPACE_STD +#if __has_feature(cxx_atomic) +# include +#endif -// allocator_arg_t +#include <__undef_min_max> -struct _LIBCPP_VISIBLE allocator_arg_t { }; +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif -extern const allocator_arg_t allocator_arg; +_LIBCPP_BEGIN_NAMESPACE_STD // addressof @@ -673,13 +677,24 @@ public: template struct rebind {typedef allocator<_Up> other;}; }; +template <> +class _LIBCPP_VISIBLE allocator +{ +public: + typedef const void* pointer; + typedef const void* const_pointer; + typedef const void value_type; + + template struct rebind {typedef allocator<_Up> other;}; +}; + // pointer_traits template struct __has_element_type { private: - struct __two {char _; char __;}; + struct __two {char __lx; char __lxx;}; template static __two __test(...); template static char __test(typename _Up::element_type* = 0); public: @@ -767,7 +782,7 @@ template struct __has_difference_type { private: - struct __two {char _; char __;}; + struct __two {char __lx; char __lxx;}; template static __two __test(...); template static char __test(typename _Up::difference_type* = 0); public: @@ -790,7 +805,7 @@ template struct __has_rebind { private: - struct __two {char _; char __;}; + struct __two {char __lx; char __lxx;}; template static __two __test(...); template static char __test(typename _Xp::template rebind<_Up>* = 0); public: @@ -983,7 +998,7 @@ template struct __has_const_pointer { private: - struct __two {char _; char __;}; + struct __two {char __lx; char __lxx;}; template static __two __test(...); template static char __test(typename _Up::const_pointer* = 0); public: @@ -1010,7 +1025,7 @@ template struct __has_void_pointer { private: - struct __two {char _; char __;}; + struct __two {char __lx; char __lxx;}; template static __two __test(...); template static char __test(typename _Up::void_pointer* = 0); public: @@ -1037,7 +1052,7 @@ template struct __has_const_void_pointer { private: - struct __two {char _; char __;}; + struct __two {char __lx; char __lxx;}; template static __two __test(...); template static char __test(typename _Up::const_void_pointer* = 0); public: @@ -1060,10 +1075,10 @@ struct __const_void_pointer<_Ptr, _Alloc, false> #endif }; -template +template inline _LIBCPP_INLINE_VISIBILITY -_T* -__to_raw_pointer(_T* __p) _NOEXCEPT +_Tp* +__to_raw_pointer(_Tp* __p) _NOEXCEPT { return __p; } @@ -1080,7 +1095,7 @@ template struct __has_size_type { private: - struct __two {char _; char __;}; + struct __two {char __lx; char __lxx;}; template static __two __test(...); template static char __test(typename _Up::size_type* = 0); public: @@ -1103,7 +1118,7 @@ template struct __has_propagate_on_container_copy_assignment { private: - struct __two {char _; char __;}; + struct __two {char __lx; char __lxx;}; template static __two __test(...); template static char __test(typename _Up::propagate_on_container_copy_assignment* = 0); public: @@ -1126,7 +1141,7 @@ template struct __has_propagate_on_container_move_assignment { private: - struct __two {char _; char __;}; + struct __two {char __lx; char __lxx;}; template static __two __test(...); template static char __test(typename _Up::propagate_on_container_move_assignment* = 0); public: @@ -1149,7 +1164,7 @@ template struct __has_propagate_on_container_swap { private: - struct __two {char _; char __;}; + struct __two {char __lx; char __lxx;}; template static __two __test(...); template static char __test(typename _Up::propagate_on_container_swap* = 0); public: @@ -1172,7 +1187,7 @@ template ::value> struct __has_rebind_other { private: - struct __two {char _; char __;}; + struct __two {char __lx; char __lxx;}; template static __two __test(...); template static char __test(typename _Xp::template rebind<_Up>::other* = 0); public: @@ -1385,6 +1400,14 @@ struct __has_construct { }; +#else // _LIBCPP_HAS_NO_VARIADICS + +template +struct __has_construct + : false_type +{ +}; + #endif // _LIBCPP_HAS_NO_VARIADICS template @@ -1514,6 +1537,63 @@ struct _LIBCPP_VISIBLE allocator_traits __has_select_on_container_copy_construction(), __a);} + template + _LIBCPP_INLINE_VISIBILITY + static + void + __construct_forward(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __begin2) + { + for (; __begin1 != __end1; ++__begin1, ++__begin2) + construct(__a, _VSTD::__to_raw_pointer(__begin2), _VSTD::move_if_noexcept(*__begin1)); + } + + template + _LIBCPP_INLINE_VISIBILITY + static + typename enable_if + < + (is_same >::value + || !__has_construct::value) && + is_trivially_move_constructible<_Tp>::value, + void + >::type + __construct_forward(allocator_type& __a, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2) + { + ptrdiff_t _Np = __end1 - __begin1; + _VSTD::memcpy(__begin2, __begin1, _Np * sizeof(_Tp)); + __begin2 += _Np; + } + + template + _LIBCPP_INLINE_VISIBILITY + static + void + __construct_backward(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __end2) + { + while (__end1 != __begin1) + { + construct(__a, _VSTD::__to_raw_pointer(__end2-1), _VSTD::move_if_noexcept(*--__end1)); + --__end2; + } + } + + template + _LIBCPP_INLINE_VISIBILITY + static + typename enable_if + < + (is_same >::value + || !__has_construct::value) && + is_trivially_move_constructible<_Tp>::value, + void + >::type + __construct_backward(allocator_type& __a, _Tp* __begin1, _Tp* __end1, _Tp*& __end2) + { + ptrdiff_t _Np = __end1 - __begin1; + __end2 -= _Np; + _VSTD::memcpy(__end2, __begin1, _Np * sizeof(_Tp)); + } + private: _LIBCPP_INLINE_VISIBILITY @@ -1522,7 +1602,7 @@ private: {return __a.allocate(__n, __hint);} _LIBCPP_INLINE_VISIBILITY static pointer allocate(allocator_type& __a, size_type __n, - const_void_pointer __hint, false_type) + const_void_pointer, false_type) {return __a.allocate(__n);} #ifndef _LIBCPP_HAS_NO_VARIADICS @@ -1566,58 +1646,6 @@ private: {return __a;} }; -// uses_allocator - -template -struct __has_allocator_type -{ -private: - struct __two {char _; char __;}; - template static __two __test(...); - template static char __test(typename _Up::allocator_type* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; - -template ::value> -struct __uses_allocator - : public integral_constant::value> -{ -}; - -template -struct __uses_allocator<_Tp, _Alloc, false> - : public false_type -{ -}; - -template -struct _LIBCPP_VISIBLE uses_allocator - : public __uses_allocator<_Tp, _Alloc> -{ -}; - -#ifndef _LIBCPP_HAS_NO_VARIADICS - -// uses-allocator construction - -template -struct __uses_alloc_ctor_imp -{ - static const bool __ua = uses_allocator<_Tp, _Alloc>::value; - static const bool __ic = - is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value; - static const int value = __ua ? 2 - __ic : 0; -}; - -template -struct __uses_alloc_ctor - : integral_constant::value> - {}; - -#endif // _LIBCPP_HAS_NO_VARIADICS - // allocator template @@ -1664,38 +1692,110 @@ public: ::new((void*)__p) _Tp(); } # if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) + template _LIBCPP_INLINE_VISIBILITY - typename enable_if - < - !is_convertible<_A0, __rv<_A0> >::value, - void - >::type + void construct(pointer __p, _A0& __a0) { ::new((void*)__p) _Tp(__a0); } template _LIBCPP_INLINE_VISIBILITY - typename enable_if - < - !is_convertible<_A0, __rv<_A0> >::value, - void - >::type + void construct(pointer __p, const _A0& __a0) { ::new((void*)__p) _Tp(__a0); } +# endif // defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) + template + _LIBCPP_INLINE_VISIBILITY + void + construct(pointer __p, _A0& __a0, _A1& __a1) + { + ::new((void*)__p) _Tp(__a0, __a1); + } + template + _LIBCPP_INLINE_VISIBILITY + void + construct(pointer __p, const _A0& __a0, _A1& __a1) + { + ::new((void*)__p) _Tp(__a0, __a1); + } + template + _LIBCPP_INLINE_VISIBILITY + void + construct(pointer __p, _A0& __a0, const _A1& __a1) + { + ::new((void*)__p) _Tp(__a0, __a1); + } + template + _LIBCPP_INLINE_VISIBILITY + void + construct(pointer __p, const _A0& __a0, const _A1& __a1) + { + ::new((void*)__p) _Tp(__a0, __a1); + } +#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) + _LIBCPP_INLINE_VISIBILITY void destroy(pointer __p) {__p->~_Tp();} +}; + +template +class _LIBCPP_VISIBLE allocator +{ +public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef const _Tp* pointer; + typedef const _Tp* const_pointer; + typedef const _Tp& reference; + typedef const _Tp& const_reference; + typedef _Tp value_type; + + typedef true_type propagate_on_container_move_assignment; + + template struct rebind {typedef allocator<_Up> other;}; + + _LIBCPP_INLINE_VISIBILITY allocator() _NOEXCEPT {} + template _LIBCPP_INLINE_VISIBILITY allocator(const allocator<_Up>&) _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT + {return _VSTD::addressof(__x);} + _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, allocator::const_pointer = 0) + {return static_cast(::operator new(__n * sizeof(_Tp)));} + _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT + {::operator delete((void*)__p);} + _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT + {return size_type(~0) / sizeof(_Tp);} +#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) + template + _LIBCPP_INLINE_VISIBILITY + void + construct(_Up* __p, _Args&&... __args) + { + ::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...); + } +#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) + _LIBCPP_INLINE_VISIBILITY + void + construct(pointer __p) + { + ::new((void*)__p) _Tp(); + } +# if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) + + template + _LIBCPP_INLINE_VISIBILITY + void + construct(pointer __p, _A0& __a0) + { + ::new((void*)__p) _Tp(__a0); + } template _LIBCPP_INLINE_VISIBILITY - typename enable_if - < - is_convertible<_A0, __rv<_A0> >::value, - void - >::type - construct(pointer __p, _A0 __a0) + void + construct(pointer __p, const _A0& __a0) { - ::new((void*)__p) _Tp(_VSTD::move(__a0)); + ::new((void*)__p) _Tp(__a0); } # endif // defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) template @@ -1844,8 +1944,16 @@ public: template ::type, typename remove_cv<_T2>::type>::value, - bool = is_empty<_T1>::value, - bool = is_empty<_T2>::value> + bool = is_empty<_T1>::value +#if __has_feature(is_final) + && !__is_final(_T1) +#endif + , + bool = is_empty<_T2>::value +#if __has_feature(is_final) + && !__is_final(_T2) +#endif + > struct __libcpp_compressed_pair_switch; template @@ -1883,9 +1991,9 @@ public: typedef const typename remove_reference<_T2>::type& _T2_const_reference; _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1, int = 0) + _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1) : __first_(_VSTD::forward<_T1_param>(__t1)) {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2, int* = 0) + _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2) : __second_(_VSTD::forward<_T2_param>(__t2)) {} _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) : __first_(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {} @@ -1928,6 +2036,21 @@ public: return *this; } +#ifndef _LIBCPP_HAS_NO_VARIADICS + + template + _LIBCPP_INLINE_VISIBILITY + __libcpp_compressed_pair_imp(piecewise_construct_t __pc, + tuple<_Args1...> __first_args, + tuple<_Args2...> __second_args, + __tuple_indices<_I1...>, + __tuple_indices<_I2...>) + : __first_(_VSTD::forward<_Args1>(get<_I1>(__first_args))...), + __second_(_VSTD::forward<_Args2>(get<_I2>(__second_args))...) + {} + +#endif // _LIBCPP_HAS_NO_VARIADICS + #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS @@ -1965,9 +2088,9 @@ public: typedef const typename remove_reference<_T2>::type& _T2_const_reference; _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1, int = 0) + _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1) : _T1(_VSTD::forward<_T1_param>(__t1)) {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2, int* = 0) + _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2) : __second_(_VSTD::forward<_T2_param>(__t2)) {} _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) : _T1(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {} @@ -2008,6 +2131,21 @@ public: return *this; } +#ifndef _LIBCPP_HAS_NO_VARIADICS + + template + _LIBCPP_INLINE_VISIBILITY + __libcpp_compressed_pair_imp(piecewise_construct_t __pc, + tuple<_Args1...> __first_args, + tuple<_Args2...> __second_args, + __tuple_indices<_I1...>, + __tuple_indices<_I2...>) + : _T1(_VSTD::forward<_Args1>(get<_I1>(__first_args))...), + __second_(_VSTD::forward<_Args2>(get<_I2>(__second_args))...) + {} + +#endif // _LIBCPP_HAS_NO_VARIADICS + #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS @@ -2089,6 +2227,22 @@ public: return *this; } +#ifndef _LIBCPP_HAS_NO_VARIADICS + + template + _LIBCPP_INLINE_VISIBILITY + __libcpp_compressed_pair_imp(piecewise_construct_t __pc, + tuple<_Args1...> __first_args, + tuple<_Args2...> __second_args, + __tuple_indices<_I1...>, + __tuple_indices<_I2...>) + : _T2(_VSTD::forward<_Args2>(get<_I2>(__second_args))...), + __first_(_VSTD::forward<_Args1>(get<_I1>(__first_args))...) + + {} + +#endif // _LIBCPP_HAS_NO_VARIADICS + #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS @@ -2167,6 +2321,21 @@ public: return *this; } +#ifndef _LIBCPP_HAS_NO_VARIADICS + + template + _LIBCPP_INLINE_VISIBILITY + __libcpp_compressed_pair_imp(piecewise_construct_t __pc, + tuple<_Args1...> __first_args, + tuple<_Args2...> __second_args, + __tuple_indices<_I1...>, + __tuple_indices<_I2...>) + : _T1(_VSTD::forward<_Args1>(get<_I1>(__first_args))...), + _T2(_VSTD::forward<_Args2>(get<_I2>(__second_args))...) + {} + +#endif // _LIBCPP_HAS_NO_VARIADICS + #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS @@ -2177,7 +2346,7 @@ public: _LIBCPP_INLINE_VISIBILITY _T2_reference second() _NOEXCEPT {return *this;} _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return *this;} - _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp& __x) + _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp&) _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && __is_nothrow_swappable<_T1>::value) { @@ -2200,9 +2369,9 @@ public: typedef typename base::_T2_const_reference _T2_const_reference; _LIBCPP_INLINE_VISIBILITY __compressed_pair() {} - _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T1_param __t1, int = 0) + _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T1_param __t1) : base(_VSTD::forward<_T1_param>(__t1)) {} - _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T2_param __t2, int* = 0) + _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T2_param __t2) : base(_VSTD::forward<_T2_param>(__t2)) {} _LIBCPP_INLINE_VISIBILITY __compressed_pair(_T1_param __t1, _T2_param __t2) : base(_VSTD::forward<_T1_param>(__t1), _VSTD::forward<_T2_param>(__t2)) {} @@ -2239,6 +2408,20 @@ public: base::operator=(_VSTD::move(__p)); return *this; } + +#ifndef _LIBCPP_HAS_NO_VARIADICS + + template + _LIBCPP_INLINE_VISIBILITY + __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, + tuple<_Args2...> __second_args) + : base(__pc, _VSTD::move(__first_args), _VSTD::move(__second_args), + typename __make_tuple_indices::type(), + typename __make_tuple_indices::type()) + {} + +#endif // _LIBCPP_HAS_NO_VARIADICS + #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS @@ -2263,10 +2446,39 @@ swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y) __is_nothrow_swappable<_T1>::value) {__x.swap(__y);} +// __same_or_less_cv_qualified + +template ::element_type>::type, + typename remove_cv::element_type>::type + >::value + > +struct __same_or_less_cv_qualified_imp + : is_convertible<_Ptr1, _Ptr2> {}; + +template +struct __same_or_less_cv_qualified_imp<_Ptr1, _Ptr2, false> + : false_type {}; + +template ::value && + !is_pointer<_Ptr1>::value> +struct __same_or_less_cv_qualified + : __same_or_less_cv_qualified_imp<_Ptr1, _Ptr2> {}; + +template +struct __same_or_less_cv_qualified<_Ptr1, _Ptr2, true> + : false_type {}; + +// default_delete + 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 {} @@ -2280,13 +2492,23 @@ struct _LIBCPP_VISIBLE default_delete template struct _LIBCPP_VISIBLE default_delete<_Tp[]> { - _LIBCPP_INLINE_VISIBILITY void operator() (_Tp* __ptr) const _NOEXCEPT +public: +#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 {} + template + _LIBCPP_INLINE_VISIBILITY + void operator() (_Up* __ptr, + typename enable_if<__same_or_less_cv_qualified<_Up*, _Tp*>::value>::type* = 0) const _NOEXCEPT { static_assert(sizeof(_Tp) > 0, "default_delete can not delete incomplete type"); delete [] __ptr; } -private: - template void operator() (_Up*) const; }; template > @@ -2299,14 +2521,7 @@ public: private: __compressed_pair __ptr_; -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - unique_ptr(const unique_ptr&); - unique_ptr& operator=(const unique_ptr&); - template - unique_ptr(const unique_ptr<_Up, _Ep>&); - template - unique_ptr& operator=(const unique_ptr<_Up, _Ep>&); -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES unique_ptr(unique_ptr&); template unique_ptr(unique_ptr<_Up, _Ep>&); @@ -2320,13 +2535,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, @@ -2393,7 +2608,9 @@ public: _LIBCPP_INLINE_VISIBILITY typename enable_if < - !is_array<_Up>::value, + !is_array<_Up>::value && + is_convertible::pointer, pointer>::value && + is_assignable::value, unique_ptr& >::type operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT @@ -2450,9 +2667,9 @@ public: {return __ptr_.second();} _LIBCPP_INLINE_VISIBILITY _Dp_const_reference get_deleter() const _NOEXCEPT {return __ptr_.second();} - _LIBCPP_INLINE_VISIBILITY operator int __nat::*() const - _NOEXCEPT - {return __ptr_.first() ? &__nat::__for_bool_ : 0;} + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT + {return __ptr_.first() != nullptr;} _LIBCPP_INLINE_VISIBILITY pointer release() _NOEXCEPT { @@ -2483,10 +2700,7 @@ public: private: __compressed_pair __ptr_; -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - unique_ptr(const unique_ptr&); - unique_ptr& operator=(const unique_ptr&); -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES unique_ptr(unique_ptr&); template unique_ptr(unique_ptr<_Up>&); @@ -2500,33 +2714,33 @@ 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, "unique_ptr constructed with null function pointer deleter"); } #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template ::value>::type + template ::value>::type > - _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(_P __p) _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(_Pp __p) _NOEXCEPT : __ptr_(__p) { static_assert(!is_pointer::value, "unique_ptr constructed with null function pointer deleter"); } - template ::value>::type + template ::value>::type > - _LIBCPP_INLINE_VISIBILITY unique_ptr(_P __p, typename conditional< + _LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p, typename conditional< is_reference::value, deleter_type, typename add_lvalue_reference::type>::type __d) @@ -2540,11 +2754,10 @@ public: _NOEXCEPT : __ptr_(pointer(), __d) {} - template ::value || - is_same<_P, nullptr_t>::value>::type + template ::value>::type > - _LIBCPP_INLINE_VISIBILITY unique_ptr(_P __p, typename remove_reference::type&& __d) + _LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p, typename remove_reference::type&& __d) _NOEXCEPT : __ptr_(__p, _VSTD::move(__d)) { @@ -2567,14 +2780,48 @@ public: __ptr_.second() = _VSTD::forward(__u.get_deleter()); return *this; } -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(pointer __p) - : __ptr_(__p) - { - static_assert(!is_pointer::value, - "unique_ptr constructed with null function pointer deleter"); - } + template + _LIBCPP_INLINE_VISIBILITY + unique_ptr(unique_ptr<_Up, _Ep>&& __u, + typename enable_if + < + is_array<_Up>::value && + __same_or_less_cv_qualified::pointer, pointer>::value + && is_convertible<_Ep, deleter_type>::value && + ( + !is_reference::value || + is_same::value + ), + __nat + >::type = __nat() + ) _NOEXCEPT + : __ptr_(__u.release(), _VSTD::forward(__u.get_deleter())) {} + + + template + _LIBCPP_INLINE_VISIBILITY + typename enable_if + < + is_array<_Up>::value && + __same_or_less_cv_qualified::pointer, pointer>::value && + is_assignable::value, + unique_ptr& + >::type + operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT + { + reset(__u.release()); + __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); + return *this; + } +#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES + + _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(pointer __p) + : __ptr_(__p) + { + static_assert(!is_pointer::value, + "unique_ptr constructed with null function pointer deleter"); + } _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, deleter_type __d) : __ptr_(__p, _VSTD::forward(__d)) {} @@ -2613,8 +2860,9 @@ public: {return __ptr_.second();} _LIBCPP_INLINE_VISIBILITY _Dp_const_reference get_deleter() const _NOEXCEPT {return __ptr_.second();} - _LIBCPP_INLINE_VISIBILITY operator int __nat::*() const _NOEXCEPT - {return __ptr_.first() ? &__nat::__for_bool_ : 0;} + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT + {return __ptr_.first() != nullptr;} _LIBCPP_INLINE_VISIBILITY pointer release() _NOEXCEPT { @@ -2624,10 +2872,10 @@ public: } #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template ::value>::type + template ::value>::type > - _LIBCPP_INLINE_VISIBILITY void reset(_P __p) _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY void reset(_Pp __p) _NOEXCEPT { pointer __tmp = __ptr_.first(); __ptr_.first() = __p; @@ -2696,7 +2944,13 @@ 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, const unique_ptr<_T2, _D2>& __y) {return __x.get() < __y.get();} +operator< (const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) +{ + typedef typename unique_ptr<_T1, _D1>::pointer _P1; + typedef typename unique_ptr<_T2, _D2>::pointer _P2; + typedef typename common_type<_P1, _P2>::type _V; + return less<_V>()(__x.get(), __y.get()); +} template inline _LIBCPP_INLINE_VISIBILITY @@ -2713,8 +2967,431 @@ inline _LIBCPP_INLINE_VISIBILITY bool operator>=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x < __y);} +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT +{ + return !__x; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT +{ + return !__x; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT +{ + return static_cast(__x); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT +{ + return static_cast(__x); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator<(const unique_ptr<_T1, _D1>& __x, nullptr_t) +{ + typedef typename unique_ptr<_T1, _D1>::pointer _P1; + return less<_P1>()(__x.get(), nullptr); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator<(nullptr_t, const unique_ptr<_T1, _D1>& __x) +{ + typedef typename unique_ptr<_T1, _D1>::pointer _P1; + return less<_P1>()(nullptr, __x.get()); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator>(const unique_ptr<_T1, _D1>& __x, nullptr_t) +{ + return nullptr < __x; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator>(nullptr_t, const unique_ptr<_T1, _D1>& __x) +{ + return __x < nullptr; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator<=(const unique_ptr<_T1, _D1>& __x, nullptr_t) +{ + return !(nullptr < __x); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator<=(nullptr_t, const unique_ptr<_T1, _D1>& __x) +{ + return !(__x < nullptr); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator>=(const unique_ptr<_T1, _D1>& __x, nullptr_t) +{ + return !(__x < nullptr); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator>=(nullptr_t, const unique_ptr<_T1, _D1>& __x) +{ + return !(nullptr < __x); +} + +#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES + +template +inline _LIBCPP_INLINE_VISIBILITY +unique_ptr<_Tp, _Dp> +move(unique_ptr<_Tp, _Dp>& __t) +{ + return unique_ptr<_Tp, _Dp>(__rv >(__t)); +} + +#endif + template struct hash; +// We use murmur2 when size_t is 32 bits, and cityhash64 when size_t +// is 64 bits. This is because cityhash64 uses 64bit x 64bit +// multiplication, which can be very slow on 32-bit systems. +template +struct __murmur2_or_cityhash; + +template +struct __murmur2_or_cityhash<_Size, 32> +{ + _Size operator()(const void* __key, _Size __len); +}; + +// murmur2 +template +_Size +__murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len) +{ + const _Size __m = 0x5bd1e995; + const _Size __r = 24; + _Size __h = __len; + const unsigned char* __data = static_cast(__key); + for (; __len >= 4; __data += 4, __len -= 4) + { + _Size __k = *(const _Size*)__data; + __k *= __m; + __k ^= __k >> __r; + __k *= __m; + __h *= __m; + __h ^= __k; + } + switch (__len) + { + case 3: + __h ^= __data[2] << 16; + case 2: + __h ^= __data[1] << 8; + case 1: + __h ^= __data[0]; + __h *= __m; + } + __h ^= __h >> 13; + __h *= __m; + __h ^= __h >> 15; + return __h; +} + +template +struct __murmur2_or_cityhash<_Size, 64> +{ + _Size operator()(const void* __key, _Size __len); + + private: + // Some primes between 2^63 and 2^64. + static const _Size __k0 = 0xc3a5c85c97cb3127ULL; + static const _Size __k1 = 0xb492b66fbe98f273ULL; + static const _Size __k2 = 0x9ae16a3b2f90404fULL; + static const _Size __k3 = 0xc949d7c7509e6557ULL; + + static _Size __rotate(_Size __val, int __shift) { + return __shift == 0 ? __val : ((__val >> __shift) | (__val << (64 - __shift))); + } + + static _Size __rotate_by_at_least_1(_Size __val, int __shift) { + return (__val >> __shift) | (__val << (64 - __shift)); + } + + static _Size __shift_mix(_Size __val) { + return __val ^ (__val >> 47); + } + + static _Size __hash_len_16(_Size __u, _Size __v) { + const _Size __mul = 0x9ddfea08eb382d69ULL; + _Size __a = (__u ^ __v) * __mul; + __a ^= (__a >> 47); + _Size __b = (__v ^ __a) * __mul; + __b ^= (__b >> 47); + __b *= __mul; + return __b; + } + + static _Size __hash_len_0_to_16(const char* __s, _Size __len) { + if (__len > 8) { + const _Size __a = *(const _Size*)__s; + const _Size __b = *(const _Size*)(__s + __len - 8); + return __hash_len_16(__a, __rotate_by_at_least_1(__b + __len, __len)) ^ __b; + } + if (__len >= 4) { + const uint32_t __a = *(const uint32_t*)(__s); + const uint32_t __b = *(const uint32_t*)(__s + __len - 4); + return __hash_len_16(__len + (__a << 3), __b); + } + if (__len > 0) { + const unsigned char __a = __s[0]; + const unsigned char __b = __s[__len >> 1]; + const unsigned char __c = __s[__len - 1]; + const uint32_t __y = static_cast(__a) + + (static_cast(__b) << 8); + const uint32_t __z = __len + (static_cast(__c) << 2); + return __shift_mix(__y * __k2 ^ __z * __k3) * __k2; + } + return __k2; + } + + static _Size __hash_len_17_to_32(const char *__s, _Size __len) { + const _Size __a = *(const _Size*)(__s) * __k1; + const _Size __b = *(const _Size*)(__s + 8); + const _Size __c = *(const _Size*)(__s + __len - 8) * __k2; + const _Size __d = *(const _Size*)(__s + __len - 16) * __k0; + return __hash_len_16(__rotate(__a - __b, 43) + __rotate(__c, 30) + __d, + __a + __rotate(__b ^ __k3, 20) - __c + __len); + } + + // Return a 16-byte hash for 48 bytes. Quick and dirty. + // Callers do best to use "random-looking" values for a and b. + static pair<_Size, _Size> __weak_hash_len_32_with_seeds( + _Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b) { + __a += __w; + __b = __rotate(__b + __a + __z, 21); + const _Size __c = __a; + __a += __x; + __a += __y; + __b += __rotate(__a, 44); + return pair<_Size, _Size>(__a + __z, __b + __c); + } + + // Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty. + static pair<_Size, _Size> __weak_hash_len_32_with_seeds( + const char* __s, _Size __a, _Size __b) { + return __weak_hash_len_32_with_seeds(*(const _Size*)(__s), + *(const _Size*)(__s + 8), + *(const _Size*)(__s + 16), + *(const _Size*)(__s + 24), + __a, + __b); + } + + // Return an 8-byte hash for 33 to 64 bytes. + static _Size __hash_len_33_to_64(const char *__s, size_t __len) { + _Size __z = *(const _Size*)(__s + 24); + _Size __a = *(const _Size*)(__s) + + (__len + *(const _Size*)(__s + __len - 16)) * __k0; + _Size __b = __rotate(__a + __z, 52); + _Size __c = __rotate(__a, 37); + __a += *(const _Size*)(__s + 8); + __c += __rotate(__a, 7); + __a += *(const _Size*)(__s + 16); + _Size __vf = __a + __z; + _Size __vs = __b + __rotate(__a, 31) + __c; + __a = *(const _Size*)(__s + 16) + *(const _Size*)(__s + __len - 32); + __z += *(const _Size*)(__s + __len - 8); + __b = __rotate(__a + __z, 52); + __c = __rotate(__a, 37); + __a += *(const _Size*)(__s + __len - 24); + __c += __rotate(__a, 7); + __a += *(const _Size*)(__s + __len - 16); + _Size __wf = __a + __z; + _Size __ws = __b + __rotate(__a, 31) + __c; + _Size __r = __shift_mix((__vf + __ws) * __k2 + (__wf + __vs) * __k0); + return __shift_mix(__r * __k0 + __vs) * __k2; + } +}; + +// cityhash64 +template +_Size +__murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len) +{ + const char* __s = static_cast(__key); + if (__len <= 32) { + if (__len <= 16) { + return __hash_len_0_to_16(__s, __len); + } else { + return __hash_len_17_to_32(__s, __len); + } + } else if (__len <= 64) { + return __hash_len_33_to_64(__s, __len); + } + + // For strings over 64 bytes we hash the end first, and then as we + // loop we keep 56 bytes of state: v, w, x, y, and z. + _Size __x = *(const _Size*)(__s + __len - 40); + _Size __y = *(const _Size*)(__s + __len - 16) + + *(const _Size*)(__s + __len - 56); + _Size __z = __hash_len_16(*(const _Size*)(__s + __len - 48) + __len, + *(const _Size*)(__s + __len - 24)); + pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z); + pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x); + __x = __x * __k1 + *(const _Size*)(__s); + + // Decrease len to the nearest multiple of 64, and operate on 64-byte chunks. + __len = (__len - 1) & ~static_cast<_Size>(63); + do { + __x = __rotate(__x + __y + __v.first + *(const _Size*)(__s + 8), 37) * __k1; + __y = __rotate(__y + __v.second + *(const _Size*)(__s + 48), 42) * __k1; + __x ^= __w.second; + __y += __v.first + *(const _Size*)(__s + 40); + __z = __rotate(__z + __w.first, 33) * __k1; + __v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first); + __w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second, + __y + *(const _Size*)(__s + 16)); + std::swap(__z, __x); + __s += 64; + __len -= 64; + } while (__len != 0); + return __hash_len_16( + __hash_len_16(__v.first, __w.first) + __shift_mix(__y) * __k1 + __z, + __hash_len_16(__v.second, __w.second) + __x); +} + +template +struct __scalar_hash; + +template +struct __scalar_hash<_Tp, 0> + : public unary_function<_Tp, size_t> +{ + _LIBCPP_INLINE_VISIBILITY + size_t operator()(_Tp __v) const _NOEXCEPT + { + union + { + _Tp __t; + size_t __a; + } __u; + __u.__a = 0; + __u.__t = __v; + return __u.__a; + } +}; + +template +struct __scalar_hash<_Tp, 1> + : 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 __u.__a; + } +}; + +template +struct __scalar_hash<_Tp, 2> + : public unary_function<_Tp, size_t> +{ + _LIBCPP_INLINE_VISIBILITY + size_t operator()(_Tp __v) const _NOEXCEPT + { + union + { + _Tp __t; + struct + { + size_t __a; + size_t __b; + }; + } __u; + __u.__t = __v; + return __murmur2_or_cityhash()(&__u, sizeof(__u)); + } +}; + +template +struct __scalar_hash<_Tp, 3> + : public unary_function<_Tp, size_t> +{ + _LIBCPP_INLINE_VISIBILITY + size_t operator()(_Tp __v) const _NOEXCEPT + { + union + { + _Tp __t; + struct + { + size_t __a; + size_t __b; + size_t __c; + }; + } __u; + __u.__t = __v; + return __murmur2_or_cityhash()(&__u, sizeof(__u)); + } +}; + +template +struct __scalar_hash<_Tp, 4> + : public unary_function<_Tp, size_t> +{ + _LIBCPP_INLINE_VISIBILITY + size_t operator()(_Tp __v) const _NOEXCEPT + { + union + { + _Tp __t; + struct + { + size_t __a; + size_t __b; + size_t __c; + size_t __d; + }; + } __u; + __u.__t = __v; + return __murmur2_or_cityhash()(&__u, sizeof(__u)); + } +}; + template struct _LIBCPP_VISIBLE hash<_Tp*> : public unary_function<_Tp*, size_t> @@ -2722,8 +3399,13 @@ struct _LIBCPP_VISIBLE hash<_Tp*> _LIBCPP_INLINE_VISIBILITY size_t operator()(_Tp* __v) const _NOEXCEPT { - const size_t* const __p = reinterpret_cast(&__v); - return *__p; + union + { + _Tp* __t; + size_t __a; + } __u; + __u.__t = __v; + return __murmur2_or_cityhash()(&__u, sizeof(__u)); } }; @@ -2802,12 +3484,23 @@ template _ForwardIterator uninitialized_copy(_InputIterator __f, _InputIterator __l, _ForwardIterator __r) { - __destruct_n __d(0); typedef typename iterator_traits<_ForwardIterator>::value_type value_type; - unique_ptr __h(&*__r, __d); - for (; __f != __l; ++__f, ++__r, __d.__incr((value_type*)0)) - ::new(&*__r) value_type(*__f); - __h.release(); +#ifndef _LIBCPP_NO_EXCEPTIONS + _ForwardIterator __s = __r; + try + { +#endif + for (; __f != __l; ++__f, ++__r) + ::new(&*__r) value_type(*__f); +#ifndef _LIBCPP_NO_EXCEPTIONS + } + catch (...) + { + for (; __s != __r; ++__s) + __s->~value_type(); + throw; + } +#endif return __r; } @@ -2815,12 +3508,23 @@ template _ForwardIterator uninitialized_copy_n(_InputIterator __f, _Size __n, _ForwardIterator __r) { - __destruct_n __d(0); typedef typename iterator_traits<_ForwardIterator>::value_type value_type; - unique_ptr __h(&*__r, __d); - for (; __n > 0; ++__f, ++__r, __d.__incr((value_type*)0), --__n) - ::new(&*__r) value_type(*__f); - __h.release(); +#ifndef _LIBCPP_NO_EXCEPTIONS + _ForwardIterator __s = __r; + try + { +#endif + for (; __n > 0; ++__f, ++__r, --__n) + ::new(&*__r) value_type(*__f); +#ifndef _LIBCPP_NO_EXCEPTIONS + } + catch (...) + { + for (; __s != __r; ++__s) + __s->~value_type(); + throw; + } +#endif return __r; } @@ -2828,24 +3532,46 @@ template void uninitialized_fill(_ForwardIterator __f, _ForwardIterator __l, const _Tp& __x) { - __destruct_n __d(0); typedef typename iterator_traits<_ForwardIterator>::value_type value_type; - unique_ptr __h(&*__f, __d); - for (; __f != __l; ++__f, __d.__incr((value_type*)0)) - ::new(&*__f) value_type(__x); - __h.release(); +#ifndef _LIBCPP_NO_EXCEPTIONS + _ForwardIterator __s = __f; + try + { +#endif + for (; __f != __l; ++__f) + ::new(&*__f) value_type(__x); +#ifndef _LIBCPP_NO_EXCEPTIONS + } + catch (...) + { + for (; __s != __f; ++__s) + __s->~value_type(); + throw; + } +#endif } template _ForwardIterator uninitialized_fill_n(_ForwardIterator __f, _Size __n, const _Tp& __x) { - __destruct_n __d(0); typedef typename iterator_traits<_ForwardIterator>::value_type value_type; - unique_ptr __h(&*__f, __d); - for (; __n > 0; ++__f, --__n, __d.__incr((value_type*)0)) - ::new(&*__f) value_type(__x); - __h.release(); +#ifndef _LIBCPP_NO_EXCEPTIONS + _ForwardIterator __s = __f; + try + { +#endif + for (; __n > 0; ++__f, --__n) + ::new(&*__f) value_type(__x); +#ifndef _LIBCPP_NO_EXCEPTIONS + } + catch (...) + { + for (; __s != __f; ++__s) + __s->~value_type(); + throw; + } +#endif return __f; } @@ -2857,7 +3583,7 @@ public: virtual const char* what() const _NOEXCEPT; }; -template class weak_ptr; +template class _LIBCPP_VISIBLE weak_ptr; class __shared_count { @@ -2903,7 +3629,11 @@ public: long use_count() const _NOEXCEPT {return __shared_count::use_count();} __shared_weak_count* lock() _NOEXCEPT; -#ifndef _LIBCPP_NO_RTTI + // Define the function out only if we build static libc++ without RTTI. + // Otherwise we may break clients who need to compile their projects with + // -fno-rtti and yet link against a libc++.dylib compiled + // without -fno-rtti. +#if !defined(_LIBCPP_NO_RTTI) || !defined(_LIBCPP_BUILD_STATIC) virtual const void* __get_deleter(const type_info&) const _NOEXCEPT; #endif private: @@ -2972,7 +3702,8 @@ public: template _LIBCPP_INLINE_VISIBILITY __shared_ptr_emplace(_Alloc __a, _Args&& ...__args) - : __data_(_VSTD::move(__a), _Tp(_VSTD::forward<_Args>(__args)...)) {} + : __data_(piecewise_construct, _VSTD::forward_as_tuple(__a), + _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)) {} #else // _LIBCPP_HAS_NO_VARIADICS @@ -3021,7 +3752,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 @@ -3034,11 +3765,29 @@ private: struct __nat {int __for_bool_;}; public: - shared_ptr() _NOEXCEPT; - shared_ptr(nullptr_t) _NOEXCEPT; - template explicit shared_ptr(_Yp* __p); - template shared_ptr(_Yp* __p, _Dp __d); - template shared_ptr(_Yp* __p, _Dp __d, _Alloc __a); + _LIBCPP_CONSTEXPR shared_ptr() _NOEXCEPT; + _LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT; + template::value + >::type + > + explicit shared_ptr(_Yp* __p); + template::value + >::type + > + shared_ptr(_Yp* __p, _Dp __d); + template::value + >::type + > + shared_ptr(_Yp* __p, _Dp __d, _Alloc __a); template shared_ptr(nullptr_t __p, _Dp __d); template shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a); template shared_ptr(const shared_ptr<_Yp>& __r, element_type* __p) _NOEXCEPT; @@ -3056,50 +3805,134 @@ public: template explicit shared_ptr(const weak_ptr<_Yp>& __r, typename enable_if::value, __nat>::type= __nat()); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template shared_ptr(auto_ptr<_Yp>&& __r); + template::value + >::type + > + shared_ptr(auto_ptr<_Yp>&& __r); #else - template shared_ptr(auto_ptr<_Yp> __r); + template::value + >::type + > + shared_ptr(auto_ptr<_Yp> __r); #endif #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -private: - template shared_ptr(const unique_ptr<_Yp, _Dp>& __r);// = delete; -public: - template shared_ptr(unique_ptr<_Yp, _Dp>&&, + template ::value && + is_convertible::pointer, element_type*>::value + >::type + > + shared_ptr(unique_ptr<_Yp, _Dp>&&, typename enable_if::value, __nat>::type = __nat()); - template shared_ptr(unique_ptr<_Yp, _Dp>&&, + template ::value && + is_convertible::pointer, element_type*>::value + >::type + > + shared_ptr(unique_ptr<_Yp, _Dp>&&, typename enable_if::value, __nat>::type = __nat()); #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES - template shared_ptr(unique_ptr<_Yp, _Dp>, + template ::value && + is_convertible::pointer, element_type*>::value + >::type + > shared_ptr(unique_ptr<_Yp, _Dp>, typename enable_if::value, __nat>::type = __nat()); - template shared_ptr(unique_ptr<_Yp, _Dp>, + template ::value && + is_convertible::pointer, element_type*>::value + >::type + > + shared_ptr(unique_ptr<_Yp, _Dp>, typename enable_if::value, __nat>::type = __nat()); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES ~shared_ptr(); shared_ptr& operator=(const shared_ptr& __r) _NOEXCEPT; - template shared_ptr& operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT; + template + typename enable_if + < + is_convertible<_Yp*, element_type*>::value, + shared_ptr& + >::type + operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT; #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES shared_ptr& operator=(shared_ptr&& __r) _NOEXCEPT; - template shared_ptr& operator=(shared_ptr<_Yp>&& __r); - template shared_ptr& operator=(auto_ptr<_Yp>&& __r); + template + typename enable_if + < + is_convertible<_Yp*, element_type*>::value, + shared_ptr<_Tp>& + >::type + operator=(shared_ptr<_Yp>&& __r); + template + typename enable_if + < + !is_array<_Yp>::value && + is_convertible<_Yp*, element_type*>::value, + shared_ptr& + >::type + operator=(auto_ptr<_Yp>&& __r); #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES - template shared_ptr& operator=(auto_ptr<_Yp> __r); + template + typename enable_if + < + !is_array<_Yp>::value && + is_convertible<_Yp*, element_type*>::value, + shared_ptr& + >::type + operator=(auto_ptr<_Yp> __r); #endif + template + typename enable_if + < + !is_array<_Yp>::value && + is_convertible::pointer, element_type*>::value, + shared_ptr& + >::type #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -private: - template shared_ptr& operator=(const unique_ptr<_Yp, _Dp>& __r);// = delete; -public: - template shared_ptr& operator=(unique_ptr<_Yp, _Dp>&& __r); + operator=(unique_ptr<_Yp, _Dp>&& __r); #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES - template shared_ptr& operator=(unique_ptr<_Yp, _Dp> __r); + operator=(unique_ptr<_Yp, _Dp> __r); #endif void swap(shared_ptr& __r) _NOEXCEPT; void reset() _NOEXCEPT; - template void reset(_Yp* __p) _NOEXCEPT; - template void reset(_Yp* __p, _Dp __d); - template void reset(_Yp* __p, _Dp __d, _Alloc __a); + template + typename enable_if + < + is_convertible<_Yp*, element_type*>::value, + void + >::type + reset(_Yp* __p); + template + typename enable_if + < + is_convertible<_Yp*, element_type*>::value, + void + >::type + reset(_Yp* __p, _Dp __d); + template + typename enable_if + < + is_convertible<_Yp*, element_type*>::value, + void + >::type + reset(_Yp* __p, _Dp __d, _Alloc __a); _LIBCPP_INLINE_VISIBILITY element_type* get() const _NOEXCEPT {return __ptr_;} @@ -3113,15 +3946,19 @@ public: _LIBCPP_INLINE_VISIBILITY bool unique() const _NOEXCEPT {return use_count() == 1;} _LIBCPP_INLINE_VISIBILITY - /*explicit*/ operator bool() const _NOEXCEPT {return get() != 0;} - template + _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return get() != 0;} + template _LIBCPP_INLINE_VISIBILITY - bool owner_before(shared_ptr<_U> const& __p) const + bool owner_before(shared_ptr<_Up> const& __p) const {return __cntrl_ < __p.__cntrl_;} - template + template _LIBCPP_INLINE_VISIBILITY - bool owner_before(weak_ptr<_U> const& __p) const + bool owner_before(weak_ptr<_Up> 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 @@ -3193,6 +4030,7 @@ private: template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR shared_ptr<_Tp>::shared_ptr() _NOEXCEPT : __ptr_(0), __cntrl_(0) @@ -3201,6 +4039,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) @@ -3208,7 +4047,7 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t) _NOEXCEPT } template -template +template shared_ptr<_Tp>::shared_ptr(_Yp* __p) : __ptr_(__p) { @@ -3220,7 +4059,7 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p) } template -template +template shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d) : __ptr_(__p) { @@ -3263,7 +4102,7 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d) } template -template +template shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d, _Alloc __a) : __ptr_(__p) { @@ -3377,7 +4216,7 @@ shared_ptr<_Tp>::shared_ptr(shared_ptr<_Yp>&& __r, #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template -template +template #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES shared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp>&& __r) #else @@ -3392,7 +4231,7 @@ shared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp> __r) } template -template +template #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r, #else @@ -3408,7 +4247,7 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r, } template -template +template #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r, #else @@ -3629,7 +4468,11 @@ shared_ptr<_Tp>::operator=(const shared_ptr& __r) _NOEXCEPT template template inline _LIBCPP_INLINE_VISIBILITY -shared_ptr<_Tp>& +typename enable_if +< + is_convertible<_Yp*, _Tp*>::value, + shared_ptr<_Tp>& +>::type shared_ptr<_Tp>::operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT { shared_ptr(__r).swap(*this); @@ -3650,7 +4493,11 @@ shared_ptr<_Tp>::operator=(shared_ptr&& __r) _NOEXCEPT template template inline _LIBCPP_INLINE_VISIBILITY -shared_ptr<_Tp>& +typename enable_if +< + is_convertible<_Yp*, _Tp*>::value, + shared_ptr<_Tp>& +>::type shared_ptr<_Tp>::operator=(shared_ptr<_Yp>&& __r) { shared_ptr(_VSTD::move(__r)).swap(*this); @@ -3660,7 +4507,12 @@ shared_ptr<_Tp>::operator=(shared_ptr<_Yp>&& __r) template template inline _LIBCPP_INLINE_VISIBILITY -shared_ptr<_Tp>& +typename enable_if +< + !is_array<_Yp>::value && + is_convertible<_Yp*, _Tp*>::value, + shared_ptr<_Tp>& +>::type shared_ptr<_Tp>::operator=(auto_ptr<_Yp>&& __r) { shared_ptr(_VSTD::move(__r)).swap(*this); @@ -3670,7 +4522,12 @@ shared_ptr<_Tp>::operator=(auto_ptr<_Yp>&& __r) template template inline _LIBCPP_INLINE_VISIBILITY -shared_ptr<_Tp>& +typename enable_if +< + !is_array<_Yp>::value && + is_convertible::pointer, _Tp*>::value, + shared_ptr<_Tp>& +>::type shared_ptr<_Tp>::operator=(unique_ptr<_Yp, _Dp>&& __r) { shared_ptr(_VSTD::move(__r)).swap(*this); @@ -3682,7 +4539,12 @@ shared_ptr<_Tp>::operator=(unique_ptr<_Yp, _Dp>&& __r) template template inline _LIBCPP_INLINE_VISIBILITY -shared_ptr<_Tp>& +typename enable_if +< + !is_array<_Yp>::value && + is_convertible<_Yp*, _Tp*>::value, + shared_ptr<_Tp>& +>::type shared_ptr<_Tp>::operator=(auto_ptr<_Yp> __r) { shared_ptr(__r).swap(*this); @@ -3692,7 +4554,12 @@ shared_ptr<_Tp>::operator=(auto_ptr<_Yp> __r) template template inline _LIBCPP_INLINE_VISIBILITY -shared_ptr<_Tp>& +typename enable_if +< + !is_array<_Yp>::value && + is_convertible::pointer, _Tp*>::value, + shared_ptr<_Tp>& +>::type shared_ptr<_Tp>::operator=(unique_ptr<_Yp, _Dp> __r) { shared_ptr(_VSTD::move(__r)).swap(*this); @@ -3721,7 +4588,11 @@ shared_ptr<_Tp>::reset() _NOEXCEPT template template inline _LIBCPP_INLINE_VISIBILITY -void +typename enable_if +< + is_convertible<_Yp*, _Tp*>::value, + void +>::type shared_ptr<_Tp>::reset(_Yp* __p) { shared_ptr(__p).swap(*this); @@ -3730,7 +4601,11 @@ shared_ptr<_Tp>::reset(_Yp* __p) template template inline _LIBCPP_INLINE_VISIBILITY -void +typename enable_if +< + is_convertible<_Yp*, _Tp*>::value, + void +>::type shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d) { shared_ptr(__p, __d).swap(*this); @@ -3739,7 +4614,11 @@ shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d) template template inline _LIBCPP_INLINE_VISIBILITY -void +typename enable_if +< + is_convertible<_Yp*, _Tp*>::value, + void +>::type shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d, _Alloc __a) { shared_ptr(__p, __d, __a).swap(*this); @@ -3749,7 +4628,11 @@ shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d, _Alloc __a) template inline _LIBCPP_INLINE_VISIBILITY -shared_ptr<_Tp> +typename enable_if +< + !is_array<_Tp>::value, + shared_ptr<_Tp> +>::type make_shared(_Args&& ...__args) { return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...); @@ -3757,7 +4640,11 @@ make_shared(_Args&& ...__args) template inline _LIBCPP_INLINE_VISIBILITY -shared_ptr<_Tp> +typename enable_if +< + !is_array<_Tp>::value, + shared_ptr<_Tp> +>::type allocate_shared(const _Alloc& __a, _Args&& ...__args) { return shared_ptr<_Tp>::allocate_shared(__a, _VSTD::forward<_Args>(__args)...); @@ -3852,7 +4739,128 @@ inline _LIBCPP_INLINE_VISIBILITY bool operator<(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT { - return __x.get() < __y.get(); + typedef typename common_type<_Tp*, _Up*>::type _V; + return less<_V>()(__x.get(), __y.get()); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator>(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT +{ + return __y < __x; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator<=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT +{ + return !(__y < __x); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator>=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT +{ + return !(__x < __y); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator==(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT +{ + return !__x; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator==(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT +{ + return !__x; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator!=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT +{ + return static_cast(__x); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator!=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT +{ + return static_cast(__x); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator<(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT +{ + return less<_Tp*>()(__x.get(), nullptr); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator<(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT +{ + return less<_Tp*>()(nullptr, __x.get()); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator>(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT +{ + return nullptr < __x; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator>(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT +{ + return __x < nullptr; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator<=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT +{ + return !(nullptr < __x); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator<=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT +{ + return !(__x < nullptr); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator>=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT +{ + return !(__x < nullptr); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +bool +operator>=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT +{ + return !(nullptr < __x); } template @@ -3865,7 +4873,11 @@ swap(shared_ptr<_Tp>& __x, shared_ptr<_Tp>& __y) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -shared_ptr<_Tp> +typename enable_if +< + !is_array<_Tp>::value && !is_array<_Up>::value, + shared_ptr<_Tp> +>::type static_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT { return shared_ptr<_Tp>(__r, static_cast<_Tp*>(__r.get())); @@ -3873,7 +4885,11 @@ static_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -shared_ptr<_Tp> +typename enable_if +< + !is_array<_Tp>::value && !is_array<_Up>::value, + shared_ptr<_Tp> +>::type dynamic_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT { _Tp* __p = dynamic_cast<_Tp*>(__r.get()); @@ -3881,10 +4897,15 @@ dynamic_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT } template -shared_ptr<_Tp> +typename enable_if +< + is_array<_Tp>::value == is_array<_Up>::value, + shared_ptr<_Tp> +>::type const_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT { - return shared_ptr<_Tp>(__r, const_cast<_Tp*>(__r.get())); + typedef typename remove_extent<_Tp>::type _RTp; + return shared_ptr<_Tp>(__r, const_cast<_RTp*>(__r.get())); } #ifndef _LIBCPP_NO_RTTI @@ -3909,7 +4930,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; @@ -3918,11 +4939,43 @@ public: typename enable_if::value, __nat*>::type = 0) _NOEXCEPT; +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + weak_ptr(weak_ptr&& __r) _NOEXCEPT; + template weak_ptr(weak_ptr<_Yp>&& __r, + typename enable_if::value, __nat*>::type = 0) + _NOEXCEPT; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES ~weak_ptr(); weak_ptr& operator=(weak_ptr const& __r) _NOEXCEPT; - template weak_ptr& operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT; - template weak_ptr& operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT; + template + typename enable_if + < + is_convertible<_Yp*, element_type*>::value, + weak_ptr& + >::type + operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT; + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + + weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT; + template + typename enable_if + < + is_convertible<_Yp*, element_type*>::value, + weak_ptr& + >::type + operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT; + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + + template + typename enable_if + < + is_convertible<_Yp*, element_type*>::value, + weak_ptr& + >::type + operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT; void swap(weak_ptr& __r) _NOEXCEPT; void reset() _NOEXCEPT; @@ -3949,6 +5002,7 @@ public: template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR weak_ptr<_Tp>::weak_ptr() _NOEXCEPT : __ptr_(0), __cntrl_(0) @@ -3991,6 +5045,33 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r, __cntrl_->__add_weak(); } +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + +template +inline _LIBCPP_INLINE_VISIBILITY +weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT + : __ptr_(__r.__ptr_), + __cntrl_(__r.__cntrl_) +{ + __r.__ptr_ = 0; + __r.__cntrl_ = 0; +} + +template +template +inline _LIBCPP_INLINE_VISIBILITY +weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r, + typename enable_if::value, __nat*>::type) + _NOEXCEPT + : __ptr_(__r.__ptr_), + __cntrl_(__r.__cntrl_) +{ + __r.__ptr_ = 0; + __r.__cntrl_ = 0; +} + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + template weak_ptr<_Tp>::~weak_ptr() { @@ -4010,17 +5091,52 @@ weak_ptr<_Tp>::operator=(weak_ptr const& __r) _NOEXCEPT template template inline _LIBCPP_INLINE_VISIBILITY -weak_ptr<_Tp>& +typename enable_if +< + is_convertible<_Yp*, _Tp*>::value, + weak_ptr<_Tp>& +>::type weak_ptr<_Tp>::operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT { weak_ptr(__r).swap(*this); return *this; } +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template -template inline _LIBCPP_INLINE_VISIBILITY weak_ptr<_Tp>& +weak_ptr<_Tp>::operator=(weak_ptr&& __r) _NOEXCEPT +{ + weak_ptr(_VSTD::move(__r)).swap(*this); + return *this; +} + +template +template +inline _LIBCPP_INLINE_VISIBILITY +typename enable_if +< + is_convertible<_Yp*, _Tp*>::value, + weak_ptr<_Tp>& +>::type +weak_ptr<_Tp>::operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT +{ + weak_ptr(_VSTD::move(__r)).swap(*this); + return *this; +} + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +template +template +inline _LIBCPP_INLINE_VISIBILITY +typename enable_if +< + is_convertible<_Yp*, _Tp*>::value, + weak_ptr<_Tp>& +>::type weak_ptr<_Tp>::operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT { weak_ptr(__r).swap(*this); @@ -4117,7 +5233,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 {} @@ -4149,25 +5265,153 @@ struct _LIBCPP_VISIBLE hash > } }; -template +template inline _LIBCPP_INLINE_VISIBILITY basic_ostream<_CharT, _Traits>& -operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Y> const& __p); +operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p); + +#if __has_feature(cxx_atomic) + +class __sp_mut +{ + void* __lx; +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 { - enum _ + enum __lx { relaxed, preferred, strict }; - _ __v_; + __lx __v_; _LIBCPP_INLINE_VISIBILITY - pointer_safety(_ __v) : __v_(__v) {} + pointer_safety(__lx __v) : __v_(__v) {} _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;} }; diff --git a/system/include/libcxx/mutex b/system/include/libcxx/mutex index 297baca5257e6..ee20f021ea9b3 100644 --- a/system/include/libcxx/mutex +++ b/system/include/libcxx/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; @@ -179,7 +179,11 @@ template #include #endif +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -197,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 @@ -220,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 @@ -263,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 @@ -421,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; @@ -460,23 +466,23 @@ private: #ifndef _LIBCPP_HAS_NO_VARIADICS -template +template class __call_once_param { - _F __f_; + _Fp __f_; public: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - explicit __call_once_param(_F&& __f) : __f_(_VSTD::move(__f)) {} + explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {} #else _LIBCPP_INLINE_VISIBILITY - explicit __call_once_param(const _F& __f) : __f_(__f) {} + explicit __call_once_param(const _Fp& __f) : __f_(__f) {} #endif _LIBCPP_INLINE_VISIBILITY void operator()() { - typedef typename __make_tuple_indices::value, 1>::type _Index; + typedef typename __make_tuple_indices::value, 1>::type _Index; __execute(_Index()); } @@ -491,17 +497,17 @@ private: #else -template +template class __call_once_param { - _F __f_; + _Fp __f_; public: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - explicit __call_once_param(_F&& __f) : __f_(_VSTD::move(__f)) {} + explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {} #else _LIBCPP_INLINE_VISIBILITY - explicit __call_once_param(const _F& __f) : __f_(__f) {} + explicit __call_once_param(const _Fp& __f) : __f_(__f) {} #endif _LIBCPP_INLINE_VISIBILITY @@ -513,11 +519,11 @@ public: #endif -template +template void __call_once_proxy(void* __vp) { - __call_once_param<_F>* __p = static_cast<__call_once_param<_F>*>(__vp); + __call_once_param<_Fp>* __p = static_cast<__call_once_param<_Fp>*>(__vp); (*__p)(); } @@ -530,12 +536,12 @@ inline _LIBCPP_INLINE_VISIBILITY void call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args) { - if (__builtin_expect(__flag.__state_ , ~0ul) != ~0ul) + if (__flag.__state_ != ~0ul) { - typedef tuple::type, typename decay<_Args>::type...> _G; - __call_once_param<_G> __p(_G(__decay_copy(_VSTD::forward<_Callable>(__func)), + typedef tuple::type, typename decay<_Args>::type...> _Gp; + __call_once_param<_Gp> __p(_Gp(__decay_copy(_VSTD::forward<_Callable>(__func)), __decay_copy(_VSTD::forward<_Args>(__args))...)); - __call_once(__flag.__state_, &__p, &__call_once_proxy<_G>); + __call_once(__flag.__state_, &__p, &__call_once_proxy<_Gp>); } } diff --git a/system/include/libcxx/new b/system/include/libcxx/new index 81c16bdfc97b9..ae0951a7485aa 100644 --- a/system/include/libcxx/new +++ b/system/include/libcxx/new @@ -56,7 +56,9 @@ void operator delete[](void* ptr, void*) noexcept; #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif namespace std // purposefully not using versioning namespace { @@ -94,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; @@ -103,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/system/include/libcxx/numeric b/system/include/libcxx/numeric index 31493990aefc2..c201a5f57cbbb 100644 --- a/system/include/libcxx/numeric +++ b/system/include/libcxx/numeric @@ -60,7 +60,9 @@ template #include <__config> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -184,10 +186,10 @@ adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterat template inline _LIBCPP_INLINE_VISIBILITY void -iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value) +iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_) { - for (; __first != __last; ++__first, ++__value) - *__first = __value; + for (; __first != __last; ++__first, ++__value_) + *__first = __value_; } _LIBCPP_END_NAMESPACE_STD diff --git a/system/include/libcxx/ostream b/system/include/libcxx/ostream index f1a3de9c6df49..b3b6df573d046 100644 --- a/system/include/libcxx/ostream +++ b/system/include/libcxx/ostream @@ -133,7 +133,9 @@ template #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -167,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&)); @@ -218,7 +220,7 @@ public: ~sentry(); _LIBCPP_ALWAYS_INLINE - // explicit + _LIBCPP_EXPLICIT operator bool() const {return __ok_;} }; @@ -340,11 +342,11 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf _I; - typedef ostreambuf_iterator<_CharT, _Traits> _O; - _I __i(__sb); - _I __eof; - _O __o(*this); + typedef istreambuf_iterator<_CharT, _Traits> _Ip; + typedef ostreambuf_iterator<_CharT, _Traits> _Op; + _Ip __i(__sb); + _Ip __eof; + _Op __o(*this); size_t __c = 0; for (; __i != __eof; ++__i, ++__o, ++__c) { @@ -386,8 +388,8 @@ basic_ostream<_CharT, _Traits>::operator<<(bool __n) sentry __s(*this); if (__s) { - typedef num_put > _F; - const _F& __f = use_facet<_F>(this->getloc()); + typedef num_put > _Fp; + const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } @@ -413,8 +415,8 @@ basic_ostream<_CharT, _Traits>::operator<<(short __n) if (__s) { ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield; - typedef num_put > _F; - const _F& __f = use_facet<_F>(this->getloc()); + typedef num_put > _Fp; + const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __flags == ios_base::oct || __flags == ios_base::hex ? static_cast(static_cast(__n)) : @@ -442,8 +444,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n) sentry __s(*this); if (__s) { - typedef num_put > _F; - const _F& __f = use_facet<_F>(this->getloc()); + typedef num_put > _Fp; + const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), static_cast(__n)).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } @@ -469,8 +471,8 @@ basic_ostream<_CharT, _Traits>::operator<<(int __n) if (__s) { ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield; - typedef num_put > _F; - const _F& __f = use_facet<_F>(this->getloc()); + typedef num_put > _Fp; + const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __flags == ios_base::oct || __flags == ios_base::hex ? static_cast(static_cast(__n)) : @@ -498,8 +500,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n) sentry __s(*this); if (__s) { - typedef num_put > _F; - const _F& __f = use_facet<_F>(this->getloc()); + typedef num_put > _Fp; + const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), static_cast(__n)).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } @@ -524,8 +526,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long __n) sentry __s(*this); if (__s) { - typedef num_put > _F; - const _F& __f = use_facet<_F>(this->getloc()); + typedef num_put > _Fp; + const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } @@ -550,8 +552,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n) sentry __s(*this); if (__s) { - typedef num_put > _F; - const _F& __f = use_facet<_F>(this->getloc()); + typedef num_put > _Fp; + const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } @@ -576,8 +578,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long long __n) sentry __s(*this); if (__s) { - typedef num_put > _F; - const _F& __f = use_facet<_F>(this->getloc()); + typedef num_put > _Fp; + const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } @@ -602,8 +604,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n) sentry __s(*this); if (__s) { - typedef num_put > _F; - const _F& __f = use_facet<_F>(this->getloc()); + typedef num_put > _Fp; + const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } @@ -628,8 +630,8 @@ basic_ostream<_CharT, _Traits>::operator<<(float __n) sentry __s(*this); if (__s) { - typedef num_put > _F; - const _F& __f = use_facet<_F>(this->getloc()); + typedef num_put > _Fp; + const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), static_cast(__n)).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } @@ -654,8 +656,8 @@ basic_ostream<_CharT, _Traits>::operator<<(double __n) sentry __s(*this); if (__s) { - typedef num_put > _F; - const _F& __f = use_facet<_F>(this->getloc()); + typedef num_put > _Fp; + const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } @@ -680,8 +682,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long double __n) sentry __s(*this); if (__s) { - typedef num_put > _F; - const _F& __f = use_facet<_F>(this->getloc()); + typedef num_put > _Fp; + const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } @@ -706,8 +708,8 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n) sentry __s(*this); if (__s) { - typedef num_put > _F; - const _F& __f = use_facet<_F>(this->getloc()); + typedef num_put > _Fp; + const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } @@ -732,8 +734,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c) typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { - typedef ostreambuf_iterator<_CharT, _Traits> _I; - if (__pad_and_output(_I(__os), + typedef ostreambuf_iterator<_CharT, _Traits> _Ip; + if (__pad_and_output(_Ip(__os), &__c, (__os.flags() & ios_base::adjustfield) == ios_base::left ? &__c + 1 : @@ -765,8 +767,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn) if (__s) { _CharT __c = __os.widen(__cn); - typedef ostreambuf_iterator<_CharT, _Traits> _I; - if (__pad_and_output(_I(__os), + typedef ostreambuf_iterator<_CharT, _Traits> _Ip; + if (__pad_and_output(_Ip(__os), &__c, (__os.flags() & ios_base::adjustfield) == ios_base::left ? &__c + 1 : @@ -797,8 +799,8 @@ operator<<(basic_ostream& __os, char __c) typename basic_ostream::sentry __s(__os); if (__s) { - typedef ostreambuf_iterator _I; - if (__pad_and_output(_I(__os), + typedef ostreambuf_iterator _Ip; + if (__pad_and_output(_Ip(__os), &__c, (__os.flags() & ios_base::adjustfield) == ios_base::left ? &__c + 1 : @@ -829,8 +831,8 @@ operator<<(basic_ostream& __os, signed char __c) typename basic_ostream::sentry __s(__os); if (__s) { - typedef ostreambuf_iterator _I; - if (__pad_and_output(_I(__os), + typedef ostreambuf_iterator _Ip; + if (__pad_and_output(_Ip(__os), (char*)&__c, (__os.flags() & ios_base::adjustfield) == ios_base::left ? (char*)&__c + 1 : @@ -861,8 +863,8 @@ operator<<(basic_ostream& __os, unsigned char __c) typename basic_ostream::sentry __s(__os); if (__s) { - typedef ostreambuf_iterator _I; - if (__pad_and_output(_I(__os), + typedef ostreambuf_iterator _Ip; + if (__pad_and_output(_Ip(__os), (char*)&__c, (__os.flags() & ios_base::adjustfield) == ios_base::left ? (char*)&__c + 1 : @@ -893,9 +895,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str) typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { - typedef ostreambuf_iterator<_CharT, _Traits> _I; + typedef ostreambuf_iterator<_CharT, _Traits> _Ip; size_t __len = _Traits::length(__str); - if (__pad_and_output(_I(__os), + if (__pad_and_output(_Ip(__os), __str, (__os.flags() & ios_base::adjustfield) == ios_base::left ? __str + __len : @@ -926,7 +928,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn) typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { - typedef ostreambuf_iterator<_CharT, _Traits> _I; + typedef ostreambuf_iterator<_CharT, _Traits> _Ip; size_t __len = char_traits::length(__strn); const int __bs = 100; _CharT __wbb[__bs]; @@ -941,7 +943,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn) } for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p) *__p = __os.widen(*__strn); - if (__pad_and_output(_I(__os), + if (__pad_and_output(_Ip(__os), __wb, (__os.flags() & ios_base::adjustfield) == ios_base::left ? __wb + __len : @@ -972,9 +974,9 @@ operator<<(basic_ostream& __os, const char* __str) typename basic_ostream::sentry __s(__os); if (__s) { - typedef ostreambuf_iterator _I; + typedef ostreambuf_iterator _Ip; size_t __len = _Traits::length(__str); - if (__pad_and_output(_I(__os), + if (__pad_and_output(_Ip(__os), __str, (__os.flags() & ios_base::adjustfield) == ios_base::left ? __str + __len : @@ -1005,9 +1007,9 @@ operator<<(basic_ostream& __os, const signed char* __str) typename basic_ostream::sentry __s(__os); if (__s) { - typedef ostreambuf_iterator _I; + typedef ostreambuf_iterator _Ip; size_t __len = _Traits::length((const char*)__str); - if (__pad_and_output(_I(__os), + if (__pad_and_output(_Ip(__os), (const char*)__str, (__os.flags() & ios_base::adjustfield) == ios_base::left ? (const char*)__str + __len : @@ -1038,9 +1040,9 @@ operator<<(basic_ostream& __os, const unsigned char* __str) typename basic_ostream::sentry __s(__os); if (__s) { - typedef ostreambuf_iterator _I; + typedef ostreambuf_iterator _Ip; size_t __len = _Traits::length((const char*)__str); - if (__pad_and_output(_I(__os), + if (__pad_and_output(_Ip(__os), (const char*)__str, (__os.flags() & ios_base::adjustfield) == ios_base::left ? (const char*)__str + __len : @@ -1071,8 +1073,8 @@ basic_ostream<_CharT, _Traits>::put(char_type __c) sentry __s(*this); if (__s) { - typedef ostreambuf_iterator<_CharT, _Traits> _O; - _O __o(*this); + typedef ostreambuf_iterator<_CharT, _Traits> _Op; + _Op __o(*this); *__o = __c; if (__o.failed()) this->setstate(ios_base::badbit); @@ -1098,17 +1100,8 @@ basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n) sentry __sen(*this); if (__sen && __n) { - typedef ostreambuf_iterator<_CharT, _Traits> _O; - _O __o(*this); - for (; __n; --__n, ++__o, ++__s) - { - *__o = *__s; - if (__o.failed()) - { - this->setstate(ios_base::badbit); - break; - } - } + if (this->rdbuf()->sputn(__s, __n) != __n) + this->setstate(ios_base::badbit); } #ifndef _LIBCPP_NO_EXCEPTIONS } @@ -1216,12 +1209,12 @@ typename enable_if < !is_lvalue_reference<_Stream>::value && is_base_of::value, - _Stream& + _Stream&& >::type operator<<(_Stream&& __os, const _Tp& __x) { __os << __x; - return __os; + return _VSTD::move(__os); } #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -1238,9 +1231,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { - typedef ostreambuf_iterator<_CharT, _Traits> _I; + typedef ostreambuf_iterator<_CharT, _Traits> _Ip; size_t __len = __str.size(); - if (__pad_and_output(_I(__os), + if (__pad_and_output(_Ip(__os), __str.data(), (__os.flags() & ios_base::adjustfield) == ios_base::left ? __str.data() + __len : @@ -1268,10 +1261,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec) return __os << __ec.category().name() << ':' << __ec.value(); } -template +template inline _LIBCPP_INLINE_VISIBILITY basic_ostream<_CharT, _Traits>& -operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Y> const& __p) +operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p) { return __os << __p.get(); } @@ -1285,8 +1278,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x) use_facet >(__os.getloc()).widen('1')); } -extern template class basic_ostream; -extern template class basic_ostream; +_LIBCPP_EXTERN_TEMPLATE(class basic_ostream) +_LIBCPP_EXTERN_TEMPLATE(class basic_ostream) _LIBCPP_END_NAMESPACE_STD diff --git a/system/include/libcxx/queue b/system/include/libcxx/queue index bed5bb7af1bca..4741f0035cac8 100644 --- a/system/include/libcxx/queue +++ b/system/include/libcxx/queue @@ -171,17 +171,21 @@ template #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _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/system/include/libcxx/random b/system/include/libcxx/random index 0e0860e7398e3..04d942bc87663 100644 --- a/system/include/libcxx/random +++ b/system/include/libcxx/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; @@ -1646,7 +1646,11 @@ class piecewise_linear_distribution #include #include +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -1655,7 +1659,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template struct __is_seed_sequence { - static const bool value = + static _LIBCPP_CONSTEXPR const bool value = !is_convertible<_Sseq, typename _Engine::result_type>::value && !is_same::type, _Engine>::value; }; @@ -1663,8 +1667,8 @@ struct __is_seed_sequence // linear_congruential_engine template (_M-__c)/__a)> + unsigned long long __m, unsigned long long _Mp, + bool _MightOverflow = (__a != 0 && __m != 0 && __m-1 > (_Mp-__c)/__a)> struct __lce_ta; // 64 @@ -1728,16 +1732,16 @@ struct __lce_ta<__a, __c, 0, (unsigned long long)(~0), false> // 32 -template -struct __lce_ta<_A, _C, _M, unsigned(~0), true> +template +struct __lce_ta<_Ap, _Cp, _Mp, unsigned(~0), true> { typedef unsigned result_type; _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { - const result_type __a = static_cast(_A); - const result_type __c = static_cast(_C); - const result_type __m = static_cast(_M); + const result_type __a = static_cast(_Ap); + const result_type __c = static_cast(_Cp); + const result_type __m = static_cast(_Mp); // Schrage's algorithm const result_type __q = __m / __a; const result_type __r = __m % __a; @@ -1749,15 +1753,15 @@ struct __lce_ta<_A, _C, _M, unsigned(~0), true> } }; -template -struct __lce_ta<_A, 0, _M, unsigned(~0), true> +template +struct __lce_ta<_Ap, 0, _Mp, unsigned(~0), true> { typedef unsigned result_type; _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { - const result_type __a = static_cast(_A); - const result_type __m = static_cast(_M); + const result_type __a = static_cast(_Ap); + const result_type __m = static_cast(_Mp); // Schrage's algorithm const result_type __q = __m / __a; const result_type __r = __m % __a; @@ -1768,29 +1772,29 @@ struct __lce_ta<_A, 0, _M, unsigned(~0), true> } }; -template -struct __lce_ta<_A, _C, _M, unsigned(~0), false> +template +struct __lce_ta<_Ap, _Cp, _Mp, unsigned(~0), false> { typedef unsigned result_type; _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { - const result_type __a = static_cast(_A); - const result_type __c = static_cast(_C); - const result_type __m = static_cast(_M); + const result_type __a = static_cast(_Ap); + const result_type __c = static_cast(_Cp); + const result_type __m = static_cast(_Mp); return (__a * __x + __c) % __m; } }; -template -struct __lce_ta<_A, _C, 0, unsigned(~0), false> +template +struct __lce_ta<_Ap, _Cp, 0, unsigned(~0), false> { typedef unsigned result_type; _LIBCPP_INLINE_VISIBILITY static result_type next(result_type __x) { - const result_type __a = static_cast(_A); - const result_type __c = static_cast(_C); + const result_type __a = static_cast(_Ap); + const result_type __c = static_cast(_Cp); return __a * __x + __c; } }; @@ -1809,19 +1813,20 @@ struct __lce_ta<__a, __c, __m, (unsigned short)(~0), __b> }; template -class linear_congruential_engine; +class _LIBCPP_VISIBLE linear_congruential_engine; template + class _Up, _Up _Ap, _Up _Cp, _Up _Np> +_LIBCPP_INLINE_VISIBILITY basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const linear_congruential_engine<_U, _A, _C, _N>&); + const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&); template + class _Up, _Up _Ap, _Up _Cp, _Up _Np> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - linear_congruential_engine<_U, _A, _C, _N>& __x); + linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x); template class _LIBCPP_VISIBLE linear_congruential_engine @@ -1833,31 +1838,32 @@ public: private: result_type __x_; - static const result_type _M = result_type(~0); + static _LIBCPP_CONSTEXPR const result_type _Mp = result_type(~0); static_assert(__m == 0 || __a < __m, "linear_congruential_engine invalid parameters"); static_assert(__m == 0 || __c < __m, "linear_congruential_engine invalid parameters"); public: - static const result_type _Min = __c == 0u ? 1u: 0u; - static const result_type _Max = __m - 1u; + static _LIBCPP_CONSTEXPR const result_type _Min = __c == 0u ? 1u: 0u; + static _LIBCPP_CONSTEXPR const result_type _Max = __m - 1u; static_assert(_Min < _Max, "linear_congruential_engine invalid parameters"); // engine characteristics - static const/*expr*/ result_type multiplier = __a; - static const/*expr*/ result_type increment = __c; - static const/*expr*/ result_type modulus = __m; + static _LIBCPP_CONSTEXPR const result_type multiplier = __a; + static _LIBCPP_CONSTEXPR const result_type increment = __c; + static _LIBCPP_CONSTEXPR const result_type modulus = __m; _LIBCPP_INLINE_VISIBILITY - static const/*expr*/ result_type min() {return _Min;} + static _LIBCPP_CONSTEXPR result_type min() {return _Min;} _LIBCPP_INLINE_VISIBILITY - static const/*expr*/ result_type max() {return _Max;} - static const/*expr*/ result_type default_seed = 1u; + static _LIBCPP_CONSTEXPR result_type max() {return _Max;} + static _LIBCPP_CONSTEXPR const result_type default_seed = 1u; // constructors and seeding functions _LIBCPP_INLINE_VISIBILITY explicit linear_congruential_engine(result_type __s = default_seed) {seed(__s);} - template explicit linear_congruential_engine(_Sseq& __q, + template _LIBCPP_INLINE_VISIBILITY + explicit linear_congruential_engine(_Sseq& __q, typename enable_if<__is_seed_sequence<_Sseq, linear_congruential_engine>::value>::type* = 0) {seed(__q);} _LIBCPP_INLINE_VISIBILITY @@ -1879,7 +1885,7 @@ public: // generating functions _LIBCPP_INLINE_VISIBILITY result_type operator()() - {return __x_ = static_cast(__lce_ta<__a, __c, __m, _M>::next(__x_));} + {return __x_ = static_cast(__lce_ta<__a, __c, __m, _Mp>::next(__x_));} _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} @@ -1910,20 +1916,36 @@ private: void __seed(_Sseq& __q, integral_constant); template + class _Up, _Up _Ap, _Up _Cp, _Up _Np> friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const linear_congruential_engine<_U, _A, _C, _N>&); + const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&); template + class _Up, _Up _Ap, _Up _Cp, _Up _Np> friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - linear_congruential_engine<_U, _A, _C, _N>& __x); + linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x); }; +template + _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type + linear_congruential_engine<_UIntType, __a, __c, __m>::multiplier; + +template + _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type + linear_congruential_engine<_UIntType, __a, __c, __m>::increment; + +template + _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type + linear_congruential_engine<_UIntType, __a, __c, __m>::modulus; + +template + _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type + linear_congruential_engine<_UIntType, __a, __c, __m>::default_seed; + template template void @@ -1985,7 +2007,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const linear_congruential_engine<_UIntType, __a, __c, __m>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left); __os.fill(__os.widen(' ')); return __os << __x.__x_; @@ -1997,7 +2019,7 @@ basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, linear_congruential_engine<_UIntType, __a, __c, __m>& __x) { - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); _UIntType __t; __is >> __t; @@ -2016,43 +2038,44 @@ typedef minstd_rand default_random_engine; template -class mersenne_twister_engine; +class _LIBCPP_VISIBLE mersenne_twister_engine; -template +template bool -operator==(const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, - _B, _T, _C, _L, _F>& __x, - const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, - _B, _T, _C, _L, _F>& __y); - -template +operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + _Bp, _Tp, _Cp, _Lp, _Fp>& __x, + const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + _Bp, _Tp, _Cp, _Lp, _Fp>& __y); + +template +_LIBCPP_INLINE_VISIBILITY bool -operator!=(const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, - _B, _T, _C, _L, _F>& __x, - const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, - _B, _T, _C, _L, _F>& __y); +operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + _Bp, _Tp, _Cp, _Lp, _Fp>& __x, + const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + _Bp, _Tp, _Cp, _Lp, _Fp>& __y); template + class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, + _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, - _B, _T, _C, _L, _F>& __x); + const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + _Bp, _Tp, _Cp, _Lp, _Fp>& __x); template + class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, + _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, - _B, _T, _C, _L, _F>& __x); + mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + _Bp, _Tp, _Cp, _Lp, _Fp>& __x); template ::digits; + static _LIBCPP_CONSTEXPR const result_type _Dt = numeric_limits::digits; static_assert(__w <= _Dt, "mersenne_twister_engine invalid parameters"); static_assert( 2 <= __w, "mersenne_twister_engine invalid parameters"); static_assert(__r <= __w, "mersenne_twister_engine invalid parameters"); @@ -2078,9 +2101,9 @@ private: static_assert(__t <= __w, "mersenne_twister_engine invalid parameters"); static_assert(__l <= __w, "mersenne_twister_engine invalid parameters"); public: - static const result_type _Min = 0; - static const result_type _Max = __w == _Dt ? result_type(~0) : - (result_type(1) << __w) - result_type(1); + static _LIBCPP_CONSTEXPR const result_type _Min = 0; + static _LIBCPP_CONSTEXPR const result_type _Max = __w == _Dt ? result_type(~0) : + (result_type(1) << __w) - result_type(1); static_assert(_Min < _Max, "mersenne_twister_engine invalid parameters"); static_assert(__a <= _Max, "mersenne_twister_engine invalid parameters"); static_assert(__b <= _Max, "mersenne_twister_engine invalid parameters"); @@ -2089,31 +2112,32 @@ public: static_assert(__f <= _Max, "mersenne_twister_engine invalid parameters"); // engine characteristics - static const/*expr*/ size_t word_size = __w; - static const/*expr*/ size_t state_size = __n; - static const/*expr*/ size_t shift_size = __m; - static const/*expr*/ size_t mask_bits = __r; - static const/*expr*/ result_type xor_mask = __a; - static const/*expr*/ size_t tempering_u = __u; - static const/*expr*/ result_type tempering_d = __d; - static const/*expr*/ size_t tempering_s = __s; - static const/*expr*/ result_type tempering_b = __b; - static const/*expr*/ size_t tempering_t = __t; - static const/*expr*/ result_type tempering_c = __c; - static const/*expr*/ size_t tempering_l = __l; - static const/*expr*/ result_type initialization_multiplier = __f; - _LIBCPP_INLINE_VISIBILITY - static const/*expr*/ result_type min() { return _Min; } - _LIBCPP_INLINE_VISIBILITY - static const/*expr*/ result_type max() { return _Max; } - static const/*expr*/ result_type default_seed = 5489u; + static _LIBCPP_CONSTEXPR const size_t word_size = __w; + static _LIBCPP_CONSTEXPR const size_t state_size = __n; + static _LIBCPP_CONSTEXPR const size_t shift_size = __m; + static _LIBCPP_CONSTEXPR const size_t mask_bits = __r; + static _LIBCPP_CONSTEXPR const result_type xor_mask = __a; + static _LIBCPP_CONSTEXPR const size_t tempering_u = __u; + static _LIBCPP_CONSTEXPR const result_type tempering_d = __d; + static _LIBCPP_CONSTEXPR const size_t tempering_s = __s; + static _LIBCPP_CONSTEXPR const result_type tempering_b = __b; + static _LIBCPP_CONSTEXPR const size_t tempering_t = __t; + static _LIBCPP_CONSTEXPR const result_type tempering_c = __c; + static _LIBCPP_CONSTEXPR const size_t tempering_l = __l; + static _LIBCPP_CONSTEXPR const result_type initialization_multiplier = __f; + _LIBCPP_INLINE_VISIBILITY + static _LIBCPP_CONSTEXPR result_type min() { return _Min; } + _LIBCPP_INLINE_VISIBILITY + static _LIBCPP_CONSTEXPR result_type max() { return _Max; } + static _LIBCPP_CONSTEXPR const result_type default_seed = 5489u; // constructors and seeding functions _LIBCPP_INLINE_VISIBILITY explicit mersenne_twister_engine(result_type __sd = default_seed) {seed(__sd);} - template explicit mersenne_twister_engine(_Sseq& __q, + template _LIBCPP_INLINE_VISIBILITY + explicit mersenne_twister_engine(_Sseq& __q, typename enable_if<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value>::type* = 0) {seed(__q);} void seed(result_type __sd = default_seed); @@ -2132,45 +2156,45 @@ public: _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} - template + template friend bool - operator==(const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, - _B, _T, _C, _L, _F>& __x, - const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, - _B, _T, _C, _L, _F>& __y); - - template + operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + _Bp, _Tp, _Cp, _Lp, _Fp>& __x, + const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + _Bp, _Tp, _Cp, _Lp, _Fp>& __y); + + template friend bool - operator!=(const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, - _B, _T, _C, _L, _F>& __x, - const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, - _B, _T, _C, _L, _F>& __y); + operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + _Bp, _Tp, _Cp, _Lp, _Fp>& __x, + const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + _Bp, _Tp, _Cp, _Lp, _Fp>& __y); template + class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, + _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, - _B, _T, _C, _L, _F>& __x); + const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + _Bp, _Tp, _Cp, _Lp, _Fp>& __x); template + class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, + _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, - _B, _T, _C, _L, _F>& __x); + mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + _Bp, _Tp, _Cp, _Lp, _Fp>& __x); private: template @@ -2196,7 +2220,7 @@ private: (__count >= __w), result_type >::type - __lshift(result_type __x) {return result_type(0);} + __lshift(result_type) {return result_type(0);} template _LIBCPP_INLINE_VISIBILITY @@ -2216,9 +2240,93 @@ private: (__count >= _Dt), result_type >::type - __rshift(result_type __x) {return result_type(0);} + __rshift(result_type) {return result_type(0);} }; +template + _LIBCPP_CONSTEXPR const size_t + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::word_size; + +template + _LIBCPP_CONSTEXPR const size_t + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::state_size; + +template + _LIBCPP_CONSTEXPR const size_t + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::shift_size; + +template + _LIBCPP_CONSTEXPR const size_t + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::mask_bits; + +template + _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::xor_mask; + +template + _LIBCPP_CONSTEXPR const size_t + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_u; + +template + _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_d; + +template + _LIBCPP_CONSTEXPR const size_t + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_s; + +template + _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_b; + +template + _LIBCPP_CONSTEXPR const size_t + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_t; + +template + _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_c; + +template + _LIBCPP_CONSTEXPR const size_t + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_l; + +template + _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::initialization_multiplier; + +template + _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::default_seed; + template @@ -2293,9 +2401,9 @@ mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, const size_t __j = (__i_ + 1) % __n; const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1); - const result_type _Y = (__x_[__i_] & ~__mask) | (__x_[__j] & __mask); + const result_type _Yp = (__x_[__i_] & ~__mask) | (__x_[__j] & __mask); const size_t __k = (__i_ + __m) % __n; - __x_[__i_] = __x_[__k] ^ __rshift<1>(_Y) ^ (__a * (_Y & 1)); + __x_[__i_] = __x_[__k] ^ __rshift<1>(_Yp) ^ (__a * (_Yp & 1)); result_type __z = __x_[__i_] ^ (__rshift<__u>(__x_[__i_]) & __d); __i_ = __j; __z ^= __lshift<__s>(__z) & __b; @@ -2303,78 +2411,78 @@ mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, return __z ^ __rshift<__l>(__z); } -template +template bool -operator==(const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, - _B, _T, _C, _L, _F>& __x, - const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, - _B, _T, _C, _L, _F>& __y) +operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + _Bp, _Tp, _Cp, _Lp, _Fp>& __x, + const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + _Bp, _Tp, _Cp, _Lp, _Fp>& __y) { if (__x.__i_ == __y.__i_) - return _VSTD::equal(__x.__x_, __x.__x_ + _N, __y.__x_); + return _VSTD::equal(__x.__x_, __x.__x_ + _Np, __y.__x_); if (__x.__i_ == 0 || __y.__i_ == 0) { - size_t __j = _VSTD::min(_N - __x.__i_, _N - __y.__i_); + size_t __j = _VSTD::min(_Np - __x.__i_, _Np - __y.__i_); if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j, __y.__x_ + __y.__i_)) return false; if (__x.__i_ == 0) - return _VSTD::equal(__x.__x_ + __j, __x.__x_ + _N, __y.__x_); - return _VSTD::equal(__x.__x_, __x.__x_ + (_N - __j), __y.__x_ + __j); + return _VSTD::equal(__x.__x_ + __j, __x.__x_ + _Np, __y.__x_); + return _VSTD::equal(__x.__x_, __x.__x_ + (_Np - __j), __y.__x_ + __j); } if (__x.__i_ < __y.__i_) { - size_t __j = _N - __y.__i_; + size_t __j = _Np - __y.__i_; if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j), __y.__x_ + __y.__i_)) return false; - if (!_VSTD::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _N, + if (!_VSTD::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _Np, __y.__x_)) return false; return _VSTD::equal(__x.__x_, __x.__x_ + __x.__i_, - __y.__x_ + (_N - (__x.__i_ + __j))); + __y.__x_ + (_Np - (__x.__i_ + __j))); } - size_t __j = _N - __x.__i_; + size_t __j = _Np - __x.__i_; if (!_VSTD::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j), __x.__x_ + __x.__i_)) return false; - if (!_VSTD::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _N, + if (!_VSTD::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _Np, __x.__x_)) return false; return _VSTD::equal(__y.__x_, __y.__x_ + __y.__i_, - __x.__x_ + (_N - (__y.__i_ + __j))); + __x.__x_ + (_Np - (__y.__i_ + __j))); } -template +template inline _LIBCPP_INLINE_VISIBILITY bool -operator!=(const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, - _B, _T, _C, _L, _F>& __x, - const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, - _B, _T, _C, _L, _F>& __y) +operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + _Bp, _Tp, _Cp, _Lp, _Fp>& __x, + const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + _Bp, _Tp, _Cp, _Lp, _Fp>& __y) { return !(__x == __y); } template + class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, + _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, - _B, _T, _C, _L, _F>& __x) + const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + _Bp, _Tp, _Cp, _Lp, _Fp>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left); _CharT __sp = __os.widen(' '); __os.fill(__sp); __os << __x.__x_[__x.__i_]; - for (size_t __j = __x.__i_ + 1; __j < _N; ++__j) + for (size_t __j = __x.__i_ + 1; __j < _Np; ++__j) __os << __sp << __x.__x_[__j]; for (size_t __j = 0; __j < __x.__i_; ++__j) __os << __sp << __x.__x_[__j]; @@ -2382,22 +2490,22 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, } template + class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, + _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S, - _B, _T, _C, _L, _F>& __x) + mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + _Bp, _Tp, _Cp, _Lp, _Fp>& __x) { - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); - _UI __t[_N]; - for (size_t __i = 0; __i < _N; ++__i) + _UI __t[_Np]; + for (size_t __i = 0; __i < _Np; ++__i) __is >> __t[__i]; if (!__is.fail()) { - for (size_t __i = 0; __i < _N; ++__i) + for (size_t __i = 0; __i < _Np; ++__i) __x.__x_[__i] = __t[__i]; __x.__i_ = 0; } @@ -2418,31 +2526,32 @@ typedef mersenne_twister_engine -class subtract_with_carry_engine; +class _LIBCPP_VISIBLE subtract_with_carry_engine; -template +template bool operator==( - const subtract_with_carry_engine<_UI, _W, _S, _R>& __x, - const subtract_with_carry_engine<_UI, _W, _S, _R>& __y); + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y); -template +template +_LIBCPP_INLINE_VISIBILITY bool operator!=( - const subtract_with_carry_engine<_UI, _W, _S, _R>& __x, - const subtract_with_carry_engine<_UI, _W, _S, _R>& __y); + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y); template + class _UI, size_t _Wp, size_t _Sp, size_t _Rp> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const subtract_with_carry_engine<_UI, _W, _S, _R>& __x); + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x); template + class _UI, size_t _Wp, size_t _Sp, size_t _Rp> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - subtract_with_carry_engine<_UI, _W, _S, _R>& __x); + subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x); template class _LIBCPP_VISIBLE subtract_with_carry_engine @@ -2456,33 +2565,34 @@ private: result_type __c_; size_t __i_; - static const result_type _Dt = numeric_limits::digits; + static _LIBCPP_CONSTEXPR const result_type _Dt = numeric_limits::digits; static_assert( 0 < __w, "subtract_with_carry_engine invalid parameters"); static_assert(__w <= _Dt, "subtract_with_carry_engine invalid parameters"); static_assert( 0 < __s, "subtract_with_carry_engine invalid parameters"); static_assert(__s < __r, "subtract_with_carry_engine invalid parameters"); public: - static const result_type _Min = 0; - static const result_type _Max = __w == _Dt ? result_type(~0) : - (result_type(1) << __w) - result_type(1); + static _LIBCPP_CONSTEXPR const result_type _Min = 0; + static _LIBCPP_CONSTEXPR const result_type _Max = __w == _Dt ? result_type(~0) : + (result_type(1) << __w) - result_type(1); static_assert(_Min < _Max, "subtract_with_carry_engine invalid parameters"); // engine characteristics - static const/*expr*/ size_t word_size = __w; - static const/*expr*/ size_t short_lag = __s; - static const/*expr*/ size_t long_lag = __r; + static _LIBCPP_CONSTEXPR const size_t word_size = __w; + static _LIBCPP_CONSTEXPR const size_t short_lag = __s; + static _LIBCPP_CONSTEXPR const size_t long_lag = __r; _LIBCPP_INLINE_VISIBILITY - static const/*expr*/ result_type min() { return _Min; } + static _LIBCPP_CONSTEXPR result_type min() { return _Min; } _LIBCPP_INLINE_VISIBILITY - static const/*expr*/ result_type max() { return _Max; } - static const/*expr*/ result_type default_seed = 19780503u; + static _LIBCPP_CONSTEXPR result_type max() { return _Max; } + static _LIBCPP_CONSTEXPR const result_type default_seed = 19780503u; // constructors and seeding functions _LIBCPP_INLINE_VISIBILITY explicit subtract_with_carry_engine(result_type __sd = default_seed) {seed(__sd);} - template explicit subtract_with_carry_engine(_Sseq& __q, + template _LIBCPP_INLINE_VISIBILITY + explicit subtract_with_carry_engine(_Sseq& __q, typename enable_if<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value>::type* = 0) {seed(__q);} _LIBCPP_INLINE_VISIBILITY @@ -2503,33 +2613,33 @@ public: _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} - template + template friend bool operator==( - const subtract_with_carry_engine<_UI, _W, _S, _R>& __x, - const subtract_with_carry_engine<_UI, _W, _S, _R>& __y); + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y); - template + template friend bool operator!=( - const subtract_with_carry_engine<_UI, _W, _S, _R>& __x, - const subtract_with_carry_engine<_UI, _W, _S, _R>& __y); + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y); template + class _UI, size_t _Wp, size_t _Sp, size_t _Rp> friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const subtract_with_carry_engine<_UI, _W, _S, _R>& __x); + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x); template + class _UI, size_t _Wp, size_t _Sp, size_t _Rp> friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - subtract_with_carry_engine<_UI, _W, _S, _R>& __x); + subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x); private: @@ -2541,6 +2651,19 @@ private: void __seed(_Sseq& __q, integral_constant); }; +template + _LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::word_size; + +template + _LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::short_lag; + +template + _LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::long_lag; + +template + _LIBCPP_CONSTEXPR const typename subtract_with_carry_engine<_UIntType, __w, __s, __r>::result_type + subtract_with_carry_engine<_UIntType, __w, __s, __r>::default_seed; + template void subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd, @@ -2615,71 +2738,71 @@ subtract_with_carry_engine<_UIntType, __w, __s, __r>::operator()() return __xr; } -template +template bool operator==( - const subtract_with_carry_engine<_UI, _W, _S, _R>& __x, - const subtract_with_carry_engine<_UI, _W, _S, _R>& __y) + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y) { if (__x.__c_ != __y.__c_) return false; if (__x.__i_ == __y.__i_) - return _VSTD::equal(__x.__x_, __x.__x_ + _R, __y.__x_); + return _VSTD::equal(__x.__x_, __x.__x_ + _Rp, __y.__x_); if (__x.__i_ == 0 || __y.__i_ == 0) { - size_t __j = _VSTD::min(_R - __x.__i_, _R - __y.__i_); + size_t __j = _VSTD::min(_Rp - __x.__i_, _Rp - __y.__i_); if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j, __y.__x_ + __y.__i_)) return false; if (__x.__i_ == 0) - return _VSTD::equal(__x.__x_ + __j, __x.__x_ + _R, __y.__x_); - return _VSTD::equal(__x.__x_, __x.__x_ + (_R - __j), __y.__x_ + __j); + return _VSTD::equal(__x.__x_ + __j, __x.__x_ + _Rp, __y.__x_); + return _VSTD::equal(__x.__x_, __x.__x_ + (_Rp - __j), __y.__x_ + __j); } if (__x.__i_ < __y.__i_) { - size_t __j = _R - __y.__i_; + size_t __j = _Rp - __y.__i_; if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j), __y.__x_ + __y.__i_)) return false; - if (!_VSTD::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _R, + if (!_VSTD::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _Rp, __y.__x_)) return false; return _VSTD::equal(__x.__x_, __x.__x_ + __x.__i_, - __y.__x_ + (_R - (__x.__i_ + __j))); + __y.__x_ + (_Rp - (__x.__i_ + __j))); } - size_t __j = _R - __x.__i_; + size_t __j = _Rp - __x.__i_; if (!_VSTD::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j), __x.__x_ + __x.__i_)) return false; - if (!_VSTD::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _R, + if (!_VSTD::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _Rp, __x.__x_)) return false; return _VSTD::equal(__y.__x_, __y.__x_ + __y.__i_, - __x.__x_ + (_R - (__y.__i_ + __j))); + __x.__x_ + (_Rp - (__y.__i_ + __j))); } -template +template inline _LIBCPP_INLINE_VISIBILITY bool operator!=( - const subtract_with_carry_engine<_UI, _W, _S, _R>& __x, - const subtract_with_carry_engine<_UI, _W, _S, _R>& __y) + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y) { return !(__x == __y); } template + class _UI, size_t _Wp, size_t _Sp, size_t _Rp> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const subtract_with_carry_engine<_UI, _W, _S, _R>& __x) + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left); _CharT __sp = __os.widen(' '); __os.fill(__sp); __os << __x.__x_[__x.__i_]; - for (size_t __j = __x.__i_ + 1; __j < _R; ++__j) + for (size_t __j = __x.__i_ + 1; __j < _Rp; ++__j) __os << __sp << __x.__x_[__j]; for (size_t __j = 0; __j < __x.__i_; ++__j) __os << __sp << __x.__x_[__j]; @@ -2688,21 +2811,21 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, } template + class _UI, size_t _Wp, size_t _Sp, size_t _Rp> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - subtract_with_carry_engine<_UI, _W, _S, _R>& __x) + subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x) { - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); - _UI __t[_R+1]; - for (size_t __i = 0; __i < _R+1; ++__i) + _UI __t[_Rp+1]; + for (size_t __i = 0; __i < _Rp+1; ++__i) __is >> __t[__i]; if (!__is.fail()) { - for (size_t __i = 0; __i < _R; ++__i) + for (size_t __i = 0; __i < _Rp; ++__i) __x.__x_[__i] = __t[__i]; - __x.__c_ = __t[_R]; + __x.__c_ = __t[_Rp]; __x.__i_ = 0; } return __is; @@ -2726,17 +2849,21 @@ public: typedef typename _Engine::result_type result_type; // engine characteristics - static const/*expr*/ size_t block_size = __p; - static const/*expr*/ size_t used_block = __r; + static _LIBCPP_CONSTEXPR const size_t block_size = __p; + static _LIBCPP_CONSTEXPR const size_t used_block = __r; - // Temporary work around for lack of constexpr +#ifdef _LIBCPP_HAS_NO_CONSTEXPR static const result_type _Min = _Engine::_Min; static const result_type _Max = _Engine::_Max; +#else + static _LIBCPP_CONSTEXPR const result_type _Min = _Engine::min(); + static _LIBCPP_CONSTEXPR const result_type _Max = _Engine::max(); +#endif _LIBCPP_INLINE_VISIBILITY - static const/*expr*/ result_type min() { return _Engine::min(); } + static _LIBCPP_CONSTEXPR result_type min() { return _Engine::min(); } _LIBCPP_INLINE_VISIBILITY - static const/*expr*/ result_type max() { return _Engine::max(); } + static _LIBCPP_CONSTEXPR result_type max() { return _Engine::max(); } // constructors and seeding functions _LIBCPP_INLINE_VISIBILITY @@ -2777,37 +2904,43 @@ public: // property functions _LIBCPP_INLINE_VISIBILITY - const _Engine& base() const {return __e_;} + const _Engine& base() const _NOEXCEPT {return __e_;} - template + template friend bool operator==( - const discard_block_engine<_Eng, _P, _R>& __x, - const discard_block_engine<_Eng, _P, _R>& __y); + const discard_block_engine<_Eng, _Pp, _Rp>& __x, + const discard_block_engine<_Eng, _Pp, _Rp>& __y); - template + template friend bool operator!=( - const discard_block_engine<_Eng, _P, _R>& __x, - const discard_block_engine<_Eng, _P, _R>& __y); + const discard_block_engine<_Eng, _Pp, _Rp>& __x, + const discard_block_engine<_Eng, _Pp, _Rp>& __y); template + class _Eng, size_t _Pp, size_t _Rp> friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const discard_block_engine<_Eng, _P, _R>& __x); + const discard_block_engine<_Eng, _Pp, _Rp>& __x); template + class _Eng, size_t _Pp, size_t _Rp> friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - discard_block_engine<_Eng, _P, _R>& __x); + discard_block_engine<_Eng, _Pp, _Rp>& __x); }; +template + _LIBCPP_CONSTEXPR const size_t discard_block_engine<_Engine, __p, __r>::block_size; + +template + _LIBCPP_CONSTEXPR const size_t discard_block_engine<_Engine, __p, __r>::used_block; + template typename discard_block_engine<_Engine, __p, __r>::result_type discard_block_engine<_Engine, __p, __r>::operator()() @@ -2821,31 +2954,31 @@ discard_block_engine<_Engine, __p, __r>::operator()() return __e_(); } -template +template inline _LIBCPP_INLINE_VISIBILITY bool -operator==(const discard_block_engine<_Eng, _P, _R>& __x, - const discard_block_engine<_Eng, _P, _R>& __y) +operator==(const discard_block_engine<_Eng, _Pp, _Rp>& __x, + const discard_block_engine<_Eng, _Pp, _Rp>& __y) { return __x.__n_ == __y.__n_ && __x.__e_ == __y.__e_; } -template +template inline _LIBCPP_INLINE_VISIBILITY bool -operator!=(const discard_block_engine<_Eng, _P, _R>& __x, - const discard_block_engine<_Eng, _P, _R>& __y) +operator!=(const discard_block_engine<_Eng, _Pp, _Rp>& __x, + const discard_block_engine<_Eng, _Pp, _Rp>& __y) { return !(__x == __y); } template + class _Eng, size_t _Pp, size_t _Rp> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const discard_block_engine<_Eng, _P, _R>& __x) + const discard_block_engine<_Eng, _Pp, _Rp>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left); _CharT __sp = __os.widen(' '); __os.fill(__sp); @@ -2853,12 +2986,12 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, } template + class _Eng, size_t _Pp, size_t _Rp> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - discard_block_engine<_Eng, _P, _R>& __x) + discard_block_engine<_Eng, _Pp, _Rp>& __x) { - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); _Eng __e; int __n; @@ -2879,15 +3012,15 @@ typedef discard_block_engine ranlux48; template class _LIBCPP_VISIBLE independent_bits_engine { - template + template class __get_n { - static const size_t _Dt = numeric_limits<_UI>::digits; - static const size_t _N = _W / _M + (_W % _M != 0); - static const size_t _W0 = _W / _N; - static const _UI _Y0 = _W0 >= _Dt ? 0 : (_R0 >> _W0) << _W0; + static _LIBCPP_CONSTEXPR const size_t _Dt = numeric_limits<_UI>::digits; + static _LIBCPP_CONSTEXPR const size_t _Np = _Wp / _Mp + (_Wp % _Mp != 0); + static _LIBCPP_CONSTEXPR const size_t _W0 = _Wp / _Np; + static _LIBCPP_CONSTEXPR const _UI _Y0 = _W0 >= _Dt ? 0 : (_R0 >> _W0) << _W0; public: - static const size_t value = _R0 - _Y0 > _Y0 / _N ? _N + 1 : _N; + static _LIBCPP_CONSTEXPR const size_t value = _R0 - _Y0 > _Y0 / _Np ? _Np + 1 : _Np; }; public: // types @@ -2896,7 +3029,7 @@ public: private: _Engine __e_; - static const result_type _Dt = numeric_limits::digits; + static _LIBCPP_CONSTEXPR const result_type _Dt = numeric_limits::digits; static_assert( 0 < __w, "independent_bits_engine invalid parameters"); static_assert(__w <= _Dt, "independent_bits_engine invalid parameters"); @@ -2907,36 +3040,40 @@ private: result_type, _Engine_result_type >::type _Working_result_type; - // Temporary work around for lack of constexpr - static const _Working_result_type _R = _Engine::_Max - _Engine::_Min - + _Working_result_type(1); - static const size_t __m = __log2<_Working_result_type, _R>::value; - static const size_t __n = __get_n<_Working_result_type, _R, __w, __m>::value; - static const size_t __w0 = __w / __n; - static const size_t __n0 = __n - __w % __n; - static const size_t _WDt = numeric_limits<_Working_result_type>::digits; - static const size_t _EDt = numeric_limits<_Engine_result_type>::digits; - static const _Working_result_type __y0 = __w0 >= _WDt ? 0 : - (_R >> __w0) << __w0; - static const _Working_result_type __y1 = __w0 >= _WDt - 1 ? 0 : - (_R >> (__w0+1)) << (__w0+1); - static const _Engine_result_type __mask0 = __w0 > 0 ? +#ifdef _LIBCPP_HAS_NO_CONSTEXPR + static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min + + _Working_result_type(1); +#else + static _LIBCPP_CONSTEXPR const _Working_result_type _Rp = _Engine::max() - _Engine::min() + + _Working_result_type(1); +#endif + static _LIBCPP_CONSTEXPR const size_t __m = __log2<_Working_result_type, _Rp>::value; + static _LIBCPP_CONSTEXPR const size_t __n = __get_n<_Working_result_type, _Rp, __w, __m>::value; + static _LIBCPP_CONSTEXPR const size_t __w0 = __w / __n; + static _LIBCPP_CONSTEXPR const size_t __n0 = __n - __w % __n; + static _LIBCPP_CONSTEXPR const size_t _WDt = numeric_limits<_Working_result_type>::digits; + static _LIBCPP_CONSTEXPR const size_t _EDt = numeric_limits<_Engine_result_type>::digits; + static _LIBCPP_CONSTEXPR const _Working_result_type __y0 = __w0 >= _WDt ? 0 : + (_Rp >> __w0) << __w0; + static _LIBCPP_CONSTEXPR const _Working_result_type __y1 = __w0 >= _WDt - 1 ? 0 : + (_Rp >> (__w0+1)) << (__w0+1); + static _LIBCPP_CONSTEXPR const _Engine_result_type __mask0 = __w0 > 0 ? _Engine_result_type(~0) >> (_EDt - __w0) : _Engine_result_type(0); - static const _Engine_result_type __mask1 = __w0 < _EDt - 1 ? + static _LIBCPP_CONSTEXPR const _Engine_result_type __mask1 = __w0 < _EDt - 1 ? _Engine_result_type(~0) >> (_EDt - (__w0 + 1)) : _Engine_result_type(~0); public: - static const result_type _Min = 0; - static const result_type _Max = __w == _Dt ? result_type(~0) : - (result_type(1) << __w) - result_type(1); + static _LIBCPP_CONSTEXPR const result_type _Min = 0; + static _LIBCPP_CONSTEXPR const result_type _Max = __w == _Dt ? result_type(~0) : + (result_type(1) << __w) - result_type(1); static_assert(_Min < _Max, "independent_bits_engine invalid parameters"); // engine characteristics _LIBCPP_INLINE_VISIBILITY - static const/*expr*/ result_type min() { return _Min; } + static _LIBCPP_CONSTEXPR result_type min() { return _Min; } _LIBCPP_INLINE_VISIBILITY - static const/*expr*/ result_type max() { return _Max; } + static _LIBCPP_CONSTEXPR result_type max() { return _Max; } // constructors and seeding functions _LIBCPP_INLINE_VISIBILITY @@ -2951,8 +3088,9 @@ public: #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit independent_bits_engine(result_type __sd) : __e_(__sd) {} - template explicit independent_bits_engine(_Sseq& __q, + template _LIBCPP_INLINE_VISIBILITY + explicit independent_bits_engine(_Sseq& __q, typename enable_if<__is_seed_sequence<_Sseq, independent_bits_engine>::value && !is_convertible<_Sseq, _Engine>::value>::type* = 0) : __e_(__q) {} @@ -2971,41 +3109,41 @@ public: // generating functions _LIBCPP_INLINE_VISIBILITY - result_type operator()() {return __eval(integral_constant());} + result_type operator()() {return __eval(integral_constant());} _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} // property functions _LIBCPP_INLINE_VISIBILITY - const _Engine& base() const {return __e_;} + const _Engine& base() const _NOEXCEPT {return __e_;} - template + template friend bool operator==( - const independent_bits_engine<_Eng, _W, _UI>& __x, - const independent_bits_engine<_Eng, _W, _UI>& __y); + const independent_bits_engine<_Eng, _Wp, _UI>& __x, + const independent_bits_engine<_Eng, _Wp, _UI>& __y); - template + template friend bool operator!=( - const independent_bits_engine<_Eng, _W, _UI>& __x, - const independent_bits_engine<_Eng, _W, _UI>& __y); + const independent_bits_engine<_Eng, _Wp, _UI>& __x, + const independent_bits_engine<_Eng, _Wp, _UI>& __y); template + class _Eng, size_t _Wp, class _UI> friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const independent_bits_engine<_Eng, _W, _UI>& __x); + const independent_bits_engine<_Eng, _Wp, _UI>& __x); template + class _Eng, size_t _Wp, class _UI> friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - independent_bits_engine<_Eng, _W, _UI>& __x); + independent_bits_engine<_Eng, _Wp, _UI>& __x); private: result_type __eval(false_type); @@ -3029,7 +3167,7 @@ private: (__count >= _Dt), result_type >::type - __lshift(result_type __x) {return result_type(0);} + __lshift(result_type) {return result_type(0);} }; template @@ -3044,7 +3182,7 @@ template _UIntType independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type) { - result_type _S = 0; + result_type _Sp = 0; for (size_t __k = 0; __k < __n0; ++__k) { _Engine_result_type __u; @@ -3052,7 +3190,7 @@ independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type) { __u = __e_() - _Engine::min(); } while (__u >= __y0); - _S = static_cast(__lshift<__w0>(_S) + (__u & __mask0)); + _Sp = static_cast(__lshift<__w0>(_Sp) + (__u & __mask0)); } for (size_t __k = __n0; __k < __n; ++__k) { @@ -3061,45 +3199,45 @@ independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type) { __u = __e_() - _Engine::min(); } while (__u >= __y1); - _S = static_cast(__lshift<__w0+1>(_S) + (__u & __mask1)); + _Sp = static_cast(__lshift<__w0+1>(_Sp) + (__u & __mask1)); } - return _S; + return _Sp; } -template +template inline _LIBCPP_INLINE_VISIBILITY bool operator==( - const independent_bits_engine<_Eng, _W, _UI>& __x, - const independent_bits_engine<_Eng, _W, _UI>& __y) + const independent_bits_engine<_Eng, _Wp, _UI>& __x, + const independent_bits_engine<_Eng, _Wp, _UI>& __y) { return __x.base() == __y.base(); } -template +template inline _LIBCPP_INLINE_VISIBILITY bool operator!=( - const independent_bits_engine<_Eng, _W, _UI>& __x, - const independent_bits_engine<_Eng, _W, _UI>& __y) + const independent_bits_engine<_Eng, _Wp, _UI>& __x, + const independent_bits_engine<_Eng, _Wp, _UI>& __y) { return !(__x == __y); } template + class _Eng, size_t _Wp, class _UI> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const independent_bits_engine<_Eng, _W, _UI>& __x) + const independent_bits_engine<_Eng, _Wp, _UI>& __x) { return __os << __x.base(); } template + class _Eng, size_t _Wp, class _UI> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - independent_bits_engine<_Eng, _W, _UI>& __x) + independent_bits_engine<_Eng, _Wp, _UI>& __x) { _Eng __e; __is >> __e; @@ -3113,23 +3251,23 @@ operator>>(basic_istream<_CharT, _Traits>& __is, template struct __ugcd { - static const uint64_t value = __ugcd<_Yp, _Xp % _Yp>::value; + static _LIBCPP_CONSTEXPR const uint64_t value = __ugcd<_Yp, _Xp % _Yp>::value; }; template struct __ugcd<_Xp, 0> { - static const uint64_t value = _Xp; + static _LIBCPP_CONSTEXPR const uint64_t value = _Xp; }; -template +template class __uratio { - static_assert(_D != 0, "__uratio divide by 0"); - static const uint64_t __gcd = __ugcd<_N, _D>::value; + static_assert(_Dp != 0, "__uratio divide by 0"); + static _LIBCPP_CONSTEXPR const uint64_t __gcd = __ugcd<_Np, _Dp>::value; public: - static const uint64_t num = _N / __gcd; - static const uint64_t den = _D / __gcd; + static _LIBCPP_CONSTEXPR const uint64_t num = _Np / __gcd; + static _LIBCPP_CONSTEXPR const uint64_t den = _Dp / __gcd; typedef __uratio type; }; @@ -3149,17 +3287,22 @@ private: public: // engine characteristics - static const/*expr*/ size_t table_size = __k; + static _LIBCPP_CONSTEXPR const size_t table_size = __k; +#ifdef _LIBCPP_HAS_NO_CONSTEXPR static const result_type _Min = _Engine::_Min; static const result_type _Max = _Engine::_Max; +#else + static _LIBCPP_CONSTEXPR const result_type _Min = _Engine::min(); + static _LIBCPP_CONSTEXPR const result_type _Max = _Engine::max(); +#endif static_assert(_Min < _Max, "shuffle_order_engine invalid parameters"); _LIBCPP_INLINE_VISIBILITY - static const/*expr*/ result_type min() { return _Min; } + static _LIBCPP_CONSTEXPR result_type min() { return _Min; } _LIBCPP_INLINE_VISIBILITY - static const/*expr*/ result_type max() { return _Max; } + static _LIBCPP_CONSTEXPR result_type max() { return _Max; } - static const unsigned long long _R = _Max - _Min + 1ull; + static _LIBCPP_CONSTEXPR const unsigned long long _Rp = _Max - _Min + 1ull; // constructors and seeding functions _LIBCPP_INLINE_VISIBILITY @@ -3174,8 +3317,9 @@ public: #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit shuffle_order_engine(result_type __sd) : __e_(__sd) {__init();} - template explicit shuffle_order_engine(_Sseq& __q, + template _LIBCPP_INLINE_VISIBILITY + explicit shuffle_order_engine(_Sseq& __q, typename enable_if<__is_seed_sequence<_Sseq, shuffle_order_engine>::value && !is_convertible<_Sseq, _Engine>::value>::type* = 0) : __e_(__q) {__init();} @@ -3194,42 +3338,42 @@ public: // generating functions _LIBCPP_INLINE_VISIBILITY - result_type operator()() {return __eval(integral_constant());} + result_type operator()() {return __eval(integral_constant());} _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} // property functions _LIBCPP_INLINE_VISIBILITY - const _Engine& base() const {return __e_;} + const _Engine& base() const _NOEXCEPT {return __e_;} private: - template + template friend bool operator==( - const shuffle_order_engine<_Eng, _K>& __x, - const shuffle_order_engine<_Eng, _K>& __y); + const shuffle_order_engine<_Eng, _Kp>& __x, + const shuffle_order_engine<_Eng, _Kp>& __y); - template + template friend bool operator!=( - const shuffle_order_engine<_Eng, _K>& __x, - const shuffle_order_engine<_Eng, _K>& __y); + const shuffle_order_engine<_Eng, _Kp>& __x, + const shuffle_order_engine<_Eng, _Kp>& __y); template + class _Eng, size_t _Kp> friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const shuffle_order_engine<_Eng, _K>& __x); + const shuffle_order_engine<_Eng, _Kp>& __x); template + class _Eng, size_t _Kp> friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - shuffle_order_engine<_Eng, _K>& __x); + shuffle_order_engine<_Eng, _Kp>& __x); _LIBCPP_INLINE_VISIBILITY void __init() @@ -3242,34 +3386,34 @@ private: _LIBCPP_INLINE_VISIBILITY result_type __eval(false_type) {return __eval2(integral_constant());} _LIBCPP_INLINE_VISIBILITY - result_type __eval(true_type) {return __eval(__uratio<__k, _R>());} + result_type __eval(true_type) {return __eval(__uratio<__k, _Rp>());} _LIBCPP_INLINE_VISIBILITY result_type __eval2(false_type) {return __eval(__uratio<__k/2, 0x8000000000000000ull>());} _LIBCPP_INLINE_VISIBILITY result_type __eval2(true_type) {return __evalf<__k, 0>();} - template + template _LIBCPP_INLINE_VISIBILITY typename enable_if < - (__uratio<_N, _D>::num > 0xFFFFFFFFFFFFFFFFull / (_Max - _Min)), + (__uratio<_Np, _Dp>::num > 0xFFFFFFFFFFFFFFFFull / (_Max - _Min)), result_type >::type - __eval(__uratio<_N, _D>) - {return __evalf<__uratio<_N, _D>::num, __uratio<_N, _D>::den>();} + __eval(__uratio<_Np, _Dp>) + {return __evalf<__uratio<_Np, _Dp>::num, __uratio<_Np, _Dp>::den>();} - template + template _LIBCPP_INLINE_VISIBILITY typename enable_if < - __uratio<_N, _D>::num <= 0xFFFFFFFFFFFFFFFFull / (_Max - _Min), + __uratio<_Np, _Dp>::num <= 0xFFFFFFFFFFFFFFFFull / (_Max - _Min), result_type >::type - __eval(__uratio<_N, _D>) + __eval(__uratio<_Np, _Dp>) { - const size_t __j = static_cast(__uratio<_N, _D>::num * (_Y_ - _Min) - / __uratio<_N, _D>::den); + const size_t __j = static_cast(__uratio<_Np, _Dp>::num * (_Y_ - _Min) + / __uratio<_Np, _Dp>::den); _Y_ = _V_[__j]; _V_[__j] = __e_(); return _Y_; @@ -3279,72 +3423,75 @@ private: _LIBCPP_INLINE_VISIBILITY result_type __evalf() { - const double _F = __d == 0 ? + const double _Fp = __d == 0 ? __n / (2. * 0x8000000000000000ull) : __n / (double)__d; - const size_t __j = static_cast(_F * (_Y_ - _Min)); + const size_t __j = static_cast(_Fp * (_Y_ - _Min)); _Y_ = _V_[__j]; _V_[__j] = __e_(); return _Y_; } }; -template +template + _LIBCPP_CONSTEXPR const size_t shuffle_order_engine<_Engine, __k>::table_size; + +template bool operator==( - const shuffle_order_engine<_Eng, _K>& __x, - const shuffle_order_engine<_Eng, _K>& __y) + const shuffle_order_engine<_Eng, _Kp>& __x, + const shuffle_order_engine<_Eng, _Kp>& __y) { - return __x._Y_ == __y._Y_ && _VSTD::equal(__x._V_, __x._V_ + _K, __y._V_) && + return __x._Y_ == __y._Y_ && _VSTD::equal(__x._V_, __x._V_ + _Kp, __y._V_) && __x.__e_ == __y.__e_; } -template +template inline _LIBCPP_INLINE_VISIBILITY bool operator!=( - const shuffle_order_engine<_Eng, _K>& __x, - const shuffle_order_engine<_Eng, _K>& __y) + const shuffle_order_engine<_Eng, _Kp>& __x, + const shuffle_order_engine<_Eng, _Kp>& __y) { return !(__x == __y); } template + class _Eng, size_t _Kp> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const shuffle_order_engine<_Eng, _K>& __x) + const shuffle_order_engine<_Eng, _Kp>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left); _CharT __sp = __os.widen(' '); __os.fill(__sp); __os << __x.__e_ << __sp << __x._V_[0]; - for (size_t __i = 1; __i < _K; ++__i) + for (size_t __i = 1; __i < _Kp; ++__i) __os << __sp << __x._V_[__i]; return __os << __sp << __x._Y_; } template + class _Eng, size_t _Kp> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - shuffle_order_engine<_Eng, _K>& __x) + shuffle_order_engine<_Eng, _Kp>& __x) { - typedef typename shuffle_order_engine<_Eng, _K>::result_type result_type; - __save_flags<_CharT, _Traits> _(__is); + typedef typename shuffle_order_engine<_Eng, _Kp>::result_type result_type; + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); _Eng __e; - result_type _V[_K+1]; + result_type _Vp[_Kp+1]; __is >> __e; - for (size_t __i = 0; __i < _K+1; ++__i) - __is >> _V[__i]; + for (size_t __i = 0; __i < _Kp+1; ++__i) + __is >> _Vp[__i]; if (!__is.fail()) { __x.__e_ = __e; - for (size_t __i = 0; __i < _K; ++__i) - __x._V_[__i] = _V[__i]; - __x._Y_ = _V[_K]; + for (size_t __i = 0; __i < _Kp; ++__i) + __x._V_[__i] = _Vp[__i]; + __x._Y_ = _Vp[_Kp]; } return __is; } @@ -3361,13 +3508,13 @@ public: typedef unsigned result_type; // generator characteristics - static const result_type _Min = 0; - static const result_type _Max = 0xFFFFFFFFu; + static _LIBCPP_CONSTEXPR const result_type _Min = 0; + static _LIBCPP_CONSTEXPR const result_type _Max = 0xFFFFFFFFu; _LIBCPP_INLINE_VISIBILITY - static const/*expr*/ result_type min() { return _Min;} + static _LIBCPP_CONSTEXPR result_type min() { return _Min;} _LIBCPP_INLINE_VISIBILITY - static const/*expr*/ result_type max() { return _Max;} + static _LIBCPP_CONSTEXPR result_type max() { return _Max;} // constructors explicit random_device(const string& __token = "/dev/urandom"); @@ -3377,7 +3524,7 @@ public: result_type operator()(); // property functions - double entropy() const; + double entropy() const _NOEXCEPT; private: // no copy functions @@ -3431,7 +3578,7 @@ private: void operator=(const seed_seq&); // = delete; _LIBCPP_INLINE_VISIBILITY - static result_type _T(result_type __x) {return __x ^ (__x >> 27);} + static result_type _Tp(result_type __x) {return __x ^ (__x >> 27);} }; template @@ -3461,7 +3608,7 @@ seed_seq::generate(_RandomAccessIterator __first, _RandomAccessIterator __last) const size_t __m = _VSTD::max(__s + 1, __n); // __k = 0; { - result_type __r = 1664525 * _T(__first[0] ^ __first[__p] + result_type __r = 1664525 * _Tp(__first[0] ^ __first[__p] ^ __first[__n - 1]); __first[__p] += __r; __r += __s; @@ -3472,7 +3619,7 @@ seed_seq::generate(_RandomAccessIterator __first, _RandomAccessIterator __last) { const size_t __kmodn = __k % __n; const size_t __kpmodn = (__k + __p) % __n; - result_type __r = 1664525 * _T(__first[__kmodn] ^ __first[__kpmodn] + result_type __r = 1664525 * _Tp(__first[__kmodn] ^ __first[__kpmodn] ^ __first[(__k - 1) % __n]); __first[__kpmodn] += __r; __r += __kmodn + __v_[__k-1]; @@ -3483,7 +3630,7 @@ seed_seq::generate(_RandomAccessIterator __first, _RandomAccessIterator __last) { const size_t __kmodn = __k % __n; const size_t __kpmodn = (__k + __p) % __n; - result_type __r = 1664525 * _T(__first[__kmodn] ^ __first[__kpmodn] + result_type __r = 1664525 * _Tp(__first[__kmodn] ^ __first[__kpmodn] ^ __first[(__k - 1) % __n]); __first[__kpmodn] += __r; __r += __kmodn; @@ -3494,7 +3641,7 @@ seed_seq::generate(_RandomAccessIterator __first, _RandomAccessIterator __last) { const size_t __kmodn = __k % __n; const size_t __kpmodn = (__k + __p) % __n; - result_type __r = 1566083941 * _T(__first[__kmodn] + + result_type __r = 1566083941 * _Tp(__first[__kmodn] + __first[__kpmodn] + __first[(__k - 1) % __n]); __first[__kpmodn] ^= __r; @@ -3513,14 +3660,18 @@ generate_canonical(_URNG& __g) { const size_t _Dt = numeric_limits<_RealType>::digits; const size_t __b = _Dt < __bits ? _Dt : __bits; +#ifdef _LIBCPP_HAS_NO_CONSTEXPR const size_t __logR = __log2::value; +#else + const size_t __logR = __log2::value; +#endif const size_t __k = __b / __logR + (__b % __logR != 0) + (__b == 0); - const _RealType _R = _URNG::_Max - _URNG::_Min + _RealType(1); - _RealType __base = _R; - _RealType _S = __g() - _URNG::_Min; - for (size_t __i = 1; __i < __k; ++__i, __base *= _R) - _S += (__g() - _URNG::_Min) * __base; - return _S / __base; + const _RealType _Rp = _URNG::max() - _URNG::min() + _RealType(1); + _RealType __base = _Rp; + _RealType _Sp = __g() - _URNG::min(); + for (size_t __i = 1; __i < __k; ++__i, __base *= _Rp) + _Sp += (__g() - _URNG::min()) * __base; + return _Sp / __base; } // uniform_int_distribution @@ -3532,7 +3683,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const uniform_int_distribution<_IT>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left); _CharT __sp = __os.widen(' '); __os.fill(__sp); @@ -3547,7 +3698,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, typedef uniform_int_distribution<_IT> _Eng; typedef typename _Eng::result_type result_type; typedef typename _Eng::param_type param_type; - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); result_type __a; result_type __b; @@ -3653,7 +3804,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const uniform_real_distribution<_RT>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | ios_base::scientific); _CharT __sp = __os.widen(' '); @@ -3669,7 +3820,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, typedef uniform_real_distribution<_RT> _Eng; typedef typename _Eng::result_type result_type; typedef typename _Eng::param_type param_type; - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); result_type __a; result_type __b; @@ -3764,7 +3915,7 @@ template basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const bernoulli_distribution& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | ios_base::scientific); _CharT __sp = __os.widen(' '); @@ -3778,7 +3929,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bernoulli_distribution& __x) { typedef bernoulli_distribution _Eng; typedef typename _Eng::param_type param_type; - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); double __p; __is >> __p; @@ -3926,7 +4077,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const binomial_distribution<_IntType>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | ios_base::scientific); _CharT __sp = __os.widen(' '); @@ -3942,7 +4093,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, typedef binomial_distribution<_IntType> _Eng; typedef typename _Eng::result_type result_type; typedef typename _Eng::param_type param_type; - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); result_type __t; double __p; @@ -4044,7 +4195,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const exponential_distribution<_RealType>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | ios_base::scientific); return __os << __x.lambda(); @@ -4058,7 +4209,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, typedef exponential_distribution<_RealType> _Eng; typedef typename _Eng::result_type result_type; typedef typename _Eng::param_type param_type; - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); result_type __lambda; __is >> __lambda; @@ -4167,11 +4318,11 @@ template _RealType normal_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) { - result_type _U; + result_type _Up; if (_V_hot_) { _V_hot_ = false; - _U = _V_; + _Up = _V_; } else { @@ -4185,12 +4336,12 @@ normal_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) __v = _Uni(__g); __s = __u * __u + __v * __v; } while (__s > 1 || __s == 0); - result_type _F = _VSTD::sqrt(-2 * _VSTD::log(__s) / __s); - _V_ = __v * _F; + result_type _Fp = _VSTD::sqrt(-2 * _VSTD::log(__s) / __s); + _V_ = __v * _Fp; _V_hot_ = true; - _U = __u * _F; + _Up = __u * _Fp; } - return _U * __p.stddev() + __p.mean(); + return _Up * __p.stddev() + __p.mean(); } template @@ -4198,7 +4349,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const normal_distribution<_RT>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | ios_base::scientific); _CharT __sp = __os.widen(' '); @@ -4217,20 +4368,20 @@ operator>>(basic_istream<_CharT, _Traits>& __is, typedef normal_distribution<_RT> _Eng; typedef typename _Eng::result_type result_type; typedef typename _Eng::param_type param_type; - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); result_type __mean; result_type __stddev; - result_type _V = 0; + result_type _Vp = 0; bool _V_hot = false; __is >> __mean >> __stddev >> _V_hot; if (_V_hot) - __is >> _V; + __is >> _Vp; if (!__is.fail()) { __x.param(param_type(__mean, __stddev)); __x._V_hot_ = _V_hot; - __x._V_ = _V; + __x._V_ = _Vp; } return __is; } @@ -4569,7 +4720,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const poisson_distribution<_IntType>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | ios_base::scientific); return __os << __x.mean(); @@ -4582,7 +4733,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, { typedef poisson_distribution<_IntType> _Eng; typedef typename _Eng::param_type param_type; - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); double __mean; __is >> __mean; @@ -4680,7 +4831,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const weibull_distribution<_RT>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | ios_base::scientific); _CharT __sp = __os.widen(' '); @@ -4697,7 +4848,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, typedef weibull_distribution<_RT> _Eng; typedef typename _Eng::result_type result_type; typedef typename _Eng::param_type param_type; - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); result_type __a; result_type __b; @@ -4799,7 +4950,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const extreme_value_distribution<_RT>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | ios_base::scientific); _CharT __sp = __os.widen(' '); @@ -4816,7 +4967,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, typedef extreme_value_distribution<_RT> _Eng; typedef typename _Eng::result_type result_type; typedef typename _Eng::param_type param_type; - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); result_type __a; result_type __b; @@ -4971,7 +5122,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const gamma_distribution<_RT>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | ios_base::scientific); _CharT __sp = __os.widen(' '); @@ -4988,7 +5139,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, typedef gamma_distribution<_RT> _Eng; typedef typename _Eng::result_type result_type; typedef typename _Eng::param_type param_type; - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); result_type __alpha; result_type __beta; @@ -5107,7 +5258,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const negative_binomial_distribution<_IntType>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | ios_base::scientific); _CharT __sp = __os.widen(' '); @@ -5123,7 +5274,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, typedef negative_binomial_distribution<_IntType> _Eng; typedef typename _Eng::result_type result_type; typedef typename _Eng::param_type param_type; - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); result_type __k; double __p; @@ -5213,7 +5364,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const geometric_distribution<_IntType>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | ios_base::scientific); return __os << __x.p(); @@ -5226,7 +5377,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, { typedef geometric_distribution<_IntType> _Eng; typedef typename _Eng::param_type param_type; - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); double __p; __is >> __p; @@ -5317,7 +5468,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const chi_squared_distribution<_RT>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | ios_base::scientific); __os << __x.n(); @@ -5332,7 +5483,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, typedef chi_squared_distribution<_RT> _Eng; typedef typename _Eng::result_type result_type; typedef typename _Eng::param_type param_type; - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); result_type __n; __is >> __n; @@ -5437,7 +5588,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const cauchy_distribution<_RT>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | ios_base::scientific); _CharT __sp = __os.widen(' '); @@ -5454,7 +5605,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, typedef cauchy_distribution<_RT> _Eng; typedef typename _Eng::result_type result_type; typedef typename _Eng::param_type param_type; - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); result_type __a; result_type __b; @@ -5559,7 +5710,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const fisher_f_distribution<_RT>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | ios_base::scientific); _CharT __sp = __os.widen(' '); @@ -5576,7 +5727,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, typedef fisher_f_distribution<_RT> _Eng; typedef typename _Eng::result_type result_type; typedef typename _Eng::param_type param_type; - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); result_type __m; result_type __n; @@ -5675,7 +5826,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const student_t_distribution<_RT>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | ios_base::scientific); __os << __x.n(); @@ -5690,7 +5841,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, typedef student_t_distribution<_RT> _Eng; typedef typename _Eng::result_type result_type; typedef typename _Eng::param_type param_type; - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); result_type __n; __is >> __n; @@ -5898,7 +6049,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const discrete_distribution<_IT>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | ios_base::scientific); _CharT __sp = __os.widen(' '); @@ -5918,7 +6069,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, typedef discrete_distribution<_IT> _Eng; typedef typename _Eng::result_type result_type; typedef typename _Eng::param_type param_type; - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); size_t __n; __is >> __n; @@ -6202,7 +6353,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const piecewise_constant_distribution<_RT>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | ios_base::scientific); _CharT __sp = __os.widen(' '); @@ -6230,7 +6381,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, typedef piecewise_constant_distribution<_RT> _Eng; typedef typename _Eng::result_type result_type; typedef typename _Eng::param_type param_type; - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); size_t __n; __is >> __n; @@ -6417,23 +6568,23 @@ void piecewise_linear_distribution<_RealType>::param_type::__init() { __areas_.assign(__densities_.size() - 1, result_type()); - result_type _S = 0; + result_type _Sp = 0; for (size_t __i = 0; __i < __areas_.size(); ++__i) { __areas_[__i] = (__densities_[__i+1] + __densities_[__i]) * (__b_[__i+1] - __b_[__i]) * .5; - _S += __areas_[__i]; + _Sp += __areas_[__i]; } for (size_t __i = __areas_.size(); __i > 1;) { --__i; - __areas_[__i] = __areas_[__i-1] / _S; + __areas_[__i] = __areas_[__i-1] / _Sp; } __areas_[0] = 0; for (size_t __i = 1; __i < __areas_.size(); ++__i) __areas_[__i] += __areas_[__i-1]; for (size_t __i = 0; __i < __densities_.size(); ++__i) - __densities_[__i] /= _S; + __densities_[__i] /= _Sp; } template @@ -6542,7 +6693,7 @@ basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const piecewise_linear_distribution<_RT>& __x) { - __save_flags<_CharT, _Traits> _(__os); + __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | ios_base::scientific); _CharT __sp = __os.widen(' '); @@ -6570,7 +6721,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, typedef piecewise_linear_distribution<_RT> _Eng; typedef typename _Eng::result_type result_type; typedef typename _Eng::param_type param_type; - __save_flags<_CharT, _Traits> _(__is); + __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); size_t __n; __is >> __n; diff --git a/system/include/libcxx/ratio b/system/include/libcxx/ratio index 9764014a1e3a4..23f2267946210 100644 --- a/system/include/libcxx/ratio +++ b/system/include/libcxx/ratio @@ -70,7 +70,11 @@ typedef ratio<1000000000000000000000000, 1> yotta; // not supported #include #include +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -88,6 +92,12 @@ struct __static_gcd<_Xp, 0> static const intmax_t value = _Xp; }; +template <> +struct __static_gcd<0, 0> +{ + static const intmax_t value = 1; +}; + // __static_lcm template @@ -404,27 +414,27 @@ struct __ratio_less1 static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2; }; -template -struct __ratio_less1<_R1, _R2, _Odd, _Q, 0, _Q, 0> +template +struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, 0> { static const bool value = false; }; -template -struct __ratio_less1<_R1, _R2, _Odd, _Q, 0, _Q, _M2> +template +struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, _M2> { static const bool value = !_Odd; }; -template -struct __ratio_less1<_R1, _R2, _Odd, _Q, _M1, _Q, 0> +template +struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, 0> { static const bool value = _Odd; }; -template -struct __ratio_less1<_R1, _R2, _Odd, _Q, _M1, _Q, _M2> +struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, _M2> { static const bool value = __ratio_less1, ratio<_R2::den, _M2>, !_Odd>::value; diff --git a/system/include/libcxx/readme.txt b/system/include/libcxx/readme.txt index c7e41df98445b..c0c90c3a47663 100644 --- a/system/include/libcxx/readme.txt +++ b/system/include/libcxx/readme.txt @@ -1 +1 @@ -These files are from libc++, svn revision 140465, Sep 24 2011 +These files are from libc++, svn revision 176559, Mar 7 2013 diff --git a/system/include/libcxx/regex b/system/include/libcxx/regex index 5e195696ff286..982500f35ffca 100644 --- a/system/include/libcxx/regex +++ b/system/include/libcxx/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(); @@ -732,7 +732,11 @@ typedef regex_token_iterator wsregex_token_iterator; #include #include +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -756,7 +760,7 @@ enum syntax_option_type }; inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ +_LIBCPP_CONSTEXPR syntax_option_type operator~(syntax_option_type __x) { @@ -764,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) { @@ -772,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) { @@ -780,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) { @@ -788,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) { @@ -797,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) { @@ -806,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) { @@ -835,7 +836,7 @@ enum match_flag_type }; inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ +_LIBCPP_CONSTEXPR match_flag_type operator~(match_flag_type __x) { @@ -843,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) { @@ -851,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) { @@ -859,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) { @@ -867,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) { @@ -876,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) { @@ -885,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) { @@ -1233,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 @@ -2435,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 @@ -2508,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);} @@ -2559,6 +2562,7 @@ public: { __member_init(__f); __parse(__first, __last); + return *this; } #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS @@ -2790,54 +2794,75 @@ private: match_results& __m, regex_constants::match_flag_type __flags, bool) const; - template + template friend bool - regex_search(_B, _B, match_results<_B, _A>&, const basic_regex<_C, _T>&, + regex_search(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type); - template + template friend bool - regex_search(const _C*, const _C*, match_results&, - const basic_regex<_C, _T>&, regex_constants::match_flag_type); + regex_search(const _Cp*, const _Cp*, match_results&, + const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type); - template + template friend bool - regex_search(_B, _B, const basic_regex<_C, _T>&, + regex_search(_Bp, _Bp, const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type); - template + template friend bool - regex_search(const _C*, const _C*, - const basic_regex<_C, _T>&, regex_constants::match_flag_type); + regex_search(const _Cp*, const _Cp*, + const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type); - template + template friend bool - regex_search(const _C*, match_results&, const basic_regex<_C, _T>&, + regex_search(const _Cp*, match_results&, const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type); - template + template friend bool - regex_search(const basic_string<_C, _ST, _SA>& __s, - const basic_regex<_C, _T>& __e, + regex_search(const basic_string<_Cp, _ST, _SA>& __s, + const basic_regex<_Cp, _Tp>& __e, regex_constants::match_flag_type __flags); - template + template friend bool - regex_search(const basic_string<_C, _ST, _SA>& __s, - match_results::const_iterator, _A>&, - const basic_regex<_C, _T>& __e, + regex_search(const basic_string<_Cp, _ST, _SA>& __s, + match_results::const_iterator, _Ap>&, + const basic_regex<_Cp, _Tp>& __e, regex_constants::match_flag_type __flags); template friend class __lookahead; }; +template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::icase; +template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::nosubs; +template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::optimize; +template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::collate; +template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::ECMAScript; +template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::basic; +template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::extended; +template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::awk; +template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::grep; +template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::egrep; + template void basic_regex<_CharT, _Traits>::swap(basic_regex& __r) @@ -4400,7 +4425,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first, if (__hd == -1) throw regex_error(regex_constants::error_escape); #endif // _LIBCPP_NO_EXCEPTIONS - __sum = 16 * __sum + __hd; + __sum = 16 * __sum + static_cast(__hd); ++__first; #ifndef _LIBCPP_NO_EXCEPTIONS if (__first == __last) @@ -4411,7 +4436,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first, if (__hd == -1) throw regex_error(regex_constants::error_escape); #endif // _LIBCPP_NO_EXCEPTIONS - __sum = 16 * __sum + __hd; + __sum = 16 * __sum + static_cast(__hd); // drop through case 'x': ++__first; @@ -4424,7 +4449,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first, if (__hd == -1) throw regex_error(regex_constants::error_escape); #endif // _LIBCPP_NO_EXCEPTIONS - __sum = 16 * __sum + __hd; + __sum = 16 * __sum + static_cast(__hd); ++__first; #ifndef _LIBCPP_NO_EXCEPTIONS if (__first == __last) @@ -4435,7 +4460,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first, if (__hd == -1) throw regex_error(regex_constants::error_escape); #endif // _LIBCPP_NO_EXCEPTIONS - __sum = 16 * __sum + __hd; + __sum = 16 * __sum + static_cast(__hd); if (__str) *__str = _CharT(__sum); else @@ -4736,7 +4761,7 @@ public: bool matched; _LIBCPP_INLINE_VISIBILITY - /*constexpr*/ sub_match() : matched() {} + _LIBCPP_CONSTEXPR sub_match() : matched() {} _LIBCPP_INLINE_VISIBILITY difference_type length() const @@ -5210,11 +5235,11 @@ public: const_reference suffix() const {return __suffix_;} _LIBCPP_INLINE_VISIBILITY - const_iterator begin() const {return empty() ? __matches_.end() : __matches_.begin() + 1;} + const_iterator begin() const {return empty() ? __matches_.end() : __matches_.begin();} _LIBCPP_INLINE_VISIBILITY const_iterator end() const {return __matches_.end();} _LIBCPP_INLINE_VISIBILITY - const_iterator cbegin() const {return empty() ? __matches_.end() : __matches_.begin() + 1;} + const_iterator cbegin() const {return empty() ? __matches_.end() : __matches_.begin();} _LIBCPP_INLINE_VISIBILITY const_iterator cend() const {return __matches_.end();} @@ -5259,12 +5284,12 @@ public: // swap: void swap(match_results& __m); - template + template _LIBCPP_INLINE_VISIBILITY void __assign(_BidirectionalIterator __f, _BidirectionalIterator __l, - const match_results<_B, _A>& __m, bool __no_update_pos) + const match_results<_Bp, _Ap>& __m, bool __no_update_pos) { - _B __mf = __m.prefix().first; + _Bp __mf = __m.prefix().first; __matches_.resize(__m.size()); for (size_type __i = 0; __i < __matches_.size(); ++__i) { @@ -5293,16 +5318,16 @@ private: template friend class basic_regex; - template + template friend bool - regex_match(_B, _B, match_results<_B, _A>&, const basic_regex<_C, _T>&, + regex_match(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type); - template + template friend bool - operator==(const match_results<_B, _A>&, const match_results<_B, _A>&); + operator==(const match_results<_Bp, _Ap>&, const match_results<_Bp, _Ap>&); template friend class __lookahead; }; @@ -5492,8 +5517,6 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma( regex_constants::match_flag_type __flags, bool __at_first) const { vector<__state> __states; - ptrdiff_t __j = 0; - ptrdiff_t _N = _VSTD::distance(__first, __last); __node* __st = __start_.get(); if (__st) { @@ -5507,7 +5530,6 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma( __states.back().__node_ = __st; __states.back().__flags_ = __flags; __states.back().__at_first_ = __at_first; - bool __matched = false; do { __state& __s = __states.back(); @@ -5559,7 +5581,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs( { deque<__state> __states; ptrdiff_t __highest_j = 0; - ptrdiff_t _N = _VSTD::distance(__first, __last); + ptrdiff_t _Np = _VSTD::distance(__first, __last); __node* __st = __start_.get(); if (__st) { @@ -5584,7 +5606,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs( if (!__matched || __highest_j < __s.__current_ - __s.__first_) __highest_j = __s.__current_ - __s.__first_; __matched = true; - if (__highest_j == _N) + if (__highest_j == _Np) __states.clear(); else __states.pop_back(); @@ -5639,7 +5661,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs( __state __best_state; ptrdiff_t __j = 0; ptrdiff_t __highest_j = 0; - ptrdiff_t _N = _VSTD::distance(__first, __last); + ptrdiff_t _Np = _VSTD::distance(__first, __last); __node* __st = __start_.get(); if (__st) { @@ -5669,7 +5691,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs( __best_state = __s; } __matched = true; - if (__highest_j == _N) + if (__highest_j == _Np) __states.clear(); else __states.pop_back(); @@ -6084,11 +6106,11 @@ public: regex_constants::match_flag_type __m = regex_constants::match_default); #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template + template regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b, const regex_type& __re, - const int (&__submatches)[_N], + const int (&__submatches)[_Np], regex_constants::match_flag_type __m = regex_constants::match_default); regex_token_iterator(const regex_token_iterator&); @@ -6190,15 +6212,15 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>:: #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template -template +template regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>:: regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b, const regex_type& __re, - const int (&__submatches)[_N], + const int (&__submatches)[_Np], regex_constants::match_flag_type __m) : __position_(__a, __b, __re, __m), _N_(0), - __subs_(__submatches, __submatches + _N) + __subs_(__submatches, __submatches + _Np) { __init(__a, __b); } diff --git a/system/include/libcxx/scoped_allocator b/system/include/libcxx/scoped_allocator index 9427a376d885f..cd051020f61cd 100644 --- a/system/include/libcxx/scoped_allocator +++ b/system/include/libcxx/scoped_allocator @@ -106,7 +106,9 @@ template #include <__config> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/system/include/libcxx/set b/system/include/libcxx/set index fe3d382768e3d..36d3dd49b9bdc 100644 --- a/system/include/libcxx/set +++ b/system/include/libcxx/set @@ -338,7 +338,9 @@ swap(multiset& x, multiset& y) #include <__tree> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/system/include/libcxx/sstream b/system/include/libcxx/sstream index a2a0d31a8ce2c..22450f0adb2b2 100644 --- a/system/include/libcxx/sstream +++ b/system/include/libcxx/sstream @@ -175,7 +175,11 @@ typedef basic_stringstream wstringstream; #include #include +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/system/include/libcxx/stack b/system/include/libcxx/stack index 3d72f96692818..12fb35b703e31 100644 --- a/system/include/libcxx/stack +++ b/system/include/libcxx/stack @@ -85,17 +85,21 @@ template #include <__config> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _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/system/include/libcxx/stdexcept b/system/include/libcxx/stdexcept index d31dc8b072cb8..ef5de595f032f 100644 --- a/system/include/libcxx/stdexcept +++ b/system/include/libcxx/stdexcept @@ -46,7 +46,9 @@ public: #include #include // for string forward decl +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif namespace std // purposefully not using versioning namespace { diff --git a/system/include/libcxx/streambuf b/system/include/libcxx/streambuf index feb62c7e193a9..d688024102269 100644 --- a/system/include/libcxx/streambuf +++ b/system/include/libcxx/streambuf @@ -112,7 +112,9 @@ protected: #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -459,15 +461,15 @@ basic_streambuf<_CharT, _Traits>::setbuf(char_type*, streamsize) template typename basic_streambuf<_CharT, _Traits>::pos_type -basic_streambuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way, - ios_base::openmode __which) +basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir, + ios_base::openmode) { return pos_type(off_type(-1)); } template typename basic_streambuf<_CharT, _Traits>::pos_type -basic_streambuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode __which) +basic_streambuf<_CharT, _Traits>::seekpos(pos_type, ios_base::openmode) { return pos_type(off_type(-1)); } @@ -538,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; @@ -546,16 +548,16 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n) template typename basic_streambuf<_CharT, _Traits>::int_type -basic_streambuf<_CharT, _Traits>::overflow(int_type __c) +basic_streambuf<_CharT, _Traits>::overflow(int_type) { return traits_type::eof(); } -extern template class basic_streambuf; -extern template class basic_streambuf; +_LIBCPP_EXTERN_TEMPLATE(class basic_streambuf) +_LIBCPP_EXTERN_TEMPLATE(class basic_streambuf) -extern template class basic_ios; -extern template class basic_ios; +_LIBCPP_EXTERN_TEMPLATE(class basic_ios) +_LIBCPP_EXTERN_TEMPLATE(class basic_ios) _LIBCPP_END_NAMESPACE_STD diff --git a/system/include/libcxx/string b/system/include/libcxx/string index 2041510fe5087..1a70467940c7c 100644 --- a/system/include/libcxx/string +++ b/system/include/libcxx/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; @@ -446,7 +446,11 @@ template <> struct hash; #include #endif +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -502,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); @@ -515,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);} }; @@ -627,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 @@ -651,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);} }; @@ -682,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 @@ -708,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);} }; @@ -739,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); @@ -753,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);} }; @@ -859,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); @@ -873,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);} }; @@ -1021,7 +1027,14 @@ __basic_string_common<__b>::__throw_out_of_range() const #endif } -extern template class __basic_string_common; +#ifdef _MSC_VER +#pragma warning( push ) +#pragma warning( disable: 4231 ) +#endif // _MSC_VER +_LIBCPP_EXTERN_TEMPLATE(class __basic_string_common) +#ifdef _MSC_VER +#pragma warning( pop ) +#endif // _MSC_VER template class _LIBCPP_VISIBLE basic_string @@ -1068,7 +1081,7 @@ private: enum {__long_mask = ~(size_type(~0) >> 1)}; #else // _LIBCPP_BIG_ENDIAN enum {__short_mask = 0x01}; - enum {__long_mask = 0x1}; + enum {__long_mask = 0x1ul}; #endif // _LIBCPP_BIG_ENDIAN enum {__mask = size_type(~0) >> 1}; @@ -1081,14 +1094,14 @@ private: union { unsigned char __size_; - value_type _; + value_type __lx; }; value_type __data_[__min_cap]; }; - union _{__long _; __short __;}; + union __lx{__long __lx; __short __lxx;}; - enum {__n_words = sizeof(_) / sizeof(size_type)}; + enum {__n_words = sizeof(__lx) / sizeof(size_type)}; struct __raw { @@ -1490,7 +1503,7 @@ private: {__r_.first().__l.__cap_ = __long_mask | __s;} _LIBCPP_INLINE_VISIBILITY size_type __get_long_cap() const _NOEXCEPT - {return __r_.first().__l.__cap_ & ~__long_mask;} + {return __r_.first().__l.__cap_ & size_type(~__long_mask);} _LIBCPP_INLINE_VISIBILITY void __set_long_pointer(pointer __p) _NOEXCEPT @@ -1580,7 +1593,7 @@ private: } _LIBCPP_INLINE_VISIBILITY - void __copy_assign_alloc(const basic_string& __str, false_type) _NOEXCEPT + void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT {} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -1608,7 +1621,7 @@ private: } _LIBCPP_INLINE_VISIBILITY - void __move_assign_alloc(basic_string& __c, false_type) + void __move_assign_alloc(basic_string&, false_type) _NOEXCEPT {} @@ -1627,7 +1640,7 @@ private: swap(__x, __y); } _LIBCPP_INLINE_VISIBILITY - static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type) _NOEXCEPT + static void __swap_alloc(allocator_type&, allocator_type&, false_type) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators(); @@ -1658,7 +1671,11 @@ template _LIBCPP_INLINE_VISIBILITY inline #endif void -basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type __pos) +basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type +#ifdef _LIBCPP_DEBUG + __pos +#endif + ) { #ifdef _LIBCPP_DEBUG const_iterator __beg = begin(); @@ -2191,6 +2208,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(_InputIterator __first, _Input clear(); for (; __first != __last; ++__first) push_back(*__first); + return *this; } template @@ -2774,7 +2792,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos) iterator __b = begin(); size_type __r = static_cast(__pos - __b); erase(__r, 1); - return __b + __r; + return __b + static_cast(__r); } template @@ -2785,7 +2803,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_i iterator __b = begin(); size_type __r = static_cast(__first - __b); erase(__r, static_cast(__last - __first)); - return __b + __r; + return __b + static_cast(__r); } template @@ -3356,7 +3374,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c, { const_pointer __p = data(); const_pointer __pe = __p + __sz; - for (const_pointer __ps = __p + __pos; __p != __pe; ++__ps) + for (const_pointer __ps = __p + __pos; __ps != __pe; ++__ps) if (!traits_type::eq(*__ps, __c)) return static_cast(__ps - __p); } @@ -3472,7 +3490,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, template int -basic_string<_CharT, _Traits, _Allocator>::compare(const_pointer __s) const +basic_string<_CharT, _Traits, _Allocator>::compare(const_pointer __s) const _NOEXCEPT { #ifdef _LIBCPP_DEBUG assert(__s != 0); @@ -3900,16 +3918,8 @@ template template size_t _LIBCPP_INLINE_VISIBILITY __do_string_hash(_Ptr __p, _Ptr __e) { - size_t __r = 0; - const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8; - const size_t __m = size_t(0xF) << (__sr + 4); - for (; __p != __e; ++__p) - { - __r = (__r << 4) + *__p; - size_t __g = __r & __m; - __r ^= __g | (__g >> __sr); - } - return __r; + typedef typename iterator_traits<_Ptr>::value_type value_type; + return __murmur2_or_cityhash()(__p, (__e-__p)*sizeof(value_type)); } template @@ -3965,8 +3975,8 @@ getline(basic_istream<_CharT, _Traits>&& __is, #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -extern template class basic_string; -extern template class basic_string; +_LIBCPP_EXTERN_TEMPLATE(class basic_string) +_LIBCPP_EXTERN_TEMPLATE(class basic_string) extern template string diff --git a/system/include/libcxx/strstream b/system/include/libcxx/strstream index 4ff34a55be4d7..5eadefd12b90a 100644 --- a/system/include/libcxx/strstream +++ b/system/include/libcxx/strstream @@ -131,7 +131,9 @@ private: #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/system/include/libcxx/support/solaris/floatingpoint.h b/system/include/libcxx/support/solaris/floatingpoint.h new file mode 100644 index 0000000000000..21b0349aa593b --- /dev/null +++ b/system/include/libcxx/support/solaris/floatingpoint.h @@ -0,0 +1,5 @@ +#define atof sun_atof +#define strtod sun_strtod +#include_next "floatingpoint.h" +#undef atof +#undef strtod diff --git a/system/include/libcxx/support/solaris/wchar.h b/system/include/libcxx/support/solaris/wchar.h new file mode 100644 index 0000000000000..05a7241789d35 --- /dev/null +++ b/system/include/libcxx/support/solaris/wchar.h @@ -0,0 +1,38 @@ +#define iswalpha sun_iswalpha +#define iswupper sun_iswupper +#define iswlower sun_iswlower +#define iswdigit sun_iswdigit +#define iswxdigit sun_iswxdigit +#define iswalnum sun_iswalnum +#define iswspace sun_iswspace +#define iswpunct sun_iswpunct +#define iswprint sun_iswprint +#define iswgraph sun_iswgraph +#define iswcntrl sun_iswcntrl +#define iswctype sun_iswctype +#define towlower sun_towlower +#define towupper sun_towupper +#define wcswcs sun_wcswcs +#define wcswidth sun_wcswidth +#define wcwidth sun_wcwidth +#define wctype sun_wctype +#define _WCHAR_T 1 +#include_next "wchar.h" +#undef iswalpha +#undef iswupper +#undef iswlower +#undef iswdigit +#undef iswxdigit +#undef iswalnum +#undef iswspace +#undef iswpunct +#undef iswprint +#undef iswgraph +#undef iswcntrl +#undef iswctype +#undef towlower +#undef towupper +#undef wcswcs +#undef wcswidth +#undef wcwidth +#undef wctype diff --git a/system/include/libcxx/support/solaris/xlocale.h b/system/include/libcxx/support/solaris/xlocale.h new file mode 100644 index 0000000000000..359508d9f8f0b --- /dev/null +++ b/system/include/libcxx/support/solaris/xlocale.h @@ -0,0 +1,146 @@ +//////////////////////////////////////////////////////////////////////////////// +// Minimal xlocale implementation for Solaris. This implements the subset of +// the xlocale APIs that libc++ depends on. +//////////////////////////////////////////////////////////////////////////////// +#ifndef __XLOCALE_H_INCLUDED +#define __XLOCALE_H_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct _LC_locale_t* locale_t; + +#define LC_COLLATE_MASK (1<<0) +#define LC_CTYPE_MASK (1<<1) +#define LC_MESSAGES_MASK (1<<2) +#define LC_MONETARY_MASK (1<<3) +#define LC_NUMERIC_MASK (1<<4) +#define LC_TIME_MASK (1<<5) +#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | \ + LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK) + +#define LC_GLOBAL_LOCALE ((locale_t)-1) + +size_t __mb_cur_max(locale_t l); +#define MB_CUR_MAX_L(l) __mb_cur_max(l) + +locale_t newlocale(int mask, const char * locale, locale_t base); +void freelocale(locale_t loc); + +wint_t btowc_l(int __c, locale_t __l); + +int wctob_l(wint_t __c, locale_t __l); + +size_t wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l); + +size_t mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n, + mbstate_t *__ps, locale_t __l); + +int mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l); + +size_t mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l); + +struct lconv *localeconv_l(locale_t __l); + +size_t mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len, + mbstate_t *__ps, locale_t __l); + +int sprintf_l(char *__s, locale_t __l, const char *__format, ...); + +int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...); + +int asprintf_l(char **__s, locale_t __l, const char *__format, ...); + +int sscanf_l(const char *__s, locale_t __l, const char *__format, ...); + +int isalnum_l(int,locale_t); +int isalpha_l(int,locale_t); +int isblank_l(int,locale_t); +int iscntrl_l(int,locale_t); +int isdigit_l(int,locale_t); +int isgraph_l(int,locale_t); +int islower_l(int,locale_t); +int isprint_l(int,locale_t); +int ispunct_l(int,locale_t); +int isspace_l(int,locale_t); +int isupper_l(int,locale_t); +int isxdigit_l(int,locale_t); + +int iswalnum_l(wchar_t,locale_t); +int iswalpha_l(wchar_t,locale_t); +int iswblank_l(wchar_t,locale_t); +int iswcntrl_l(wchar_t,locale_t); +int iswdigit_l(wchar_t,locale_t); +int iswgraph_l(wchar_t,locale_t); +int iswlower_l(wchar_t,locale_t); +int iswprint_l(wchar_t,locale_t); +int iswpunct_l(wchar_t,locale_t); +int iswspace_l(wchar_t,locale_t); +int iswupper_l(wchar_t,locale_t); +int iswxdigit_l(wchar_t,locale_t); + +int iswctype_l(wint_t, wctype_t, locale_t); + +int toupper_l(int __c, locale_t __l); +int tolower_l(int __c, locale_t __l); +wint_t towupper_l(wint_t __c, locale_t __l); +wint_t towlower_l(wint_t __c, locale_t __l); + + +int strcoll_l(const char *__s1, const char *__s2, locale_t __l); +int wcscoll_l(const wchar_t *__s1, const wchar_t *__s2, locale_t __l); +size_t strftime_l(char *__s, size_t __size, const char *__fmt, const struct tm + *__tm, locale_t __l); + +size_t strxfrm_l(char *__s1, const char *__s2, size_t __n, locale_t __l); + +size_t wcsxfrm_l(wchar_t *__ws1, const wchar_t *__ws2, size_t __n, + locale_t __l); + + + +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); + + +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_t __cloc(void); + +// FIXME: These are quick-and-dirty hacks to make things pretend to work +static inline +long long strtoll_l(const char *__nptr, char **__endptr, + int __base, locale_t __loc) { + return strtoll(__nptr, __endptr, __base); +} +static inline +long strtol_l(const char *__nptr, char **__endptr, + int __base, locale_t __loc) { + return strtol(__nptr, __endptr, __base); +} +static inline +long double strtold_l(const char *__nptr, char **__endptr, + locale_t __loc) { + return strtold(__nptr, __endptr); +} +static inline +unsigned long long strtoull_l(const char *__nptr, char **__endptr, + int __base, locale_t __loc) { + return strtoull(__nptr, __endptr, __base); +} +static inline +unsigned long strtoul_l(const char *__nptr, char **__endptr, + int __base, locale_t __loc) { + return strtoul(__nptr, __endptr, __base); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/system/include/libcxx/support/win32/limits_win32.h b/system/include/libcxx/support/win32/limits_win32.h new file mode 100644 index 0000000000000..671631df2f9c0 --- /dev/null +++ b/system/include/libcxx/support/win32/limits_win32.h @@ -0,0 +1,79 @@ +// -*- C++ -*- +//===--------------------- support/win32/limits_win32.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. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H +#define _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H + +#if !defined(_MSC_VER) +#error "This header is MSVC specific, Clang and GCC should not include it" +#else + +#ifndef NOMINMAX +#define NOMINMAX +#endif +#include // ymath.h works correctly + +#include // limit constants + +#define __FLT_MANT_DIG__ FLT_MANT_DIG +#define __FLT_DIG__ FLT_DIG +#define __FLT_RADIX__ FLT_RADIX +#define __FLT_MIN_EXP__ FLT_MIN_EXP +#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP +#define __FLT_MAX_EXP__ FLT_MAX_EXP +#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP +#define __FLT_MIN__ FLT_MIN +#define __FLT_MAX__ FLT_MAX +#define __FLT_EPSILON__ FLT_EPSILON +// predefined by MinGW GCC +#define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F + +#define __DBL_MANT_DIG__ DBL_MANT_DIG +#define __DBL_DIG__ DBL_DIG +#define __DBL_RADIX__ DBL_RADIX +#define __DBL_MIN_EXP__ DBL_MIN_EXP +#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP +#define __DBL_MAX_EXP__ DBL_MAX_EXP +#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP +#define __DBL_MIN__ DBL_MIN +#define __DBL_MAX__ DBL_MAX +#define __DBL_EPSILON__ DBL_EPSILON +// predefined by MinGW GCC +#define __DBL_DENORM_MIN__ double(4.94065645841246544177e-324L) + +#define __LDBL_MANT_DIG__ LDBL_MANT_DIG +#define __LDBL_DIG__ LDBL_DIG +#define __LDBL_RADIX__ LDBL_RADIX +#define __LDBL_MIN_EXP__ LDBL_MIN_EXP +#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP +#define __LDBL_MAX_EXP__ LDBL_MAX_EXP +#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP +#define __LDBL_MIN__ LDBL_MIN +#define __LDBL_MAX__ LDBL_MAX +#define __LDBL_EPSILON__ LDBL_EPSILON +// predefined by MinGW GCC +#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L + +// __builtin replacements/workarounds +#include // HUGE_VAL +#include // internal MSVC header providing the needed functionality +#define __builtin_huge_val() HUGE_VAL +#define __builtin_huge_valf() _FInf._Float +#define __builtin_huge_vall() _LInf._Long_double +#define __builtin_nan(__dummy) _Nan._Double +#define __builtin_nanf(__dummy) _FNan._Float +#define __builtin_nanl(__dummmy) _LNan._Long_double +#define __builtin_nans(__dummy) _Snan._Double +#define __builtin_nansf(__dummy) _FSnan._Float +#define __builtin_nansl(__dummy) _LSnan._Long_double + +#endif // _MSC_VER + +#endif // _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H diff --git a/system/include/libcxx/support/win32/locale_win32.h b/system/include/libcxx/support/win32/locale_win32.h new file mode 100644 index 0000000000000..e035420fb582b --- /dev/null +++ b/system/include/libcxx/support/win32/locale_win32.h @@ -0,0 +1,116 @@ +// -*- C++ -*- +//===--------------------- support/win32/locale_win32.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. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H +#define _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H + +// ctype mask table defined in msvcrt.dll +extern "C" unsigned short __declspec(dllimport) _ctype[]; + +#include "support/win32/support.h" +#include +#include // _locale_t +#define locale_t _locale_t +#define LC_COLLATE_MASK _M_COLLATE +#define LC_CTYPE_MASK _M_CTYPE +#define LC_MONETARY_MASK _M_MONETARY +#define LC_NUMERIC_MASK _M_NUMERIC +#define LC_TIME_MASK _M_TIME +#define LC_MESSAGES_MASK _M_MESSAGES +#define LC_ALL_MASK ( LC_COLLATE_MASK \ + | LC_CTYPE_MASK \ + | LC_MESSAGES_MASK \ + | LC_MONETARY_MASK \ + | LC_NUMERIC_MASK \ + | LC_TIME_MASK ) +#define freelocale _free_locale +// FIXME: base currently unused. Needs manual work to construct the new locale +locale_t newlocale( int mask, const char * locale, locale_t base ); +locale_t uselocale( locale_t newloc ); +lconv *localeconv_l( locale_t loc ); +size_t mbrlen_l( const char *__restrict__ s, size_t n, + mbstate_t *__restrict__ ps, locale_t loc); +size_t mbsrtowcs_l( wchar_t *__restrict__ dst, const char **__restrict__ src, + size_t len, mbstate_t *__restrict__ ps, locale_t loc ); +size_t wcrtomb_l( char *__restrict__ s, wchar_t wc, mbstate_t *__restrict__ ps, + locale_t loc); +size_t mbrtowc_l( wchar_t *__restrict__ pwc, const char *__restrict__ s, + size_t n, mbstate_t *__restrict__ ps, locale_t loc); +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); +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); +wint_t btowc_l( int c, locale_t loc ); +int wctob_l( wint_t c, locale_t loc ); +typedef _VSTD::remove_pointer::type __locale_struct; +typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii; +_LIBCPP_ALWAYS_INLINE inline +decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l ) +{ + __locale_raii __current( uselocale(__l), uselocale ); + return MB_CUR_MAX; +} + +// the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+ +#include +#define mbtowc_l _mbtowc_l +#define strtoll_l _strtoi64_l +#define strtoull_l _strtoui64_l +// FIXME: current msvcrt does not know about long double +#define strtold_l _strtod_l +#define islower_l _islower_l +#define isupper_l _isupper_l +#define isdigit_l _isdigit_l +#define isxdigit_l _isxdigit_l +#define strcoll_l _strcoll_l +#define strxfrm_l _strxfrm_l +#define wcscoll_l _wcscoll_l +#define wcsxfrm_l _wcsxfrm_l +#define toupper_l _toupper_l +#define tolower_l _tolower_l +#define iswspace_l _iswspace_l +#define iswprint_l _iswprint_l +#define iswcntrl_l _iswcntrl_l +#define iswupper_l _iswupper_l +#define iswlower_l _iswlower_l +#define iswalpha_l _iswalpha_l +#define iswdigit_l _iswdigit_l +#define iswpunct_l _iswpunct_l +#define iswxdigit_l _iswxdigit_l +#define towupper_l _towupper_l +#define towlower_l _towlower_l +#define strftime_l _strftime_l +#define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ ) +#define vsscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ ) +#define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ ) +#define snprintf_l( __s, __n, __l, __f, ... ) _snprintf_l( __s, __n, __f, __l, __VA_ARGS__ ) +#define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, __VA_ARGS__ ) +#define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, __l, __VA_ARGS__ ) +int asprintf_l( char **ret, locale_t loc, const char *format, ... ); +int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap ); + + +// not-so-pressing FIXME: use locale to determine blank characters +inline int isblank_l( int c, locale_t /*loc*/ ) +{ + return ( c == ' ' || c == '\t' ); +} +inline int iswblank_l( wint_t c, locale_t /*loc*/ ) +{ + return ( c == L' ' || c == L'\t' ); +} + +#ifdef _MSC_VER +inline int isblank( int c, locale_t /*loc*/ ) +{ return ( c == ' ' || c == '\t' ); } +inline int iswblank( wint_t c, locale_t /*loc*/ ) +{ return ( c == L' ' || c == L'\t' ); } +#endif // _MSC_VER +#endif // _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H diff --git a/system/include/libcxx/support/win32/math_win32.h b/system/include/libcxx/support/win32/math_win32.h new file mode 100644 index 0000000000000..41c50d6247442 --- /dev/null +++ b/system/include/libcxx/support/win32/math_win32.h @@ -0,0 +1,113 @@ +// -*- C++ -*- +//===---------------------- support/win32/math_win32.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. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H +#define _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H + +#if !defined(_MSC_VER) +#error "This header is MSVC specific, Clang and GCC should not include it" +#else + +#include + +typedef float float_t; +typedef double double_t; + +_LIBCPP_ALWAYS_INLINE bool isfinite( double num ) +{ + return _finite(num) != 0; +} +_LIBCPP_ALWAYS_INLINE bool isinf( double num ) +{ + return !isfinite(num) && !_isnan(num); +} +_LIBCPP_ALWAYS_INLINE bool isnan( double num ) +{ + return _isnan(num) != 0; +} +_LIBCPP_ALWAYS_INLINE bool isnormal( double num ) +{ + int class_ = _fpclass(num); + return class_ == _FPCLASS_NN || class_ == _FPCLASS_PN; +} + +_LIBCPP_ALWAYS_INLINE bool isgreater( double x, double y ) +{ + if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false; + else return x > y; +} + +_LIBCPP_ALWAYS_INLINE bool isgreaterequal( double x, double y ) +{ + if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false; + else return x >= y; +} + +_LIBCPP_ALWAYS_INLINE bool isless( double x, double y ) +{ + if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false; + else return x < y; +} + +_LIBCPP_ALWAYS_INLINE bool islessequal( double x, double y ) +{ + if(::_fpclass(x) == _FPCLASS_SNAN || ::_fpclass(y) == _FPCLASS_SNAN) return false; + else return x <= y; +} + +_LIBCPP_ALWAYS_INLINE bool islessgreater( double x, double y ) +{ + if(::_fpclass(x) == _FPCLASS_SNAN || ::_fpclass(y) == _FPCLASS_SNAN) return false; + else return x < y || x > y; +} + +_LIBCPP_ALWAYS_INLINE bool isunordered( double x, double y ) +{ + return isnan(x) || isnan(y); +} +_LIBCPP_ALWAYS_INLINE bool signbit( double num ) +{ + switch(_fpclass(num)) + { + case _FPCLASS_SNAN: + case _FPCLASS_QNAN: + case _FPCLASS_NINF: + case _FPCLASS_NN: + case _FPCLASS_ND: + case _FPCLASS_NZ: + return true; + case _FPCLASS_PZ: + case _FPCLASS_PD: + case _FPCLASS_PN: + case _FPCLASS_PINF: + return false; + } + return false; +} +_LIBCPP_ALWAYS_INLINE float copysignf( float x, float y ) +{ + return (signbit (x) != signbit (y) ? - x : x); +} +_LIBCPP_ALWAYS_INLINE double copysign( double x, double y ) +{ + return ::_copysign(x,y); +} +_LIBCPP_ALWAYS_INLINE double copysignl( long double x, long double y ) +{ + return ::_copysignl(x,y); +} +_LIBCPP_ALWAYS_INLINE int fpclassify( double num ) +{ + return _fpclass(num); +} + +#endif // _MSC_VER + +#endif // _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H diff --git a/system/include/libcxx/support/win32/support.h b/system/include/libcxx/support/win32/support.h new file mode 100644 index 0000000000000..0b8a912ac1767 --- /dev/null +++ b/system/include/libcxx/support/win32/support.h @@ -0,0 +1,115 @@ +// -*- 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. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_SUPPORT_WIN32_SUPPORT_H +#define _LIBCPP_SUPPORT_WIN32_SUPPORT_H + +/* + Functions and constants used in libc++ that are missing from the Windows C library. + */ + +#include <__config> +#include // mbstate_t +#include // _snwprintf +#define swprintf _snwprintf +#define vswprintf _vsnwprintf +#define vfscnaf fscanf + +int vasprintf( char **sptr, const char *__restrict fmt , va_list ap ); +int asprintf( char **sptr, const char *__restrict fmt, ...); +//int vfscanf( FILE *__restrict stream, const char *__restrict format, +// va_list arg); + +size_t mbsnrtowcs( wchar_t *__restrict dst, const char **__restrict src, + size_t nmc, size_t len, mbstate_t *__restrict ps ); +size_t wcsnrtombs( char *__restrict dst, const wchar_t **__restrict src, + size_t nwc, size_t len, mbstate_t *__restrict ps ); + +#if defined(_MSC_VER) +#define snprintf _snprintf + +#include +#define atoll _atoi64 +#define strtoll _strtoi64 +#define strtoull _strtoui64 +#define wcstoll _wcstoi64 +#define wcstoull _wcstoui64 +_LIBCPP_ALWAYS_INLINE float strtof( const char *nptr, char **endptr ) +{ return _Stof(nptr, endptr, 0); } +_LIBCPP_ALWAYS_INLINE double strtod( const char *nptr, char **endptr ) +{ return _Stod(nptr, endptr, 0); } +_LIBCPP_ALWAYS_INLINE long double strtold( const char *nptr, char **endptr ) +{ return _Stold(nptr, endptr, 0); } + +#define _Exit _exit + +#ifndef __clang__ // MSVC-based Clang also defines _MSC_VER +#include + +_LIBCPP_ALWAYS_INLINE int __builtin_popcount(unsigned int x) { + static const unsigned int m1 = 0x55555555; //binary: 0101... + static const unsigned int m2 = 0x33333333; //binary: 00110011.. + static const unsigned int m4 = 0x0f0f0f0f; //binary: 4 zeros, 4 ones ... + static const unsigned int h01= 0x01010101; //the sum of 256 to the power of 0,1,2,3... + x -= (x >> 1) & m1; //put count of each 2 bits into those 2 bits + x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits + x = (x + (x >> 4)) & m4; //put count of each 8 bits into those 8 bits + return (x * h01) >> 24; //returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24) +} + +_LIBCPP_ALWAYS_INLINE int __builtin_popcountl(unsigned long x) { + return __builtin_popcount(static_cast(x)); +} + +_LIBCPP_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) { + static const unsigned long long m1 = 0x5555555555555555; //binary: 0101... + static const unsigned long long m2 = 0x3333333333333333; //binary: 00110011.. + static const unsigned long long m4 = 0x0f0f0f0f0f0f0f0f; //binary: 4 zeros, 4 ones ... + static const unsigned long long h01 = 0x0101010101010101; //the sum of 256 to the power of 0,1,2,3... + x -= (x >> 1) & m1; //put count of each 2 bits into those 2 bits + x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits + x = (x + (x >> 4)) & m4; //put count of each 8 bits into those 8 bits + return static_cast((x * h01)>>56); //returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24) + ... +} + +_LIBCPP_ALWAYS_INLINE int __builtin_ctz( unsigned int x ) +{ + DWORD r = 0; + _BitScanReverse(&r, x); + return static_cast(r); +} +// sizeof(long) == sizeof(int) on Windows +_LIBCPP_ALWAYS_INLINE int __builtin_ctzl( unsigned long x ) +{ return __builtin_ctz( static_cast(x) ); } +_LIBCPP_ALWAYS_INLINE int __builtin_ctzll( unsigned long long x ) +{ + DWORD r = 0; + _BitScanReverse64(&r, x); + return static_cast(r); +} +_LIBCPP_ALWAYS_INLINE int __builtin_clz( unsigned int x ) +{ + DWORD r = 0; + _BitScanForward(&r, x); + return static_cast(r); +} +// sizeof(long) == sizeof(int) on Windows +_LIBCPP_ALWAYS_INLINE int __builtin_clzl( unsigned long x ) +{ return __builtin_clz( static_cast(x) ); } +_LIBCPP_ALWAYS_INLINE int __builtin_clzll( unsigned long long x ) +{ + DWORD r = 0; + _BitScanForward64(&r, x); + return static_cast(r); +} +#endif // !__clang__ +#endif // _MSC_VER + +#endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H diff --git a/system/include/libcxx/system_error b/system/include/libcxx/system_error index 5e1e6fe4b2960..cbc52fb78b38a 100644 --- a/system/include/libcxx/system_error +++ b/system/include/libcxx/system_error @@ -223,7 +223,9 @@ template <> struct hash; #include #include <__functional_base> +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -243,9 +245,8 @@ struct _LIBCPP_VISIBLE is_error_condition_enum // for them: //enum class errc -struct errc +_LIBCPP_DECLARE_STRONG_ENUM(errc) { -enum _ { address_family_not_supported = EAFNOSUPPORT, address_in_use = EADDRINUSE, address_not_available = EADDRNOTAVAIL, @@ -341,38 +342,32 @@ enum _ { value_too_large = EOVERFLOW, wrong_protocol_type = EPROTOTYPE }; - - _ __v_; - - _LIBCPP_ALWAYS_INLINE - errc(_ __v) : __v_(__v) {} - _LIBCPP_ALWAYS_INLINE - operator int() const {return __v_;} - -}; +_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(errc) template <> struct _LIBCPP_VISIBLE is_error_condition_enum : true_type { }; +#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS template <> -struct _LIBCPP_VISIBLE is_error_condition_enum +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 { public: virtual ~error_category() _NOEXCEPT; -private: error_category() _NOEXCEPT; +private: error_category(const error_category&);// = delete; error_category& operator=(const error_category&);// = delete; @@ -392,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 @@ -417,10 +412,10 @@ public: error_condition(int __val, const error_category& __cat) _NOEXCEPT : __val_(__val), __cat_(&__cat) {} - template + template _LIBCPP_ALWAYS_INLINE - error_condition(_E __e, - typename enable_if::value>::type* = 0 + error_condition(_Ep __e, + typename enable_if::value>::type* = 0 ) _NOEXCEPT {*this = make_error_condition(__e);} @@ -431,14 +426,14 @@ public: __cat_ = &__cat; } - template + template _LIBCPP_ALWAYS_INLINE typename enable_if < - is_error_condition_enum<_E>::value, + is_error_condition_enum<_Ep>::value, error_condition& >::type - operator=(_E __e) _NOEXCEPT + operator=(_Ep __e) _NOEXCEPT {*this = make_error_condition(__e); return *this;} _LIBCPP_ALWAYS_INLINE @@ -456,7 +451,7 @@ public: string message() const; _LIBCPP_ALWAYS_INLINE - //explicit + _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return __val_ != 0;} }; @@ -472,7 +467,7 @@ bool operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT { return __x.category() < __y.category() - || __x.category() == __y.category() && __x.value() < __y.value(); + || (__x.category() == __y.category() && __x.value() < __y.value()); } // error_code @@ -489,10 +484,10 @@ public: error_code(int __val, const error_category& __cat) _NOEXCEPT : __val_(__val), __cat_(&__cat) {} - template + template _LIBCPP_ALWAYS_INLINE - error_code(_E __e, - typename enable_if::value>::type* = 0 + error_code(_Ep __e, + typename enable_if::value>::type* = 0 ) _NOEXCEPT {*this = make_error_code(__e);} @@ -503,14 +498,14 @@ public: __cat_ = &__cat; } - template + template _LIBCPP_ALWAYS_INLINE typename enable_if < - is_error_code_enum<_E>::value, + is_error_code_enum<_Ep>::value, error_code& >::type - operator=(_E __e) _NOEXCEPT + operator=(_Ep __e) _NOEXCEPT {*this = make_error_code(__e); return *this;} _LIBCPP_ALWAYS_INLINE @@ -533,7 +528,7 @@ public: string message() const; _LIBCPP_ALWAYS_INLINE - //explicit + _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return __val_ != 0;} }; @@ -549,7 +544,7 @@ bool operator<(const error_code& __x, const error_code& __y) _NOEXCEPT { return __x.category() < __y.category() - || __x.category() == __y.category() && __x.value() < __y.value(); + || (__x.category() == __y.category() && __x.value() < __y.value()); } inline _LIBCPP_INLINE_VISIBILITY diff --git a/system/include/libcxx/tgmath.h b/system/include/libcxx/tgmath.h index 2388b6ee1d214..fbe1e8248d7a6 100644 --- a/system/include/libcxx/tgmath.h +++ b/system/include/libcxx/tgmath.h @@ -22,6 +22,8 @@ #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif #endif // _LIBCPP_TGMATH_H diff --git a/system/include/libcxx/thread b/system/include/libcxx/thread index ce3ca49ef13b7..60d8885951d38 100644 --- a/system/include/libcxx/thread +++ b/system/include/libcxx/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); @@ -100,7 +100,9 @@ void sleep_for(const chrono::duration& rel_time); #endif #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif #define __STDCPP_THREADS__ __cplusplus @@ -135,52 +137,55 @@ template void __thread_specific_ptr<_Tp>::__at_thread_exit(void* __p) { - delete static_cast(__p); + delete static_cast(__p); } template __thread_specific_ptr<_Tp>::__thread_specific_ptr() { int __ec = pthread_key_create(&__key_, &__thread_specific_ptr::__at_thread_exit); - if (__ec) - throw system_error(error_code(__ec, system_category()), - "__thread_specific_ptr construction failed"); + if (__ec) + throw system_error(error_code(__ec, system_category()), + "__thread_specific_ptr construction failed"); } template __thread_specific_ptr<_Tp>::~__thread_specific_ptr() { - pthread_key_delete(__key_); + pthread_key_delete(__key_); } template typename __thread_specific_ptr<_Tp>::pointer __thread_specific_ptr<_Tp>::release() { - pointer __p = get(); - pthread_setspecific(__key_, 0); - return __p; + pointer __p = get(); + pthread_setspecific(__key_, 0); + return __p; } template void __thread_specific_ptr<_Tp>::reset(pointer __p) { - pointer __p_old = get(); - pthread_setspecific(__key_, __p); - delete __p_old; + pointer __p_old = get(); + pthread_setspecific(__key_, __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 +class _LIBCPP_VISIBLE __thread_id; +template<> struct _LIBCPP_VISIBLE hash<__thread_id>; + class _LIBCPP_VISIBLE __thread_id { // FIXME: pthread_t is a pointer on Darwin but a long on Linux. @@ -190,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 @@ -222,12 +227,11 @@ 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>; }; -template struct hash; - template<> struct _LIBCPP_VISIBLE hash<__thread_id> : public unary_function<__thread_id, size_t> @@ -235,8 +239,7 @@ struct _LIBCPP_VISIBLE hash<__thread_id> _LIBCPP_INLINE_VISIBILITY size_t operator()(__thread_id __v) const { - const size_t* const __p = reinterpret_cast(&__v); - return *__p; + return hash()(__v.__id_); } }; @@ -245,7 +248,7 @@ namespace this_thread inline _LIBCPP_INLINE_VISIBILITY __thread_id -get_id() +get_id() _NOEXCEPT { return pthread_self(); } @@ -263,39 +266,39 @@ public: typedef pthread_t native_handle_type; _LIBCPP_INLINE_VISIBILITY - thread() : __t_(0) {} + thread() _NOEXCEPT : __t_(0) {} #ifndef _LIBCPP_HAS_NO_VARIADICS - template ::type, thread>::value + !is_same::type, thread>::value >::type > - explicit thread(_F&& __f, _Args&&... __args); + explicit thread(_Fp&& __f, _Args&&... __args); #else // _LIBCPP_HAS_NO_VARIADICS - template explicit thread(_F __f); + template explicit thread(_Fp __f); #endif ~thread(); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - thread(thread&& __t) : __t_(__t.__t_) {__t.__t_ = 0;} - thread& operator=(thread&& __t); + thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = 0;} + thread& operator=(thread&& __t) _NOEXCEPT; #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - void swap(thread& __t) {_VSTD::swap(__t_, __t.__t_);} + void swap(thread& __t) _NOEXCEPT {_VSTD::swap(__t_, __t.__t_);} _LIBCPP_INLINE_VISIBILITY - bool joinable() const {return __t_ != 0;} + bool joinable() const _NOEXCEPT {return __t_ != 0;} void join(); void detach(); _LIBCPP_INLINE_VISIBILITY - id get_id() const {return __t_;} + id get_id() const _NOEXCEPT {return __t_;} _LIBCPP_INLINE_VISIBILITY - native_handle_type native_handle() {return __t_;} + native_handle_type native_handle() _NOEXCEPT {return __t_;} - static unsigned hardware_concurrency(); + static unsigned hardware_concurrency() _NOEXCEPT; }; class __assoc_sub_state; @@ -320,34 +323,34 @@ __thread_specific_ptr<__thread_struct>& __thread_local_data(); #ifndef _LIBCPP_HAS_NO_VARIADICS -template +template inline _LIBCPP_INLINE_VISIBILITY void -__threaad_execute(tuple<_F, _Args...>& __t, __tuple_indices<_Indices...>) +__threaad_execute(tuple<_Fp, _Args...>& __t, __tuple_indices<_Indices...>) { __invoke(_VSTD::move(_VSTD::get<0>(__t)), _VSTD::move(_VSTD::get<_Indices>(__t))...); } -template +template void* __thread_proxy(void* __vp) { __thread_local_data().reset(new __thread_struct); - std::unique_ptr<_F> __p(static_cast<_F*>(__vp)); - typedef typename __make_tuple_indices::value, 1>::type _Index; + std::unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp)); + typedef typename __make_tuple_indices::value, 1>::type _Index; __threaad_execute(*__p, _Index()); return nullptr; } -template -thread::thread(_F&& __f, _Args&&... __args) +thread::thread(_Fp&& __f, _Args&&... __args) { - typedef tuple::type, typename decay<_Args>::type...> _G; - _VSTD::unique_ptr<_G> __p(new _G(__decay_copy(_VSTD::forward<_F>(__f)), + typedef tuple::type, typename decay<_Args>::type...> _Gp; + _VSTD::unique_ptr<_Gp> __p(new _Gp(__decay_copy(_VSTD::forward<_Fp>(__f)), __decay_copy(_VSTD::forward<_Args>(__args))...)); - int __ec = pthread_create(&__t_, 0, &__thread_proxy<_G>, __p.get()); + int __ec = pthread_create(&__t_, 0, &__thread_proxy<_Gp>, __p.get()); if (__ec == 0) __p.release(); else @@ -356,21 +359,21 @@ thread::thread(_F&& __f, _Args&&... __args) #else // _LIBCPP_HAS_NO_VARIADICS -template +template void* __thread_proxy(void* __vp) { __thread_local_data().reset(new __thread_struct); - std::unique_ptr<_F> __p(static_cast<_F*>(__vp)); + std::unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp)); (*__p)(); return nullptr; } -template -thread::thread(_F __f) +template +thread::thread(_Fp __f) { - std::unique_ptr<_F> __p(new _F(__f)); - int __ec = pthread_create(&__t_, 0, &__thread_proxy<_F>, __p.get()); + std::unique_ptr<_Fp> __p(new _Fp(__f)); + int __ec = pthread_create(&__t_, 0, &__thread_proxy<_Fp>, __p.get()); if (__ec == 0) __p.release(); else @@ -383,7 +386,7 @@ thread::thread(_F __f) inline _LIBCPP_INLINE_VISIBILITY thread& -thread::operator=(thread&& __t) +thread::operator=(thread&& __t) _NOEXCEPT { if (__t_ != 0) terminate(); @@ -395,7 +398,7 @@ thread::operator=(thread&& __t) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY -void swap(thread& __x, thread& __y) {__x.swap(__y);} +void swap(thread& __x, thread& __y) _NOEXCEPT {__x.swap(__y);} namespace this_thread { @@ -407,10 +410,20 @@ void sleep_for(const chrono::duration<_Rep, _Period>& __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 @@ -435,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/system/include/libcxx/tuple b/system/include/libcxx/tuple index 66a0c9146c354..3fa6730cc6050 100644 --- a/system/include/libcxx/tuple +++ b/system/include/libcxx/tuple @@ -116,13 +116,78 @@ template #include <__config> #include <__tuple> #include -#include #include +#include <__functional_base> +#include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD +// allocator_arg_t + +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 + +template +struct __has_allocator_type +{ +private: + struct __two {char __lx; char __lxx;}; + template static __two __test(...); + template static char __test(typename _Up::allocator_type* = 0); +public: + static const bool value = sizeof(__test<_Tp>(0)) == 1; +}; + +template ::value> +struct __uses_allocator + : public integral_constant::value> +{ +}; + +template +struct __uses_allocator<_Tp, _Alloc, false> + : public false_type +{ +}; + +template +struct _LIBCPP_VISIBLE uses_allocator + : public __uses_allocator<_Tp, _Alloc> +{ +}; + +#ifndef _LIBCPP_HAS_NO_VARIADICS + +// uses-allocator construction + +template +struct __uses_alloc_ctor_imp +{ + static const bool __ua = uses_allocator<_Tp, _Alloc>::value; + static const bool __ic = + is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value; + static const int value = __ua ? 2 - __ic : 0; +}; + +template +struct __uses_alloc_ctor + : integral_constant::value> + {}; + +#endif // _LIBCPP_HAS_NO_VARIADICS + #ifndef _LIBCPP_HAS_NO_VARIADICS // tuple_size @@ -144,7 +209,11 @@ public: // __tuple_leaf -template ::value> +template ::value +#if __has_feature(is_final) + && !__is_final(_Hp) +#endif + > class __tuple_leaf; template @@ -162,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");} @@ -190,16 +260,16 @@ 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 && + (is_lvalue_reference<_Hp>::value && (is_lvalue_reference<_Tp>::value || is_same::type, reference_wrapper< typename remove_reference<_Hp>::type > - >::value) || + >::value)) || (is_rvalue_reference<_Hp>::value && !is_lvalue_reference<_Tp>::value), "Attempted to construct a reference element in a tuple with an rvalue");} @@ -209,13 +279,13 @@ public: explicit __tuple_leaf(integral_constant, const _Alloc&, _Tp&& __t) : value(_VSTD::forward<_Tp>(__t)) {static_assert(!is_lvalue_reference<_Hp>::value || - is_lvalue_reference<_Hp>::value && + (is_lvalue_reference<_Hp>::value && (is_lvalue_reference<_Tp>::value || is_same::type, reference_wrapper< typename remove_reference<_Hp>::type > - >::value), + >::value)), "Attempted to construct a reference element in a tuple with an rvalue");} template @@ -223,13 +293,13 @@ public: explicit __tuple_leaf(integral_constant, const _Alloc& __a, _Tp&& __t) : value(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) {static_assert(!is_lvalue_reference<_Hp>::value || - is_lvalue_reference<_Hp>::value && + (is_lvalue_reference<_Hp>::value && (is_lvalue_reference<_Tp>::value || is_same::type, reference_wrapper< typename remove_reference<_Hp>::type > - >::value), + >::value)), "Attempted to construct a reference element in a tuple with an rvalue");} template @@ -237,28 +307,29 @@ public: explicit __tuple_leaf(integral_constant, const _Alloc& __a, _Tp&& __t) : value(_VSTD::forward<_Tp>(__t), __a) {static_assert(!is_lvalue_reference<_Hp>::value || - is_lvalue_reference<_Hp>::value && + (is_lvalue_reference<_Hp>::value && (is_lvalue_reference<_Tp>::value || is_same::type, reference_wrapper< typename remove_reference<_Hp>::type > - >::value), + >::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; @@ -271,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 @@ -282,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 @@ -301,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 @@ -322,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; @@ -341,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; @@ -357,10 +430,10 @@ struct __all<> static const bool value = true; }; -template -struct __all<_B0, _B...> +template +struct __all<_B0, _Bp...> { - static const bool value = _B0 && __all<_B...>::value; + static const bool value = _B0 && __all<_Bp...>::value; }; // __tuple_impl @@ -371,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>()... {} @@ -402,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)))... {} @@ -428,13 +508,22 @@ 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)))...); return *this; } + _LIBCPP_INLINE_VISIBILITY + __tuple_impl& + operator=(const __tuple_impl& __t) _NOEXCEPT_((__all::value...>::value)) + { + __swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast&>(__t).get())...); + return *this; + } + _LIBCPP_INLINE_VISIBILITY void swap(__tuple_impl& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) @@ -451,15 +540,19 @@ class _LIBCPP_VISIBLE tuple base base_; template friend - typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&); + typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT; template friend - const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&); + const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT; template friend - typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&); + typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT; 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(), @@ -479,7 +572,7 @@ public: ) {} template ::type - >::value - >::type + >::value, + bool + >::type = false + > + _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(), + typename __make_tuple_types::type(), + _VSTD::forward<_Up>(__u)...) {} + + template , + typename __make_tuple_types::type + >::value && + !__tuple_convertible + < + tuple<_Up...>, + typename __make_tuple_types::type + >::value, + bool + >::type =false > _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(), @@ -525,13 +668,27 @@ public: _VSTD::forward<_Up>(__u)...) {} template ::value - >::type + __tuple_convertible<_Tuple, tuple>::value, + bool + >::type = false > _LIBCPP_INLINE_VISIBILITY - tuple(_Tuple&& __t) + tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible::value)) + : base_(_VSTD::forward<_Tuple>(__t)) {} + + template ::value && + !__tuple_convertible<_Tuple, tuple>::value, + bool + >::type = false + > + _LIBCPP_INLINE_VISIBILITY + explicit + 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; @@ -568,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&) {} - template + tuple(allocator_arg_t, const _Alloc&, const tuple&) _NOEXCEPT {} + template _LIBCPP_INLINE_VISIBILITY - tuple(array<_U, 0>) {} - template + tuple(array<_Up, 0>) _NOEXCEPT {} + template _LIBCPP_INLINE_VISIBILITY - tuple(allocator_arg_t, const _Alloc&, array<_U, 0>) {} + tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void swap(tuple&) _NOEXCEPT {} }; @@ -601,7 +758,7 @@ swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u) template inline _LIBCPP_INLINE_VISIBILITY typename tuple_element<_Ip, tuple<_Tp...> >::type& -get(tuple<_Tp...>& __t) +get(tuple<_Tp...>& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast<__tuple_leaf<_Ip, type>&>(__t.base_).get(); @@ -610,7 +767,7 @@ get(tuple<_Tp...>& __t) template inline _LIBCPP_INLINE_VISIBILITY const typename tuple_element<_Ip, tuple<_Tp...> >::type& -get(const tuple<_Tp...>& __t) +get(const tuple<_Tp...>& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast&>(__t.base_).get(); @@ -619,7 +776,7 @@ get(const tuple<_Tp...>& __t) template inline _LIBCPP_INLINE_VISIBILITY typename tuple_element<_Ip, tuple<_Tp...> >::type&& -get(tuple<_Tp...>&& __t) +get(tuple<_Tp...>&& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast( @@ -631,7 +788,7 @@ get(tuple<_Tp...>&& __t) template inline _LIBCPP_INLINE_VISIBILITY tuple<_Tp&...> -tie(_Tp&... __t) +tie(_Tp&... __t) _NOEXCEPT { return tuple<_Tp&...>(__t...); } @@ -639,11 +796,6 @@ tie(_Tp&... __t) template struct __ignore_t { - _LIBCPP_INLINE_VISIBILITY - __ignore_t() {} - template - _LIBCPP_INLINE_VISIBILITY - __ignore_t(_Tp&&) {} template _LIBCPP_INLINE_VISIBILITY const __ignore_t& operator=(_Tp&&) const {return *this;} @@ -651,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 @@ -682,19 +834,19 @@ 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)...); } -template +template struct __tuple_equal { template _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Up& __y) { - return __tuple_equal<_I - 1>()(__x, __y) && get<_I-1>(__x) == get<_I-1>(__y); + return __tuple_equal<_Ip - 1>()(__x, __y) && get<_Ip-1>(__x) == get<_Ip-1>(__y); } }; @@ -725,15 +877,15 @@ operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) return !(__x == __y); } -template +template struct __tuple_less { template _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Up& __y) { - return __tuple_less<_I-1>()(__x, __y) || - (!__tuple_less<_I-1>()(__y, __x) && get<_I-1>(__x) < get<_I-1>(__y)); + return __tuple_less<_Ip-1>()(__x, __y) || + (!__tuple_less<_Ip-1>()(__y, __x) && get<_Ip-1>(__x) < get<_Ip-1>(__y)); } }; @@ -838,7 +990,7 @@ tuple_cat() return tuple<>(); } -template +template struct __tuple_cat_return_ref_imp; template diff --git a/system/include/libcxx/type_traits b/system/include/libcxx/type_traits index c6a20e245035d..8f1c6024c71d1 100644 --- a/system/include/libcxx/type_traits +++ b/system/include/libcxx/type_traits @@ -142,11 +142,13 @@ namespace std #include <__config> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD -template +template struct _LIBCPP_VISIBLE conditional {typedef _If type;}; template struct _LIBCPP_VISIBLE conditional {typedef _Then type;}; @@ -154,29 +156,22 @@ template template struct _LIBCPP_VISIBLE enable_if {}; template struct _LIBCPP_VISIBLE enable_if {typedef _Tp type;}; -struct __two {char _[2];}; +struct __two {char __lx[2];}; // helper class: template struct _LIBCPP_VISIBLE integral_constant { - static constexpr _Tp value = __v; + static _LIBCPP_CONSTEXPR const _Tp value = __v; typedef _Tp value_type; typedef integral_constant type; _LIBCPP_INLINE_VISIBILITY -#ifndef _LIBCPP_HAS_NO_CONSTEXPR - constexpr -#endif - operator value_type() -#ifdef _LIBCPP_HAS_NO_CONSTEXPR - const -#endif - {return value;} + _LIBCPP_CONSTEXPR operator value_type() const {return value;} }; template -constexpr _Tp integral_constant<_Tp, __v>::value; +_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value; typedef integral_constant true_type; typedef integral_constant false_type; @@ -612,22 +607,54 @@ 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) + +namespace __is_base_of_imp +{ +template +struct _Dst +{ + _Dst(const volatile _Tp &); +}; +template +struct _Src +{ + operator const volatile _Tp &(); + template operator const _Dst<_Up> &(); +}; +template struct __one { typedef char type; }; +template typename __one(declval<_Src<_Dp> >()))>::type __test(int); +template __two __test(...); +} + +template +struct _LIBCPP_VISIBLE is_base_of + : public integral_constant::value && + sizeof(__is_base_of_imp::__test<_Bp, _Dp>(0)) == 2> {}; + +#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(); @@ -662,7 +689,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 > {}; @@ -692,6 +729,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 {}; @@ -723,32 +761,26 @@ 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) +// is_empty -#error is_base_of not implemented. +#if __has_feature(is_empty) -#endif // __has_feature(is_base_of) +template +struct _LIBCPP_VISIBLE is_empty + : public integral_constant {}; -// is_empty +#else // __has_feature(is_empty) template struct __is_empty1 : public _Tp { - double _; + double __lx; }; struct __is_empty2 { - double _; + double __lx; }; template ::value> @@ -758,8 +790,18 @@ template struct __libcpp_empty<_Tp, false> : public false_type {}; template struct _LIBCPP_VISIBLE is_empty : public __libcpp_empty<_Tp> {}; +#endif // __has_feature(is_empty) + // is_polymorphic +#if __has_feature(is_polymorphic) + +template +struct _LIBCPP_VISIBLE is_polymorphic + : public integral_constant {}; + +#else + template struct __is_polymorphic1 : public _Tp {}; template struct __is_polymorphic2 : public _Tp {virtual ~__is_polymorphic2() throw();}; @@ -772,6 +814,8 @@ template struct __libcpp_polymorphic<_Tp, false> : public false_type template struct _LIBCPP_VISIBLE is_polymorphic : public __libcpp_polymorphic<_Tp> {}; +#endif // __has_feature(is_polymorphic) + // has_virtual_destructor #if __has_feature(has_virtual_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) @@ -788,7 +832,7 @@ template struct _LIBCPP_VISIBLE has_virtual_destructor // alignment_of -template struct __alignment_of {_Tp _;}; +template struct __alignment_of {_Tp __lx;}; template struct _LIBCPP_VISIBLE alignment_of : public integral_constant::type>)> {}; @@ -819,8 +863,8 @@ struct __align_type typedef _Tp type; }; -struct __struct_double {long double _;}; -struct __struct_double4 {double _[4];}; +struct __struct_double {long double __lx;}; +struct __struct_double4 {double __lx[4];}; typedef __type_list<__align_type, @@ -891,12 +935,12 @@ struct _LIBCPP_VISIBLE aligned_storage #define _CREATE_ALIGNED_STORAGE_SPECIALIZATION(n) \ template \ -struct __attribute__ ((__visibility__("default"))) aligned_storage<_Len, n>\ +struct _LIBCPP_VISIBLE aligned_storage<_Len, n>\ {\ - struct type\ + struct _ALIGNAS(n) type\ {\ - unsigned char _[_Len];\ - } __attribute__((__aligned__(n)));\ + unsigned char __lx[_Len];\ + };\ } _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1); @@ -913,7 +957,10 @@ _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x400); _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x800); _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000); _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000); +// MSDN says that MSVC does not support alignment beyond 8192 (=0x2000) +#if !defined(_MSC_VER) _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000); +#endif // !_MSC_VER #undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION @@ -933,7 +980,7 @@ private: typedef typename __promote<_A2>::type __type2; typedef typename __promote<_A3>::type __type3; public: - typedef __typeof__(__type1() + __type2() + __type3()) type; + typedef decltype(__type1() + __type2() + __type3()) type; }; template @@ -943,7 +990,7 @@ private: typedef typename __promote<_A1>::type __type1; typedef typename __promote<_A2>::type __type2; public: - typedef __typeof__(__type1() + __type2()) type; + typedef decltype(__type1() + __type2()) type; }; template @@ -1129,7 +1176,7 @@ private: static _Up __u(); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES public: - typedef decltype(true ? __t() : __u()) type; + typedef typename remove_reference::type type; }; #else // _LIBCPP_HAS_NO_VARIADICS @@ -1150,7 +1197,7 @@ private: static _Up&& __u(); static bool __f(); public: - typedef decltype(__f() ? __t() : __u()) type; + typedef typename remove_reference::type type; }; template @@ -1272,32 +1319,16 @@ inline _LIBCPP_INLINE_VISIBILITY _Tp&& forward(typename std::remove_reference<_Tp>::type&& __t) _NOEXCEPT { - static_assert(!std::is_lvalue_reference<_Tp>::value, - "Can not forward an rvalue as an lvalue."); - return static_cast<_Tp&&>(__t); + static_assert(!std::is_lvalue_reference<_Tp>::value, + "Can not forward an rvalue as an lvalue."); + return static_cast<_Tp&&>(__t); } #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES -template -class __rv -{ - typedef typename remove_reference<_Tp>::type _Trr; - _Trr& t_; -public: - _LIBCPP_INLINE_VISIBILITY - _Trr* operator->() {return &t_;} - _LIBCPP_INLINE_VISIBILITY - explicit __rv(_Trr& __t) : t_(__t) {} -}; - template inline _LIBCPP_INLINE_VISIBILITY -typename enable_if -< - !is_convertible<_Tp, __rv<_Tp> >::value, - _Tp& ->::type +_Tp& move(_Tp& __t) { return __t; @@ -1305,63 +1336,32 @@ move(_Tp& __t) template inline _LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_convertible<_Tp, __rv<_Tp> >::value, - _Tp ->::type -move(_Tp& __t) -{ - return _Tp(__rv<_Tp>(__t)); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -typename enable_if -< - !is_convertible<_Tp, __rv<_Tp> >::value, - typename add_lvalue_reference<_Tp>::type ->::type -forward(_Up& __t) +const _Tp& +move(const _Tp& __t) { return __t; } -template +template inline _LIBCPP_INLINE_VISIBILITY -typename enable_if -< - !is_convertible<_Tp, __rv<_Tp> >::value, - typename add_lvalue_reference<_Tp>::type ->::type -forward(const _Up& __t) +_Tp& +forward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT { return __t; } -template -inline _LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_convertible<_Tp, __rv<_Tp> >::value, - _Tp ->::type -forward(_Up& __t) -{ - return _Tp(__rv<_Tp>(__t)); -} -template -inline _LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_convertible<_Tp, __rv<_Tp> >::value, - _Tp ->::type -forward(const _Up& __t) +template +class __rv { - return _Tp(__rv<_Tp>(__t)); -} + typedef typename remove_reference<_Tp>::type _Trr; + _Trr& t_; +public: + _LIBCPP_INLINE_VISIBILITY + _Trr* operator->() {return &t_;} + _LIBCPP_INLINE_VISIBILITY + explicit __rv(_Trr& __t) : t_(__t) {} +}; #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -1413,215 +1413,215 @@ struct __member_pointer_traits_imp #ifndef _LIBCPP_HAS_NO_VARIADICS -template -struct __member_pointer_traits_imp<_R (_Class::*)(_Param...), true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false> { typedef _Class _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) const, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false> { typedef _Class const _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) volatile, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false> { typedef _Class volatile _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) const volatile, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false> { typedef _Class const volatile _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; #if __has_feature(cxx_reference_qualified_functions) -template -struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) &, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false> { typedef _Class& _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) const&, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false> { typedef _Class const& _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) volatile&, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false> { typedef _Class volatile& _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) const volatile&, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false> { typedef _Class const volatile& _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) &&, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false> { typedef _Class&& _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) const&&, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false> { typedef _Class const&& _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) volatile&&, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false> { typedef _Class volatile&& _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) const volatile&&, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false> { typedef _Class const volatile&& _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; #endif // __has_feature(cxx_reference_qualified_functions) #else // _LIBCPP_HAS_NO_VARIADICS -template -struct __member_pointer_traits_imp<_R (_Class::*)(), true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false> { typedef _Class _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_P0), true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false> { typedef _Class _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1), true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false> { typedef _Class _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1, _P2), true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false> { typedef _Class _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)() const, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false> { typedef _Class const _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_P0) const, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false> { typedef _Class const _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1) const, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false> { typedef _Class const _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1, _P2) const, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false> { typedef _Class const _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)() volatile, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false> { typedef _Class volatile _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_P0) volatile, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false> { typedef _Class volatile _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1) volatile, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false> { typedef _Class volatile _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1, _P2) volatile, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false> { typedef _Class volatile _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)() const volatile, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false> { typedef _Class const volatile _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_P0) const volatile, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false> { typedef _Class const volatile _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1) const volatile, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false> { typedef _Class const volatile _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; -template -struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1, _P2) const volatile, true, false> +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false> { typedef _Class const volatile _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; #endif // _LIBCPP_HAS_NO_VARIADICS -template -struct __member_pointer_traits_imp<_R _Class::*, false, true> +template +struct __member_pointer_traits_imp<_Rp _Class::*, false, true> { typedef _Class _ClassType; - typedef _R _ReturnType; + typedef _Rp _ReturnType; }; template @@ -1638,77 +1638,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<_R _Class::*, _Tp, false> -{ - typedef typename __apply_cv()), _R>::type&& type; -}; - -template -struct __result_of_mdp<_R _Class::*, _Tp, true> -{ - typedef typename __apply_cv<_Tp, _R>::type&& type; -}; - -template -struct __result_of_mp<_R _Class::*, _Tp, false> - : public __result_of_mdp<_R _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> { @@ -1753,21 +1689,21 @@ struct __result_of_mp<_MP, _Tp, true> template struct __result_of_mdp; -template -struct __result_of_mdp<_R _Class::*, _Tp, false> +template +struct __result_of_mdp<_Rp _Class::*, _Tp, false> { - typedef typename __apply_cv()), _R>::type& type; + typedef typename __apply_cv()), _Rp>::type& type; }; -template -struct __result_of_mdp<_R _Class::*, _Tp, true> +template +struct __result_of_mdp<_Rp _Class::*, _Tp, true> { - typedef typename __apply_cv<_Tp, _R>::type& type; + typedef typename __apply_cv<_Tp, _Rp>::type& type; }; -template -struct __result_of_mp<_R _Class::*, _Tp, false> - : public __result_of_mdp<_R _Class::*, _Tp, +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> { }; @@ -1856,8 +1792,10 @@ class _LIBCPP_VISIBLE result_of<_Fn(_A0, _A1, _A2)> // main is_constructible test +template struct __select_2nd { typedef T type; }; + template -decltype(_VSTD::move(_Tp(_VSTD::declval<_Args>()...)), true_type()) +typename __select_2nd()...))), true_type>::type __is_constructible_test(_Tp&&, _Args&& ...); template @@ -1874,8 +1812,8 @@ struct __is_constructible // false, _Tp is not a scalar // function types are not constructible -template -struct __is_constructible +template +struct __is_constructible : public false_type {}; @@ -1894,15 +1832,15 @@ struct __is_constructible template struct __is_constructible_ref { - true_type static __(_Tp); - false_type static __(...); + true_type static __lxx(_Tp); + false_type static __lxx(...); }; template struct __is_constructible : public common_type < - decltype(__is_constructible_ref<_Tp>::__(declval<_A0>())) + decltype(__is_constructible_ref<_Tp>::__lxx(declval<_A0>())) >::type {}; @@ -1951,22 +1889,22 @@ struct _LIBCPP_VISIBLE is_constructible // Array types are default constructible if their element type // is default constructible -template -struct __is_constructible - : public is_constructible::type> +template +struct __is_constructible + : public is_constructible::type> {}; // Otherwise array types are not constructible by this syntax -template -struct __is_constructible +template +struct __is_constructible : public false_type {}; // Incomplete array types are not constructible -template -struct __is_constructible +template +struct __is_constructible : public false_type {}; @@ -2119,35 +2057,35 @@ struct _LIBCPP_VISIBLE is_constructible<_Tp, _A0, __is_construct::__nat> // Array types are default constructible if their element type // is default constructible -template -struct __is_constructible0_imp - : public is_constructible::type> +template +struct __is_constructible0_imp + : public is_constructible::type> {}; -template -struct __is_constructible1_imp +template +struct __is_constructible1_imp : public false_type {}; -template -struct __is_constructible2_imp +template +struct __is_constructible2_imp : public false_type {}; // Incomplete array types are not constructible -template -struct __is_constructible0_imp +template +struct __is_constructible0_imp : public false_type {}; -template -struct __is_constructible1_imp +template +struct __is_constructible1_imp : public false_type {}; -template -struct __is_constructible2_imp +template +struct __is_constructible2_imp : public false_type {}; @@ -2182,6 +2120,16 @@ struct _LIBCPP_VISIBLE is_move_constructible #ifndef _LIBCPP_HAS_NO_VARIADICS +#if __has_feature(is_trivially_constructible) + +template +struct _LIBCPP_VISIBLE is_trivially_constructible + : integral_constant +{ +}; + +#else // !__has_feature(is_trivially_constructible) + template struct _LIBCPP_VISIBLE is_trivially_constructible : false_type @@ -2204,34 +2152,24 @@ struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&&> #else struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp> #endif -#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) - : integral_constant -#else : integral_constant::value> -#endif { }; template struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&> -#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) - : integral_constant -#else : integral_constant::value> -#endif { }; template struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&> -#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) - : integral_constant -#else : integral_constant::value> -#endif { }; +#endif // !__has_feature(is_trivially_constructible) + #else // _LIBCPP_HAS_NO_VARIADICS template +struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat, + __is_construct::__nat> + : integral_constant +{ +}; + +template +struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp, + __is_construct::__nat> + : integral_constant +{ +}; + +template +struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&, + __is_construct::__nat> + : integral_constant +{ +}; + +template +struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&, + __is_construct::__nat> + : integral_constant +{ +}; + +#else // !__has_feature(is_trivially_constructible) + template struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat, __is_construct::__nat> -#if __has_feature(has_trivial_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) - : integral_constant -#else : integral_constant::value> -#endif { }; template struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp, __is_construct::__nat> -#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) - : integral_constant -#else : integral_constant::value> -#endif { }; template struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&, __is_construct::__nat> -#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) - : integral_constant -#else : integral_constant::value> -#endif { }; template struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&, __is_construct::__nat> -#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) - : integral_constant -#else : integral_constant::value> -#endif { }; +#endif // !__has_feature(is_trivially_constructible) + #endif // _LIBCPP_HAS_NO_VARIADICS // is_trivially_default_constructible @@ -2311,46 +2267,42 @@ template struct _LIBCPP_VISIBLE is_trivially_move_constructible // is_trivially_assignable +#if __has_feature(is_trivially_constructible) + +template +struct is_trivially_assignable + : integral_constant +{ +}; + +#else // !__has_feature(is_trivially_constructible) + template struct is_trivially_assignable : public false_type {}; template struct is_trivially_assignable<_Tp&, _Tp> -#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) - : integral_constant {}; -#else : integral_constant::value> {}; -#endif template struct is_trivially_assignable<_Tp&, _Tp&> -#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) - : integral_constant {}; -#else : integral_constant::value> {}; -#endif template struct is_trivially_assignable<_Tp&, const _Tp&> -#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) - : integral_constant {}; -#else : integral_constant::value> {}; -#endif #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct is_trivially_assignable<_Tp&, _Tp&&> -#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) - : integral_constant {}; -#else : integral_constant::value> {}; -#endif #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // !__has_feature(is_trivially_constructible) + // is_trivially_copy_assignable template struct _LIBCPP_VISIBLE is_trivially_copy_assignable @@ -2756,134 +2708,134 @@ template struct _LIBCPP_VISIBLE is_trivial // Check for complete types -template struct __check_complete; +template struct __check_complete; template <> struct __check_complete<> { }; -template -struct __check_complete<_H, _T0, _T...> - : private __check_complete<_H>, - private __check_complete<_T0, _T...> +template +struct __check_complete<_Hp, _T0, _Tp...> + : private __check_complete<_Hp>, + private __check_complete<_T0, _Tp...> { }; -template -struct __check_complete<_H, _H> - : private __check_complete<_H> +template +struct __check_complete<_Hp, _Hp> + : private __check_complete<_Hp> { }; -template -struct __check_complete<_T> +template +struct __check_complete<_Tp> { - static_assert(sizeof(_T) > 0, "Type must be complete."); + static_assert(sizeof(_Tp) > 0, "Type must be complete."); }; -template -struct __check_complete<_T&> - : private __check_complete<_T> +template +struct __check_complete<_Tp&> + : private __check_complete<_Tp> { }; -template -struct __check_complete<_T&&> - : private __check_complete<_T> +template +struct __check_complete<_Tp&&> + : private __check_complete<_Tp> { }; -template -struct __check_complete<_R (*)(_Param...)> - : private __check_complete<_Param...> +template +struct __check_complete<_Rp (*)(_Param...)> + : private __check_complete<_Rp> { }; -template -struct __check_complete<_R (_Param...)> - : private __check_complete<_Param...> +template +struct __check_complete<_Rp (_Param...)> + : private __check_complete<_Rp> { }; -template -struct __check_complete<_R (_Class::*)(_Param...)> - : private __check_complete<_Class, _Param...> +template +struct __check_complete<_Rp (_Class::*)(_Param...)> + : private __check_complete<_Class> { }; -template -struct __check_complete<_R (_Class::*)(_Param...) const> - : private __check_complete<_Class, _Param...> +template +struct __check_complete<_Rp (_Class::*)(_Param...) const> + : private __check_complete<_Class> { }; -template -struct __check_complete<_R (_Class::*)(_Param...) volatile> - : private __check_complete<_Class, _Param...> +template +struct __check_complete<_Rp (_Class::*)(_Param...) volatile> + : private __check_complete<_Class> { }; -template -struct __check_complete<_R (_Class::*)(_Param...) const volatile> - : private __check_complete<_Class, _Param...> +template +struct __check_complete<_Rp (_Class::*)(_Param...) const volatile> + : private __check_complete<_Class> { }; #if __has_feature(cxx_reference_qualified_functions) -template -struct __check_complete<_R (_Class::*)(_Param...) &> - : private __check_complete<_Class, _Param...> +template +struct __check_complete<_Rp (_Class::*)(_Param...) &> + : private __check_complete<_Class> { }; -template -struct __check_complete<_R (_Class::*)(_Param...) const&> - : private __check_complete<_Class, _Param...> +template +struct __check_complete<_Rp (_Class::*)(_Param...) const&> + : private __check_complete<_Class> { }; -template -struct __check_complete<_R (_Class::*)(_Param...) volatile&> - : private __check_complete<_Class, _Param...> +template +struct __check_complete<_Rp (_Class::*)(_Param...) volatile&> + : private __check_complete<_Class> { }; -template -struct __check_complete<_R (_Class::*)(_Param...) const volatile&> - : private __check_complete<_Class, _Param...> +template +struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&> + : private __check_complete<_Class> { }; -template -struct __check_complete<_R (_Class::*)(_Param...) &&> - : private __check_complete<_Class, _Param...> +template +struct __check_complete<_Rp (_Class::*)(_Param...) &&> + : private __check_complete<_Class> { }; -template -struct __check_complete<_R (_Class::*)(_Param...) const&&> - : private __check_complete<_Class, _Param...> +template +struct __check_complete<_Rp (_Class::*)(_Param...) const&&> + : private __check_complete<_Class> { }; -template -struct __check_complete<_R (_Class::*)(_Param...) volatile&&> - : private __check_complete<_Class, _Param...> +template +struct __check_complete<_Rp (_Class::*)(_Param...) volatile&&> + : private __check_complete<_Class> { }; -template -struct __check_complete<_R (_Class::*)(_Param...) const volatile&&> - : private __check_complete<_Class, _Param...> +template +struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&> + : private __check_complete<_Class> { }; #endif -template -struct __check_complete<_R _Class::*> +template +struct __check_complete<_Rp _Class::*> : private __check_complete<_Class> { }; @@ -2899,70 +2851,81 @@ __invoke(__any, _Args&& ...__args) // bullets 1 and 2 -template +template +_LIBCPP_INLINE_VISIBILITY auto -__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args) +__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...)); -template +template +_LIBCPP_INLINE_VISIBILITY auto -__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args) +__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...)); // bullets 3 and 4 -template +template +_LIBCPP_INLINE_VISIBILITY auto -__invoke(_F&& __f, _A0&& __a0) +__invoke(_Fp&& __f, _A0&& __a0) -> decltype(_VSTD::forward<_A0>(__a0).*__f); -template +template +_LIBCPP_INLINE_VISIBILITY auto -__invoke(_F&& __f, _A0&& __a0) +__invoke(_Fp&& __f, _A0&& __a0) -> decltype((*_VSTD::forward<_A0>(__a0)).*__f); // bullet 5 -template +template +_LIBCPP_INLINE_VISIBILITY auto -__invoke(_F&& __f, _Args&& ...__args) - -> decltype(_VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...)); +__invoke(_Fp&& __f, _Args&& ...__args) + -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)); // __invokable -template +template struct __invokable_imp - : private __check_complete<_F, _Args...> + : private __check_complete<_Fp> { typedef decltype( - __invoke(_VSTD::declval<_F>(), _VSTD::declval<_Args>()...) + __invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...) ) type; static const bool value = !is_same::value; }; -template +template struct __invokable : public integral_constant::value> + __invokable_imp<_Fp, _Args...>::value> { }; // __invoke_of -template +template struct __invoke_of_imp // false { }; -template -struct __invoke_of_imp +template +struct __invoke_of_imp { - typedef typename __invokable_imp<_F, _Args...>::type type; + typedef typename __invokable_imp<_Fp, _Args...>::type type; }; -template +template struct __invoke_of - : public __invoke_of_imp<__invokable<_F, _Args...>::value, _F, _Args...> + : public __invoke_of_imp<__invokable<_Fp, _Args...>::value, _Fp, _Args...> +{ +}; + +template +class _LIBCPP_VISIBLE result_of<_Fp(_Args...)> + : public __invoke_of<_Fp, _Args...> { }; diff --git a/system/include/libcxx/typeindex b/system/include/libcxx/typeindex index 7fb1513c9064a..398b52880e9d1 100644 --- a/system/include/libcxx/typeindex +++ b/system/include/libcxx/typeindex @@ -49,7 +49,9 @@ struct hash #include #include <__functional_base> +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/system/include/libcxx/typeinfo b/system/include/libcxx/typeinfo index 310c482c4c5e3..6ffee0f8a3c61 100644 --- a/system/include/libcxx/typeinfo +++ b/system/include/libcxx/typeinfo @@ -61,7 +61,9 @@ public: #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif namespace std // purposefully not using versioning namespace { diff --git a/system/include/libcxx/unordered_map b/system/include/libcxx/unordered_map index cb30fc87d698d..cb2ab42abef2e 100644 --- a/system/include/libcxx/unordered_map +++ b/system/include/libcxx/unordered_map @@ -319,14 +319,22 @@ template #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD -template ::value> +template ::value +#if __has_feature(is_final) + && !__is_final(_Hash) +#endif + > class __unordered_map_hasher : private _Hash { + typedef pair::type, _Tp> _Pp; + typedef pair _Cp; public: _LIBCPP_INLINE_VISIBILITY __unordered_map_hasher() @@ -339,17 +347,23 @@ public: _LIBCPP_INLINE_VISIBILITY const _Hash& hash_function() const _NOEXCEPT {return *this;} _LIBCPP_INLINE_VISIBILITY - size_t operator()(const _Tp& __x) const + size_t operator()(const _Pp& __x) const + {return static_cast(*this)(__x.first);} + _LIBCPP_INLINE_VISIBILITY + size_t operator()(const _Cp& __x) const {return static_cast(*this)(__x.first);} _LIBCPP_INLINE_VISIBILITY - size_t operator()(const typename _Tp::first_type& __x) const + size_t operator()(const _Key& __x) const {return static_cast(*this)(__x);} }; -template -class __unordered_map_hasher<_Tp, _Hash, false> +template +class __unordered_map_hasher<_Key, _Tp, _Hash, false> { _Hash __hash_; + + typedef pair::type, _Tp> _Pp; + typedef pair _Cp; public: _LIBCPP_INLINE_VISIBILITY __unordered_map_hasher() @@ -362,17 +376,26 @@ public: _LIBCPP_INLINE_VISIBILITY const _Hash& hash_function() const _NOEXCEPT {return __hash_;} _LIBCPP_INLINE_VISIBILITY - size_t operator()(const _Tp& __x) const + size_t operator()(const _Pp& __x) const + {return __hash_(__x.first);} + _LIBCPP_INLINE_VISIBILITY + size_t operator()(const _Cp& __x) const {return __hash_(__x.first);} _LIBCPP_INLINE_VISIBILITY - size_t operator()(const typename _Tp::first_type& __x) const + size_t operator()(const _Key& __x) const {return __hash_(__x);} }; -template ::value> +template ::value +#if __has_feature(is_final) + && !__is_final(_Pred) +#endif + > class __unordered_map_equal : private _Pred { + typedef pair::type, _Tp> _Pp; + typedef pair _Cp; public: _LIBCPP_INLINE_VISIBILITY __unordered_map_equal() @@ -385,24 +408,41 @@ public: _LIBCPP_INLINE_VISIBILITY const _Pred& key_eq() const _NOEXCEPT {return *this;} _LIBCPP_INLINE_VISIBILITY - bool operator()(const _Tp& __x, const _Tp& __y) const + bool operator()(const _Pp& __x, const _Pp& __y) const {return static_cast(*this)(__x.first, __y.first);} _LIBCPP_INLINE_VISIBILITY - bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const - {return static_cast(*this)(__x, __y.first);} + bool operator()(const _Pp& __x, const _Cp& __y) const + {return static_cast(*this)(__x.first, __y.first);} + _LIBCPP_INLINE_VISIBILITY + bool operator()(const _Pp& __x, const _Key& __y) const + {return static_cast(*this)(__x.first, __y);} + _LIBCPP_INLINE_VISIBILITY + bool operator()(const _Cp& __x, const _Pp& __y) const + {return static_cast(*this)(__x.first, __y.first);} + _LIBCPP_INLINE_VISIBILITY + bool operator()(const _Cp& __x, const _Cp& __y) const + {return static_cast(*this)(__x.first, __y.first);} _LIBCPP_INLINE_VISIBILITY - bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const + bool operator()(const _Cp& __x, const _Key& __y) const {return static_cast(*this)(__x.first, __y);} _LIBCPP_INLINE_VISIBILITY - bool operator()(const typename _Tp::first_type& __x, - const typename _Tp::first_type& __y) const + bool operator()(const _Key& __x, const _Pp& __y) const + {return static_cast(*this)(__x, __y.first);} + _LIBCPP_INLINE_VISIBILITY + bool operator()(const _Key& __x, const _Cp& __y) const + {return static_cast(*this)(__x, __y.first);} + _LIBCPP_INLINE_VISIBILITY + bool operator()(const _Key& __x, const _Key& __y) const {return static_cast(*this)(__x, __y);} }; -template -class __unordered_map_equal<_Tp, _Pred, false> +template +class __unordered_map_equal<_Key, _Tp, _Pred, false> { _Pred __pred_; + + typedef pair::type, _Tp> _Pp; + typedef pair _Cp; public: _LIBCPP_INLINE_VISIBILITY __unordered_map_equal() @@ -415,17 +455,31 @@ public: _LIBCPP_INLINE_VISIBILITY const _Pred& key_eq() const _NOEXCEPT {return __pred_;} _LIBCPP_INLINE_VISIBILITY - bool operator()(const _Tp& __x, const _Tp& __y) const + bool operator()(const _Pp& __x, const _Pp& __y) const {return __pred_(__x.first, __y.first);} _LIBCPP_INLINE_VISIBILITY - bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const - {return __pred_(__x, __y.first);} + bool operator()(const _Pp& __x, const _Cp& __y) const + {return __pred_(__x.first, __y.first);} _LIBCPP_INLINE_VISIBILITY - bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const + bool operator()(const _Pp& __x, const _Key& __y) const {return __pred_(__x.first, __y);} _LIBCPP_INLINE_VISIBILITY - bool operator()(const typename _Tp::first_type& __x, - const typename _Tp::first_type& __y) const + bool operator()(const _Cp& __x, const _Pp& __y) const + {return __pred_(__x.first, __y.first);} + _LIBCPP_INLINE_VISIBILITY + bool operator()(const _Cp& __x, const _Cp& __y) const + {return __pred_(__x.first, __y.first);} + _LIBCPP_INLINE_VISIBILITY + bool operator()(const _Cp& __x, const _Key& __y) const + {return __pred_(__x.first, __y);} + _LIBCPP_INLINE_VISIBILITY + bool operator()(const _Key& __x, const _Pp& __y) const + {return __pred_(__x, __y.first);} + _LIBCPP_INLINE_VISIBILITY + bool operator()(const _Key& __x, const _Cp& __y) const + {return __pred_(__x, __y.first);} + _LIBCPP_INLINE_VISIBILITY + bool operator()(const _Key& __x, const _Key& __y) const {return __pred_(__x, __y);} }; @@ -622,8 +676,8 @@ public: private: typedef pair __value_type; - typedef __unordered_map_hasher<__value_type, hasher> __hasher; - typedef __unordered_map_equal<__value_type, key_equal> __key_equal; + typedef __unordered_map_hasher __hasher; + typedef __unordered_map_equal __key_equal; typedef typename allocator_traits::template #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES rebind_alloc<__value_type> @@ -642,8 +696,8 @@ private: typedef typename __table::__node_traits __node_traits; typedef typename __table::__node_allocator __node_allocator; typedef typename __table::__node __node; - typedef __hash_map_node_destructor<__node_allocator> _D; - typedef unique_ptr<__node, _D> __node_holder; + typedef __hash_map_node_destructor<__node_allocator> _Dp; + typedef unique_ptr<__node, _Dp> __node_holder; typedef allocator_traits __alloc_traits; public: typedef typename __alloc_traits::pointer pointer; @@ -732,63 +786,36 @@ 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 pair insert(const value_type& __x) {return __table_.__insert_unique(__x);} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template ::value>::type> + template ::value>::type> _LIBCPP_INLINE_VISIBILITY - pair insert(_P&& __x) - {return __table_.__insert_unique(_VSTD::forward<_P>(__x));} + pair insert(_Pp&& __x) + {return __table_.__insert_unique(_VSTD::forward<_Pp>(__x));} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template ::value>::type> + template ::value>::type> _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator, _P&& __x) - {return insert(_VSTD::forward<_P>(__x)).first;} + iterator insert(const_iterator, _Pp&& __x) + {return insert(_VSTD::forward<_Pp>(__x)).first;} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template void insert(_InputIterator __first, _InputIterator __last); @@ -878,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 @@ -1052,38 +1090,30 @@ 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), _D(__na)); - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), - _VSTD::forward<_A0>(__a0)); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); + __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(); - __node_holder __h(__node_traits::allocate(__na, 1), _D(__na)); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0)); __h.get_deleter().__first_constructed = true; @@ -1091,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(); @@ -1116,7 +1179,7 @@ typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k) { __node_allocator& __na = __table_.__node_alloc(); - __node_holder __h(__node_traits::allocate(__na, 1), _D(__na)); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k); __h.get_deleter().__first_constructed = true; __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second)); @@ -1246,8 +1309,8 @@ public: private: typedef pair __value_type; - typedef __unordered_map_hasher<__value_type, hasher> __hasher; - typedef __unordered_map_equal<__value_type, key_equal> __key_equal; + typedef __unordered_map_hasher __hasher; + typedef __unordered_map_equal __key_equal; typedef typename allocator_traits::template #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES rebind_alloc<__value_type> @@ -1264,8 +1327,8 @@ private: typedef typename __table::__node_traits __node_traits; typedef typename __table::__node_allocator __node_allocator; typedef typename __table::__node __node; - typedef __hash_map_node_destructor<__node_allocator> _D; - typedef unique_ptr<__node, _D> __node_holder; + typedef __hash_map_node_destructor<__node_allocator> _Dp; + typedef unique_ptr<__node, _Dp> __node_holder; typedef allocator_traits __alloc_traits; public: typedef typename __alloc_traits::pointer pointer; @@ -1355,59 +1418,33 @@ 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 iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template ::value>::type> + template ::value>::type> _LIBCPP_INLINE_VISIBILITY - iterator insert(_P&& __x) - {return __table_.__insert_multi(_VSTD::forward<_P>(__x));} + iterator insert(_Pp&& __x) + {return __table_.__insert_multi(_VSTD::forward<_Pp>(__x));} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __p, const value_type& __x) {return __table_.__insert_multi(__p.__i_, __x);} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template ::value>::type> + template ::value>::type> _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, _P&& __x) - {return __table_.__insert_multi(__p.__i_, _VSTD::forward<_P>(__x));} + iterator insert(const_iterator __p, _Pp&& __x) + {return __table_.__insert_multi(__p.__i_, _VSTD::forward<_Pp>(__x));} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template void insert(_InputIterator __first, _InputIterator __last); @@ -1489,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 @@ -1662,38 +1712,30 @@ 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), _D(__na)); - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), - _VSTD::forward<_A0>(__a0)); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); + __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(); - __node_holder __h(__node_traits::allocate(__na, 1), _D(__na)); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0)); __h.get_deleter().__first_constructed = true; @@ -1701,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/system/include/libcxx/unordered_set b/system/include/libcxx/unordered_set index d7615fa05c5f8..279e90723d65a 100644 --- a/system/include/libcxx/unordered_set +++ b/system/include/libcxx/unordered_set @@ -305,7 +305,9 @@ template #include <__hash_table> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/system/include/libcxx/utility b/system/include/libcxx/utility index 358fe765d9dad..514ce17f41fa4 100644 --- a/system/include/libcxx/utility +++ b/system/include/libcxx/utility @@ -125,7 +125,9 @@ template #include <__tuple> #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -178,12 +180,12 @@ swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardItera return __first2; } -template +template inline _LIBCPP_INLINE_VISIBILITY void -swap(_Tp (&__a)[_N], _Tp (&__b)[_N]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) +swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) { - _VSTD::swap_ranges(__a, __a + _N, __b); + _VSTD::swap_ranges(__a, __a + _Np, __b); } template @@ -204,8 +206,11 @@ move_if_noexcept(_Tp& __x) _NOEXCEPT } struct _LIBCPP_VISIBLE piecewise_construct_t { }; -//constexpr +#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_UTILITY) extern const piecewise_construct_t piecewise_construct;// = piecewise_construct_t(); +#else +constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); +#endif template struct _LIBCPP_VISIBLE pair @@ -219,7 +224,7 @@ struct _LIBCPP_VISIBLE pair // pair(const pair&) = default; // pair(pair&&) = default; - _LIBCPP_INLINE_VISIBILITY pair() : first(), second() {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR pair() : first(), second() {} _LIBCPP_INLINE_VISIBILITY pair(const _T1& __x, const _T2& __y) : first(__x), second(__y) {} @@ -228,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) {} @@ -256,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)), @@ -267,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)) {} @@ -304,7 +309,7 @@ struct _LIBCPP_VISIBLE pair - template + template _LIBCPP_INLINE_VISIBILITY pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) @@ -414,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 @@ -455,8 +460,6 @@ make_pair(_T1 __x, _T2 __y) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_VARIADICS - template class _LIBCPP_VISIBLE tuple_size > : public integral_constant {}; @@ -575,8 +578,6 @@ get(pair<_T1, _T2>&& __p) _NOEXCEPT #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#endif // _LIBCPP_HAS_NO_VARIADICS - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_UTILITY diff --git a/system/include/libcxx/valarray b/system/include/libcxx/valarray index 62c1c66c344f6..c56dd125d6a52 100644 --- a/system/include/libcxx/valarray +++ b/system/include/libcxx/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); @@ -346,11 +346,15 @@ template unspecified2 end(const valarray& v); #include #include +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD -template class valarray; +template class _LIBCPP_VISIBLE valarray; class _LIBCPP_VISIBLE slice { @@ -377,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); @@ -491,14 +499,14 @@ struct __bit_shift_right : binary_function<_Tp, _Tp, _Tp> {return __x >> __y;} }; -template +template struct __apply_expr : unary_function<_Tp, _Tp> { private: - _F __f_; + _Fp __f_; public: _LIBCPP_INLINE_VISIBILITY - explicit __apply_expr(_F __f) : __f_(__f) {} + explicit __apply_expr(_Fp __f) : __f_(__f) {} _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const @@ -686,7 +694,7 @@ private: ptrdiff_t __ul_; ptrdiff_t __sn_; ptrdiff_t __n_; - static const ptrdiff_t _N = static_cast( + static const ptrdiff_t _Np = static_cast( sizeof(ptrdiff_t) * __CHAR_BIT__ - 1); _LIBCPP_INLINE_VISIBILITY @@ -695,8 +703,8 @@ private: __size_(__e.size()), __n_(__n) { - ptrdiff_t __neg_n = static_cast(__n_ >> _N); - __sn_ = __neg_n | static_cast(static_cast(-__n_) >> _N); + ptrdiff_t __neg_n = static_cast(__n_ >> _Np); + __sn_ = __neg_n | static_cast(static_cast(-__n_) >> _Np); __ul_ = ((__size_ - __n_) & ~__neg_n) | ((__n_ + 1) & __neg_n); } public: @@ -704,8 +712,8 @@ public: _LIBCPP_INLINE_VISIBILITY result_type operator[](size_t __j) const { - ptrdiff_t __i = static_cast(__j); - ptrdiff_t __m = (__sn_ * __i - __ul_) >> _N; + ptrdiff_t __i = static_cast(__j); + ptrdiff_t __m = (__sn_ * __i - __ul_) >> _Np; return (__expr_[(__i + __n_) & __m] & __m) | (value_type() & ~__m); } @@ -797,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); @@ -811,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); @@ -952,10 +960,10 @@ public: operator>>= (const _Expr& __v); // member functions: - void swap(valarray& __v); + void swap(valarray& __v) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - size_t size() const {return __end_ - __begin_;} + size_t size() const {return static_cast(__end_ - __begin_);} value_type sum() const; value_type min() const; @@ -1893,7 +1901,7 @@ private: _LIBCPP_INLINE_VISIBILITY mask_array(const valarray& __vb, const valarray& __v) : __vp_(const_cast(__v.__begin_)), - __1d_(count(__vb.__begin_, __vb.__end_, true)) + __1d_(static_cast(count(__vb.__begin_, __vb.__end_, true))) { size_t __j = 0; for (size_t __i = 0; __i < __vb.size(); ++__i) @@ -2104,7 +2112,7 @@ private: _LIBCPP_INLINE_VISIBILITY __mask_expr(const valarray& __vb, const _RmExpr& __e) : __expr_(__e), - __1d_(count(__vb.__begin_, __vb.__end_, true)) + __1d_(static_cast(count(__vb.__begin_, __vb.__end_, true))) { size_t __j = 0; for (size_t __i = 0; __i < __vb.size(); ++__i) @@ -2705,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_) { @@ -2882,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_; @@ -3442,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_); @@ -3609,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); } @@ -4762,9 +4770,9 @@ end(const valarray<_Tp>& __v) return __v.__end_; } -extern template valarray::valarray(size_t); -extern template valarray::~valarray(); -extern template void valarray::resize(size_t, size_t); +_LIBCPP_EXTERN_TEMPLATE(valarray::valarray(size_t)) +_LIBCPP_EXTERN_TEMPLATE(valarray::~valarray()) +_LIBCPP_EXTERN_TEMPLATE(void valarray::resize(size_t, size_t)) _LIBCPP_END_NAMESPACE_STD diff --git a/system/include/libcxx/vector b/system/include/libcxx/vector index b334074d0b909..876b7e5676bde 100644 --- a/system/include/libcxx/vector +++ b/system/include/libcxx/vector @@ -270,7 +270,11 @@ void swap(vector& x, vector& y) #include <__split_buffer> #include <__functional_base> +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -305,7 +309,14 @@ __vector_base_common<__b>::__throw_out_of_range() const #endif } -extern template class __vector_base_common; +#ifdef _MSC_VER +#pragma warning( push ) +#pragma warning( disable: 4231 ) +#endif // _MSC_VER +_LIBCPP_EXTERN_TEMPLATE(class __vector_base_common) +#ifdef _MSC_VER +#pragma warning( pop ) +#endif // _MSC_VER template class __vector_base @@ -355,7 +366,7 @@ protected: _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(const_pointer __new_last) _NOEXCEPT - {__destruct_at_end(__new_last, is_trivially_destructible());} + {__destruct_at_end(__new_last, false_type());} _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(const_pointer __new_last, false_type) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY @@ -395,7 +406,7 @@ private: } _LIBCPP_INLINE_VISIBILITY - void __copy_assign_alloc(const __vector_base& __c, false_type) + void __copy_assign_alloc(const __vector_base&, false_type) {} _LIBCPP_INLINE_VISIBILITY @@ -406,7 +417,7 @@ private: } _LIBCPP_INLINE_VISIBILITY - void __move_assign_alloc(__vector_base& __c, false_type) + void __move_assign_alloc(__vector_base&, false_type) _NOEXCEPT {} @@ -418,7 +429,7 @@ private: swap(__x, __y); } _LIBCPP_INLINE_VISIBILITY - static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type) + static void __swap_alloc(allocator_type&, allocator_type&, false_type) _NOEXCEPT {} }; @@ -428,7 +439,7 @@ _LIBCPP_INLINE_VISIBILITY inline void __vector_base<_Tp, _Allocator>::__destruct_at_end(const_pointer __new_last, false_type) _NOEXCEPT { - while (__new_last < __end_) + while (__new_last != __end_) __alloc_traits::destroy(__alloc(), const_cast(--__end_)); } @@ -665,7 +676,7 @@ public: _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - void push_back(value_type&& __x); + _LIBCPP_INLINE_VISIBILITY void push_back(value_type&& __x); #ifndef _LIBCPP_HAS_NO_VARIADICS template void emplace_back(_Args&&... __args); @@ -778,14 +789,25 @@ private: #endif __base::__destruct_at_end(__new_last); } + template + void +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + __push_back_slow_path(_Up&& __x); +#else + __push_back_slow_path(_Up& __x); +#endif +#if !defined(_LIBCPP_HAS_NO_VARIADICS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) + template + void + __emplace_back_slow_path(_Args&&... __args); +#endif }; template void vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer& __v) { - for (pointer __p = this->__end_; this->__begin_ < __p;) - __v.push_front(_VSTD::move_if_noexcept(*--__p)); + __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, this->__end_, __v.__begin_); _VSTD::swap(this->__begin_, __v.__begin_); _VSTD::swap(this->__end_, __v.__end_); _VSTD::swap(this->__end_cap(), __v.__end_cap()); @@ -798,10 +820,8 @@ typename vector<_Tp, _Allocator>::pointer vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer& __v, pointer __p) { pointer __r = __v.__begin_; - for (pointer __i = __p; this->__begin_ < __i;) - __v.push_front(_VSTD::move_if_noexcept(*--__i)); - for (pointer __i = __p; __i < this->__end_; ++__i) - __v.push_back(_VSTD::move_if_noexcept(*__i)); + __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, __p, __v.__begin_); + __alloc_traits::__construct_forward(this->__alloc(), __p, this->__end_, __v.__end_); _VSTD::swap(this->__begin_, __v.__begin_); _VSTD::swap(this->__end_, __v.__end_); _VSTD::swap(this->__end_cap(), __v.__end_cap()); @@ -1135,8 +1155,8 @@ vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a) } else { - typedef move_iterator _I; - assign(_I(__x.begin()), _I(__x.end())); + typedef move_iterator _Ip; + assign(_Ip(__x.begin()), _Ip(__x.end())); } } @@ -1192,8 +1212,8 @@ vector<_Tp, _Allocator>::__move_assign(vector& __c, false_type) { if (__base::__alloc() != __c.__alloc()) { - typedef move_iterator _I; - assign(_I(__c.begin()), _I(__c.end())); + typedef move_iterator _Ip; + assign(_Ip(__c.begin()), _Ip(__c.end())); } else __move_assign(__c, true_type()); @@ -1427,27 +1447,41 @@ vector<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT } template +template +void +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +vector<_Tp, _Allocator>::__push_back_slow_path(_Up&& __x) +#else +vector<_Tp, _Allocator>::__push_back_slow_path(_Up& __x) +#endif +{ + allocator_type& __a = this->__alloc(); + __split_buffer __v(__recommend(size() + 1), size(), __a); + // __v.push_back(_VSTD::forward<_Up>(__x)); + __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__v.__end_), _VSTD::forward<_Up>(__x)); + __v.__end_++; + __swap_out_circular_buffer(__v); +} + +template +_LIBCPP_INLINE_VISIBILITY inline void vector<_Tp, _Allocator>::push_back(const_reference __x) { - if (this->__end_ < this->__end_cap()) + if (this->__end_ != this->__end_cap()) { __alloc_traits::construct(this->__alloc(), _VSTD::__to_raw_pointer(this->__end_), __x); ++this->__end_; } else - { - allocator_type& __a = this->__alloc(); - __split_buffer __v(__recommend(size() + 1), size(), __a); - __v.push_back(__x); - __swap_out_circular_buffer(__v); - } + __push_back_slow_path(__x); } #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template +_LIBCPP_INLINE_VISIBILITY inline void vector<_Tp, _Allocator>::push_back(value_type&& __x) { @@ -1459,12 +1493,7 @@ vector<_Tp, _Allocator>::push_back(value_type&& __x) ++this->__end_; } else - { - allocator_type& __a = this->__alloc(); - __split_buffer __v(__recommend(size() + 1), size(), __a); - __v.push_back(_VSTD::move(__x)); - __swap_out_circular_buffer(__v); - } + __push_back_slow_path(_VSTD::move(__x)); } #ifndef _LIBCPP_HAS_NO_VARIADICS @@ -1472,6 +1501,20 @@ vector<_Tp, _Allocator>::push_back(value_type&& __x) template template void +vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args) +{ + allocator_type& __a = this->__alloc(); + __split_buffer __v(__recommend(size() + 1), size(), __a); +// __v.emplace_back(_VSTD::forward<_Args>(__args)...); + __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__v.__end_), _VSTD::forward<_Args>(__args)...); + __v.__end_++; + __swap_out_circular_buffer(__v); +} + +template +template +_LIBCPP_INLINE_VISIBILITY inline +void vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) { if (this->__end_ < this->__end_cap()) @@ -1482,12 +1525,7 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) ++this->__end_; } else - { - allocator_type& __a = this->__alloc(); - __split_buffer __v(__recommend(size() + 1), size(), __a); - __v.emplace_back(_VSTD::forward<_Args>(__args)...); - __swap_out_circular_buffer(__v); - } + __emplace_back_slow_path(_VSTD::forward<_Args>(__args)...); } #endif // _LIBCPP_HAS_NO_VARIADICS @@ -1645,8 +1683,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 @@ -1934,6 +1973,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 @@ -1955,7 +1995,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> @@ -2230,7 +2269,7 @@ private: } _LIBCPP_INLINE_VISIBILITY - void __copy_assign_alloc(const vector& __c, false_type) + void __copy_assign_alloc(const vector&, false_type) {} void __move_assign(vector& __c, false_type); @@ -2251,7 +2290,7 @@ private: } _LIBCPP_INLINE_VISIBILITY - void __move_assign_alloc(vector& __c, false_type) + void __move_assign_alloc(vector&, false_type) _NOEXCEPT {} @@ -2271,7 +2310,7 @@ private: swap(__x, __y); } _LIBCPP_INLINE_VISIBILITY - static void __swap_alloc(__storage_allocator& __x, __storage_allocator& __y, false_type) + static void __swap_alloc(__storage_allocator&, __storage_allocator&, false_type) _NOEXCEPT {} @@ -2281,7 +2320,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; }; @@ -2663,6 +2702,7 @@ vector::operator=(vector&& __v) { __move_assign(__v, integral_constant()); + return *this; } template diff --git a/system/lib/libc.symbols b/system/lib/libc.symbols index 1342d93825834..cd498651031fc 100644 --- a/system/lib/libc.symbols +++ b/system/lib/libc.symbols @@ -1,75 +1,51 @@ +_err +_errx +_verr +_verrx +_vwarn +_vwarnx +_warn +_warnx +atof +bulk_free +calloc +err +errx +free getopt getopt_long getopt_long_only -malloc -free -calloc -memalign -realloc -valloc -pvalloc +independent_calloc +independent_comalloc mallinfo -mallopt -malloc_trim -malloc_stats -malloc_usable_size +malloc malloc_footprint +malloc_footprint_limit malloc_max_footprint -independent_calloc -independent_comalloc -_Znwj -_Znaj -_Znam -_Znwm -_ZdaPv -_ZdaPvRKSt9nothrow_t -_ZdlPv -_ZdlPvRKSt9nothrow_t -_Znaj -_ZnajRKSt9nothrow_t -_Znwj -_ZnwjRKSt9nothrow_t -_ZL13__new_handler -_ZSt15get_new_handlerv -_ZSt15set_new_handlerPFvvE -_ZTVSt9bad_alloc -_ZTSSt9bad_alloc -_ZNKSt9bad_alloc4whatEv -_ZNSt9bad_allocC1Ev -_ZNSt9bad_allocC2Ev -_ZNSt9bad_allocD0Ev -_ZNSt9bad_allocD1Ev -_ZNSt9bad_allocD2Ev -_ZSt17__throw_bad_allocv -_ZTISt9bad_alloc -_ZTVSt20bad_array_new_length -_ZTSSt20bad_array_new_length -_ZTISt20bad_array_new_length -_ZNKSt20bad_array_new_length4whatEv -_ZNSt20bad_array_new_lengthC1Ev -_ZNSt20bad_array_new_lengthC2Ev -_ZNSt20bad_array_new_lengthD0Ev -_ZNSt20bad_array_new_lengthD1Ev -_ZNSt20bad_array_new_lengthD2Ev -warn -warnx -err -errx -_warn -_warnx -_err -_errx -vwarn -vwarnx -verr -verrx -_vwarn -_vwarnx -_verr -_verrx +malloc_set_footprint_limit +malloc_stats +malloc_trim +malloc_usable_size +mallopt +memalign +optarg +opterr +optind +optopt +optreset +posix_memalign +pvalloc +realloc +realloc_in_place strtod -strtold -strtof strtod_l +strtof +strtold strtold_l -atof +valloc +verr +verrx +vwarn +vwarnx +warn1 +warnx diff --git a/system/lib/libcxx/CREDITS.TXT b/system/lib/libcxx/CREDITS.TXT new file mode 100644 index 0000000000000..52948510846d2 --- /dev/null +++ b/system/lib/libcxx/CREDITS.TXT @@ -0,0 +1,91 @@ +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: Saleem Abdulrasool +E: compnerd@compnerd.org +D: Minor patches and Linux fixes. + +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: Ruben Van Boxem +E: vanboxem dot ruben at gmail dot com +D: Initial Windows patches. + +N: David Chisnall +E: theraven at theravensnest dot org +D: FreeBSD and Solaris ports, libcxxrt support, some atomics work. + +N: Marshall Clow +E: mclow.lists@gmail.com +E: marshall@idio.com +D: Minor patches and bug fixes. + +N: Google Inc. +D: Copyright owner and contributor of the CityHash algorithm + +N: Howard Hinnant +E: hhinnant@apple.com +D: Architect and primary author of libc++ + +N: Hyeon-bin Jeong +E: tuhertz@gmail.com +D: Minor patches and bug fixes. + +N: Argyrios Kyrtzidis +E: kyrtzidis@apple.com +D: Bug fixes. + +N: Michel Morin +E: mimomorin@gmail.com +D: Minor patches to is_convertible. + +N: Andrew Morrow +E: andrew.c.morrow@gmail.com +D: Minor patches and Linux fixes. + +N: Arvid Picciani +E: aep at exys dot org +D: Minor patches and musl port. + +N: Bjorn Reese +E: breese@users.sourceforge.net +D: Initial regex prototype + +N: Jonathan Sauer +D: Minor patches, mostly related to constexpr + +N: Craig Silverstein +E: csilvers@google.com +D: Implemented Cityhash as the string hash function on 64-bit machines + +N: Richard Smith +D: Minor patches. + +N: Michael van der Westhuizen +E: r1mikey at gmail dot com + +N: Klaas de Vries +E: klaas at klaasgaaf dot nl +D: Minor bug fix. + +N: Zhang Xiongpang +E: zhangxiongpang@gmail.com +D: Minor patches and bug fixes. + +N: Jeffrey Yasskin +E: jyasskin@gmail.com +E: jyasskin@google.com +D: Linux fixes. diff --git a/system/lib/libcxx/LICENSE.txt b/system/lib/libcxx/LICENSE.txt index 926f067697acd..5ed8ec2248352 100644 --- a/system/lib/libcxx/LICENSE.txt +++ b/system/lib/libcxx/LICENSE.txt @@ -14,7 +14,7 @@ Full text of the relevant licenses is included below. University of Illinois/NCSA Open Source License -Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT +Copyright (c) 2009-2013 by the contributors listed in CREDITS.TXT All rights reserved. @@ -55,7 +55,7 @@ SOFTWARE. ============================================================================== -Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT +Copyright (c) 2009-2013 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 diff --git a/system/lib/libcxx/Makefile b/system/lib/libcxx/Makefile deleted file mode 100644 index 814921ea3b0cc..0000000000000 --- a/system/lib/libcxx/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -OBJECTS = \ - algorithm.bc \ - condition_variable.bc \ - future.bc \ - iostream.bc \ - memory.bc \ - random.bc \ - stdexcept.bc \ - system_error.bc \ - utility.bc \ - bind.bc \ - debug.bc \ - hash.bc \ - mutex.bc \ - string.bc \ - thread.bc \ - valarray.bc \ - chrono.bc \ - exception.bc \ - ios.bc \ - locale.bc \ - regex.bc \ - strstream.bc \ - typeinfo.bc - -all: libcxx.bc - -%.bc: %.cpp - $(CXX) $< -o $@ - -libcxx.bc: $(OBJECTS) - $(CXX) $(OBJECTS) -o libcxx.bc - diff --git a/system/lib/libcxx/chrono.cpp b/system/lib/libcxx/chrono.cpp index 416b95013ef29..1ce2e2807a37b 100644 --- a/system/lib/libcxx/chrono.cpp +++ b/system/lib/libcxx/chrono.cpp @@ -24,6 +24,8 @@ namespace chrono // system_clock +const bool system_clock::is_steady; + system_clock::time_point system_clock::now() _NOEXCEPT { @@ -46,6 +48,8 @@ system_clock::from_time_t(time_t t) _NOEXCEPT // steady_clock +const bool steady_clock::is_steady; + #if __APPLE__ // mach_absolute_time() * MachInfo.numer / MachInfo.denom is the number of // nanoseconds since the computer booted up. MachInfo.numer and MachInfo.denom @@ -61,7 +65,7 @@ static steady_clock::rep steady_simplified() { - return mach_absolute_time(); + return static_cast(mach_absolute_time()); } static diff --git a/system/lib/libcxx/condition_variable.cpp b/system/lib/libcxx/condition_variable.cpp index ca1dca3280e9f..de0f6f47dd1b8 100644 --- a/system/lib/libcxx/condition_variable.cpp +++ b/system/lib/libcxx/condition_variable.cpp @@ -16,18 +16,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD condition_variable::~condition_variable() { - int e = pthread_cond_destroy(&__cv_); -// assert(e == 0); + pthread_cond_destroy(&__cv_); } 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_); } @@ -52,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/system/lib/libcxx/debug.cpp b/system/lib/libcxx/debug.cpp index 2d2d6432df134..f3a0262d1d5e3 100644 --- a/system/lib/libcxx/debug.cpp +++ b/system/lib/libcxx/debug.cpp @@ -23,7 +23,7 @@ __get_db() { static __libcpp_db db; return &db; -}; +} _LIBCPP_VISIBLE const __libcpp_db* @@ -120,20 +120,18 @@ __libcpp_db::__insert_ic(void* __i, const void* __c) { WLock _(mut()); __i_node* i = __insert_iterator(__i); - _LIBCPP_ASSERT(__cbeg_ != __cend_, "Container constructed in a translation unit with debug mode disabled." - " But it is being used in a translation unit with debug mode enabled." - " Enable it in the other translation unit with #define _LIBCPP_DEBUG2 1"); - size_t hc = hash()(__c) % (__cend_ - __cbeg_); + const char* errmsg = + "Container constructed in a translation unit with debug mode disabled." + " But it is being used in a translation unit with debug mode enabled." + " Enable it in the other translation unit with #define _LIBCPP_DEBUG2 1"; + _LIBCPP_ASSERT(__cbeg_ != __cend_, errmsg); + size_t hc = hash()(__c) % static_cast(__cend_ - __cbeg_); __c_node* c = __cbeg_[hc]; - _LIBCPP_ASSERT(c != nullptr, "Container constructed in a translation unit with debug mode disabled." - " But it is being used in a translation unit with debug mode enabled." - " Enable it in the other translation unit with #define _LIBCPP_DEBUG2 1"); + _LIBCPP_ASSERT(c != nullptr, errmsg); while (c->__c_ != __c) { c = c->__next_; - _LIBCPP_ASSERT(c != nullptr, "Container constructed in a translation unit with debug mode disabled." - " But it is being used in a translation unit with debug mode enabled." - " Enable it in the other translation unit with #define _LIBCPP_DEBUG2 1"); + _LIBCPP_ASSERT(c != nullptr, errmsg); } c->__add(i); i->__c_ = c; @@ -143,12 +141,16 @@ __c_node* __libcpp_db::__insert_c(void* __c) { WLock _(mut()); - if (__csz_ + 1 > __cend_ - __cbeg_) + if (__csz_ + 1 > static_cast(__cend_ - __cbeg_)) { - size_t nc = __next_prime(2*(__cend_ - __cbeg_) + 1); + 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; @@ -165,11 +167,15 @@ __libcpp_db::__insert_c(void* __c) __cbeg_ = cbeg; __cend_ = __cbeg_ + nc; } - size_t hc = hash()(__c) % (__cend_ - __cbeg_); + size_t hc = hash()(__c) % static_cast(__cend_ - __cbeg_); __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_; @@ -182,7 +188,7 @@ __libcpp_db::__erase_i(void* __i) WLock _(mut()); if (__ibeg_ != __iend_) { - size_t hi = hash()(__i) % (__iend_ - __ibeg_); + size_t hi = hash()(__i) % static_cast(__iend_ - __ibeg_); __i_node* p = __ibeg_[hi]; if (p != nullptr) { @@ -211,7 +217,7 @@ void __libcpp_db::__invalidate_all(void* __c) { WLock _(mut()); - size_t hc = hash()(__c) % (__cend_ - __cbeg_); + size_t hc = hash()(__c) % static_cast(__cend_ - __cbeg_); __c_node* p = __cbeg_[hc]; _LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __invalidate_all A"); while (p->__c_ != __c) @@ -230,7 +236,7 @@ __c_node* __libcpp_db::__find_c_and_lock(void* __c) const { mut().lock(); - size_t hc = hash()(__c) % (__cend_ - __cbeg_); + size_t hc = hash()(__c) % static_cast(__cend_ - __cbeg_); __c_node* p = __cbeg_[hc]; _LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __find_c_and_lock A"); while (p->__c_ != __c) @@ -241,6 +247,20 @@ __libcpp_db::__find_c_and_lock(void* __c) const return p; } +__c_node* +__libcpp_db::__find_c(void* __c) const +{ + size_t hc = hash()(__c) % static_cast(__cend_ - __cbeg_); + __c_node* p = __cbeg_[hc]; + _LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __find_c A"); + while (p->__c_ != __c) + { + p = p->__next_; + _LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __find_c B"); + } + return p; +} + void __libcpp_db::unlock() const { @@ -251,7 +271,7 @@ void __libcpp_db::__erase_c(void* __c) { WLock _(mut()); - size_t hc = hash()(__c) % (__cend_ - __cbeg_); + size_t hc = hash()(__c) % static_cast(__cend_ - __cbeg_); __c_node* p = __cbeg_[hc]; __c_node* q = nullptr; _LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __erase_c A"); @@ -348,7 +368,7 @@ void __libcpp_db::swap(void* c1, void* c2) { WLock _(mut()); - size_t hc = hash()(c1) % (__cend_ - __cbeg_); + size_t hc = hash()(c1) % static_cast(__cend_ - __cbeg_); __c_node* p1 = __cbeg_[hc]; _LIBCPP_ASSERT(p1 != nullptr, "debug mode internal logic error swap A"); while (p1->__c_ != c1) @@ -356,7 +376,7 @@ __libcpp_db::swap(void* c1, void* c2) p1 = p1->__next_; _LIBCPP_ASSERT(p1 != nullptr, "debug mode internal logic error swap B"); } - hc = hash()(c2) % (__cend_ - __cbeg_); + hc = hash()(c2) % static_cast(__cend_ - __cbeg_); __c_node* p2 = __cbeg_[hc]; _LIBCPP_ASSERT(p2 != nullptr, "debug mode internal logic error swap C"); while (p2->__c_ != c2) @@ -380,18 +400,47 @@ __libcpp_db::__insert_i(void* __i) __insert_iterator(__i); } +void +__c_node::__add(__i_node* i) +{ + if (end_ == cap_) + { + size_t nc = 2*static_cast(cap_ - beg_); + if (nc == 0) + 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_); + beg_ = beg; + end_ = beg_ + nc/2; + cap_ = beg_ + nc; + } + *end_++ = i; +} + // private api _LIBCPP_HIDDEN __i_node* __libcpp_db::__insert_iterator(void* __i) { - if (__isz_ + 1 > __iend_ - __ibeg_) + if (__isz_ + 1 > static_cast(__iend_ - __ibeg_)) { - size_t nc = __next_prime(2*(__iend_ - __ibeg_) + 1); + 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; @@ -408,11 +457,15 @@ __libcpp_db::__insert_iterator(void* __i) __ibeg_ = ibeg; __iend_ = __ibeg_ + nc; } - size_t hi = hash()(__i) % (__iend_ - __ibeg_); + size_t hi = hash()(__i) % static_cast(__iend_ - __ibeg_); __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; @@ -425,7 +478,7 @@ __libcpp_db::__find_iterator(const void* __i) const __i_node* r = nullptr; if (__ibeg_ != __iend_) { - size_t h = hash()(__i) % (__iend_ - __ibeg_); + size_t h = hash()(__i) % static_cast(__iend_ - __ibeg_); for (__i_node* nd = __ibeg_[h]; nd != nullptr; nd = nd->__next_) { if (nd->__i_ == __i) @@ -438,28 +491,6 @@ __libcpp_db::__find_iterator(const void* __i) const return r; } -_LIBCPP_HIDDEN -void -__c_node::__add(__i_node* i) -{ - if (end_ == cap_) - { - size_t nc = 2*(cap_ - beg_); - if (nc == 0) - nc = 1; - __i_node** beg = (__i_node**)malloc(nc * sizeof(__i_node*)); - if (beg == nullptr) - throw bad_alloc(); - if (nc > 1) - memcpy(beg, beg_, nc/2*sizeof(__i_node*)); - free(beg_); - beg_ = beg; - end_ = beg_ + nc/2; - cap_ = beg_ + nc; - } - *end_++ = i; -} - _LIBCPP_HIDDEN void __c_node::__remove(__i_node* p) @@ -467,7 +498,7 @@ __c_node::__remove(__i_node* p) __i_node** r = find(beg_, end_, p); _LIBCPP_ASSERT(r != end_, "debug mode internal logic error __c_node::__remove"); if (--end_ != r) - memmove(r, r+1, (end_ - r)*sizeof(__i_node*)); + memmove(r, r+1, static_cast(end_ - r)*sizeof(__i_node*)); } _LIBCPP_END_NAMESPACE_STD diff --git a/system/lib/libcxx/exception.cpp b/system/lib/libcxx/exception.cpp index cba355e9d617b..0cd182b716cb1 100644 --- a/system/lib/libcxx/exception.cpp +++ b/system/lib/libcxx/exception.cpp @@ -10,69 +10,82 @@ #include "exception" +#ifndef __has_include +#define __has_include(inc) 0 +#endif + #if __APPLE__ #include + using namespace __cxxabiv1; - using namespace __cxxabiapple; - // On Darwin, there are two STL shared libraries and a lower level ABI - // shared libray. The globals holding the current terminate handler and - // current unexpected handler are in the ABI library. - #define __terminate_handler __cxxabiapple::__cxa_terminate_handler - #define __unexpected_handler __cxxabiapple::__cxa_unexpected_handler #define HAVE_DEPENDENT_EH_ABI 1 -#elif defined(LIBCXXRT) + #ifndef _LIBCPPABI_VERSION + using namespace __cxxabiapple; + // On Darwin, there are two STL shared libraries and a lower level ABI + // shared libray. The globals holding the current terminate handler and + // current unexpected handler are in the ABI library. + #define __terminate_handler __cxxabiapple::__cxa_terminate_handler + #define __unexpected_handler __cxxabiapple::__cxa_unexpected_handler + #endif // _LIBCPPABI_VERSION +#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 +#elif !defined(__GLIBCXX__) // __has_include() static std::terminate_handler __terminate_handler; static std::unexpected_handler __unexpected_handler; -#endif // __APPLE__ +#endif // __has_include() + +namespace std +{ + +#if !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__) -#ifndef LIBCXXRT // libcxxrt provides implementations of these functions itself. -std::unexpected_handler -std::set_unexpected(std::unexpected_handler func) _NOEXCEPT +unexpected_handler +set_unexpected(unexpected_handler func) _NOEXCEPT { return __sync_lock_test_and_set(&__unexpected_handler, func); } -std::unexpected_handler -std::get_unexpected() _NOEXCEPT +unexpected_handler +get_unexpected() _NOEXCEPT { - return __sync_fetch_and_add(&__unexpected_handler, (std::unexpected_handler)0); + return __sync_fetch_and_add(&__unexpected_handler, (unexpected_handler)0); } -_ATTRIBUTE(noreturn) +_LIBCPP_NORETURN void -std::unexpected() +unexpected() { - (*std::get_unexpected())(); + (*get_unexpected())(); // unexpected handler should not return - std::terminate(); + terminate(); } -std::terminate_handler -std::set_terminate(std::terminate_handler func) _NOEXCEPT +terminate_handler +set_terminate(terminate_handler func) _NOEXCEPT { return __sync_lock_test_and_set(&__terminate_handler, func); } -std::terminate_handler -std::get_terminate() _NOEXCEPT +terminate_handler +get_terminate() _NOEXCEPT { - return __sync_fetch_and_add(&__terminate_handler, (std::terminate_handler)0); + return __sync_fetch_and_add(&__terminate_handler, (terminate_handler)0); } -_ATTRIBUTE(noreturn) +_LIBCPP_NORETURN void -std::terminate() _NOEXCEPT +terminate() _NOEXCEPT { #ifndef _LIBCPP_NO_EXCEPTIONS try { #endif // _LIBCPP_NO_EXCEPTIONS - (*std::get_terminate())(); + (*get_terminate())(); // handler should not return ::abort (); #ifndef _LIBCPP_NO_EXCEPTIONS @@ -84,38 +97,37 @@ std::terminate() _NOEXCEPT } #endif // _LIBCPP_NO_EXCEPTIONS } -#endif // LIBCXXRT +#endif // !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION) -#ifndef EMSCRIPTEN // This is implemented in Javascript for Emscripten -bool std::uncaught_exception() _NOEXCEPT +#if !defined(LIBCXXRT) && !defined(__GLIBCXX__) +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 __cxxabiapple::__cxa_uncaught_exception(); -#elif LIBCXXRT - __cxa_eh_globals * globals = __cxa_get_globals(); - return (globals->uncaughtExceptions != 0); + return __cxa_uncaught_exception(); #else // __APPLE__ #warning uncaught_exception not yet implemented ::abort(); #endif // __APPLE__ } -#endif // EMSCRIPTEN -namespace std -{ +#ifndef _LIBCPPABI_VERSION exception::~exception() _NOEXCEPT { } -bad_exception::~bad_exception() _NOEXCEPT +const char* exception::what() const _NOEXCEPT { + return "std::exception"; } -const char* exception::what() const _NOEXCEPT +#endif // _LIBCPPABI_VERSION +#endif //LIBCXXRT +#if !defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__) + +bad_exception::~bad_exception() _NOEXCEPT { - return "std::exception"; } const char* bad_exception::what() const _NOEXCEPT @@ -123,6 +135,9 @@ const char* bad_exception::what() const _NOEXCEPT return "std::bad_exception"; } +#endif + + exception_ptr::~exception_ptr() _NOEXCEPT { #if HAVE_DEPENDENT_EH_ABI @@ -169,7 +184,7 @@ nested_exception::~nested_exception() _NOEXCEPT { } -_ATTRIBUTE(noreturn) +_LIBCPP_NORETURN void nested_exception::rethrow_nested() const { @@ -178,15 +193,14 @@ nested_exception::rethrow_nested() const rethrow_exception(__ptr_); } -} // std -std::exception_ptr std::current_exception() _NOEXCEPT +exception_ptr current_exception() _NOEXCEPT { #if HAVE_DEPENDENT_EH_ABI // be nicer if there was a constructor that took a ptr, then // this whole function would be just: // return exception_ptr(__cxa_current_primary_exception()); - std::exception_ptr ptr; + exception_ptr ptr; ptr.__ptr_ = __cxa_current_primary_exception(); return ptr; #else // __APPLE__ @@ -195,7 +209,8 @@ std::exception_ptr std::current_exception() _NOEXCEPT #endif // __APPLE__ } -void std::rethrow_exception(exception_ptr p) +_LIBCPP_NORETURN +void rethrow_exception(exception_ptr p) { #if HAVE_DEPENDENT_EH_ABI __cxa_rethrow_primary_exception(p.__ptr_); @@ -206,3 +221,4 @@ void std::rethrow_exception(exception_ptr p) ::abort(); #endif // __APPLE__ } +} // std diff --git a/system/lib/libcxx/future.cpp b/system/lib/libcxx/future.cpp index ff59110593b24..7d9a5b5da69a4 100644 --- a/system/lib/libcxx/future.cpp +++ b/system/lib/libcxx/future.cpp @@ -29,7 +29,7 @@ __future_error_category::name() const _NOEXCEPT string __future_error_category::message(int ev) const { - switch (ev) + switch (static_cast(ev)) { case future_errc::broken_promise: return string("The associated promise has been destructed prior " @@ -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; @@ -78,8 +78,8 @@ __assoc_sub_state::set_value() throw future_error(make_error_code(future_errc::promise_already_satisfied)); #endif __state_ |= __constructed | ready; - __lk.unlock(); __cv_.notify_all(); + __lk.unlock(); } void @@ -152,9 +152,9 @@ __assoc_sub_state::__sub_wait(unique_lock& __lk) { if (!__is_ready()) { - if (__state_ & deferred) + if (__state_ & static_cast(deferred)) { - __state_ &= ~deferred; + __state_ &= ~static_cast(deferred); __lk.unlock(); __execute(); } diff --git a/system/lib/libcxx/hash.cpp b/system/lib/libcxx/hash.cpp index 728b9bd3831b3..a013500218e0d 100644 --- a/system/lib/libcxx/hash.cpp +++ b/system/lib/libcxx/hash.cpp @@ -10,6 +10,9 @@ #include "__hash_table" #include "algorithm" #include "stdexcept" +#include "type_traits" + +#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare" _LIBCPP_BEGIN_NAMESPACE_STD @@ -144,21 +147,23 @@ const unsigned indices[] = // are fewer potential primes to search, and fewer potential primes to divide // against. +template inline _LIBCPP_INLINE_VISIBILITY -void -__check_for_overflow(size_t N, integral_constant) +typename enable_if<_Sz == 4, void>::type +__check_for_overflow(size_t N) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_NO_EXCEPTIONS if (N > 0xFFFFFFFB) throw overflow_error("__next_prime overflow"); #endif } +template inline _LIBCPP_INLINE_VISIBILITY -void -__check_for_overflow(size_t N, integral_constant) +typename enable_if<_Sz == 8, void>::type +__check_for_overflow(size_t N) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_NO_EXCEPTIONS if (N > 0xFFFFFFFFFFFFFFC5ull) throw overflow_error("__next_prime overflow"); #endif @@ -174,14 +179,14 @@ __next_prime(size_t n) return *std::lower_bound(small_primes, small_primes + N, n); // Else n > largest small_primes // Check for overflow - __check_for_overflow(n, integral_constant()); + __check_for_overflow(n); // Start searching list of potential primes: L * k0 + indices[in] const size_t M = sizeof(indices) / sizeof(indices[0]); // Select first potential prime >= n // Known a-priori n >= L size_t k0 = n / L; - size_t in = std::lower_bound(indices, indices + M, n - k0 * L) - indices; + size_t in = static_cast(std::lower_bound(indices, indices + M, n - k0 * L) + - indices); n = L * k0 + indices[in]; while (true) { diff --git a/system/lib/libcxx/ios.cpp b/system/lib/libcxx/ios.cpp index 80917a046d2ff..732a61bb23906 100644 --- a/system/lib/libcxx/ios.cpp +++ b/system/lib/libcxx/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/system/lib/libcxx/iostream.cpp b/system/lib/libcxx/iostream.cpp index 157c3977d478b..f5b959b4bb995 100644 --- a/system/lib/libcxx/iostream.cpp +++ b/system/lib/libcxx/iostream.cpp @@ -9,45 +9,58 @@ #include "__std_stream" #include "string" +#include "new" _LIBCPP_BEGIN_NAMESPACE_STD -static __stdinbuf __cin(stdin); -static __stdoutbuf __cout(stdout); -static __stdoutbuf __cerr(stderr); -static __stdinbuf __wcin(stdin); -static __stdoutbuf __wcout(stdout); -static __stdoutbuf __wcerr(stderr); - -istream cin(&__cin); -ostream cout(&__cout); -ostream cerr(&__cerr); -ostream clog(&__cerr); -wistream wcin(&__wcin); -wostream wcout(&__wcout); -wostream wcerr(&__wcerr); -wostream wclog(&__wcerr); +_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_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; ios_base::Init::Init() { - cin.tie(&cout); - _VSTD::unitbuf(cerr); - cerr.tie(&cout); + istream* cin_ptr = ::new(cin) istream(::new(__cin) __stdinbuf (stdin) ); + ostream* cout_ptr = ::new(cout) ostream(::new(__cout) __stdoutbuf(stdout)); + ostream* cerr_ptr = ::new(cerr) ostream(::new(__cerr) __stdoutbuf(stderr)); + ::new(clog) ostream(cerr_ptr->rdbuf()); + cin_ptr->tie(cout_ptr); + _VSTD::unitbuf(*cerr_ptr); + cerr_ptr->tie(cout_ptr); - wcin.tie(&wcout); - _VSTD::unitbuf(wcerr); - wcerr.tie(&wcout); + wistream* wcin_ptr = ::new(wcin) wistream(::new(__wcin) __stdinbuf (stdin) ); + wostream* wcout_ptr = ::new(wcout) wostream(::new(__wcout) __stdoutbuf(stdout)); + wostream* wcerr_ptr = ::new(wcerr) wostream(::new(__wcerr) __stdoutbuf(stderr)); + ::new(wclog) wostream(wcerr_ptr->rdbuf()); + wcin_ptr->tie(wcout_ptr); + _VSTD::unitbuf(*wcerr_ptr); + wcerr_ptr->tie(wcout_ptr); } ios_base::Init::~Init() { - cout.flush(); - clog.flush(); + ostream* cout_ptr = (ostream*)cout; + ostream* clog_ptr = (ostream*)clog; + cout_ptr->flush(); + clog_ptr->flush(); - wcout.flush(); - wclog.flush(); + wostream* wcout_ptr = (wostream*)wcout; + wostream* wclog_ptr = (wostream*)wclog; + wcout_ptr->flush(); + wclog_ptr->flush(); } _LIBCPP_END_NAMESPACE_STD diff --git a/system/lib/libcxx/locale.cpp b/system/lib/libcxx/locale.cpp index 87c476364b49c..35a6508660471 100644 --- a/system/lib/libcxx/locale.cpp +++ b/system/lib/libcxx/locale.cpp @@ -7,6 +7,12 @@ // //===----------------------------------------------------------------------===// +// On Solaris, we need to define something to make the C99 parts of localeconv +// visible. +#ifdef __sun__ +#define _LCONV_C99 +#endif + #include "string" #include "locale" #include "codecvt" @@ -20,38 +26,27 @@ #include "cwctype" #include "__sso_allocator" #if _WIN32 -#include +#include #else // _WIN32 #include #endif // _!WIN32 #include -#ifdef _LIBCPP_STABLE_APPLE_ABI -namespace { - decltype(MB_CUR_MAX_L(_VSTD::declval())) - inline _LIBCPP_INLINE_VISIBILITY - mb_cur_max_l(locale_t loc) - { - return MB_CUR_MAX_L(loc); - } -} -#endif +// On Linux, wint_t and wchar_t have different signed-ness, and this causes +// lots of noise in the build log, but no bugs that I know of. +#pragma clang diagnostic ignored "-Wsign-conversion" _LIBCPP_BEGIN_NAMESPACE_STD -#ifndef _LIBCPP_STABLE_APPLE_ABI +#ifdef __cloc_defined locale_t __cloc() { // In theory this could create a race condition. In practice // the race condition is non-fatal since it will just create // a little resource leak. Better approach would be appreciated. -#ifdef __APPLE__ - return 0; -#else static locale_t result = newlocale(LC_ALL_MASK, "C", 0); return result; -#endif } -#endif // _LIBCPP_STABLE_APPLE_ABI +#endif // __cloc_defined namespace { @@ -90,14 +85,44 @@ make(A0 a0, A1 a1, A2 a2) return *(T*)&buf; } +template +inline +_LIBCPP_CONSTEXPR +size_t +countof(const T (&)[N]) +{ + return N; +} + +template +inline +_LIBCPP_CONSTEXPR +size_t +countof(const T * const begin, const T * const end) +{ + return static_cast(end - begin); +} + } +const locale::category locale::none; +const locale::category locale::collate; +const locale::category locale::ctype; +const locale::category locale::monetary; +const locale::category locale::numeric; +const locale::category locale::time; +const locale::category locale::messages; +const locale::category locale::all; + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" + class _LIBCPP_HIDDEN locale::__imp : public facet { enum {N = 28}; - string name_; vector > facets_; + string name_; public: explicit __imp(size_t refs = 0); explicit __imp(const string& name, size_t refs = 0); @@ -108,7 +133,8 @@ class _LIBCPP_HIDDEN locale::__imp ~__imp(); const string& name() const {return name_;} - bool has_facet(long id) const {return id < facets_.size() && facets_[id];} + bool has_facet(long id) const + {return static_cast(id) < facets_.size() && facets_[static_cast(id)];} const locale::facet* use_facet(long id) const; static const locale& make_classic(); @@ -119,46 +145,48 @@ class _LIBCPP_HIDDEN locale::__imp template void install_from(const __imp& other); }; +#pragma clang diagnostic pop + locale::__imp::__imp(size_t refs) : facet(refs), - name_("C"), - facets_(N) + facets_(N), + name_("C") { facets_.clear(); - install(&make<_VSTD::collate >(1)); - install(&make<_VSTD::collate >(1)); - install(&make<_VSTD::ctype >((ctype_base::mask*)0, false, 1)); - install(&make<_VSTD::ctype >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make >(1)); - install(&make<_VSTD::messages >(1)); - install(&make<_VSTD::messages >(1)); + install(&make<_VSTD::collate >(1u)); + install(&make<_VSTD::collate >(1u)); + install(&make<_VSTD::ctype >((ctype_base::mask*)0, false, 1u)); + install(&make<_VSTD::ctype >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make >(1u)); + install(&make<_VSTD::messages >(1u)); + install(&make<_VSTD::messages >(1u)); } locale::__imp::__imp(const string& name, size_t refs) : facet(refs), - name_(name), - facets_(N) + facets_(N), + name_(name) { #ifndef _LIBCPP_NO_EXCEPTIONS try @@ -200,9 +228,14 @@ locale::__imp::__imp(const string& name, size_t refs) #endif // _LIBCPP_NO_EXCEPTIONS } +// NOTE avoid the `base class should be explicitly initialized in the +// copy constructor` warning emitted by GCC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wextra" + locale::__imp::__imp(const __imp& other) - : name_(other.name_), - facets_(max(N, other.facets_.size())) + : facets_(max(N, other.facets_.size())), + name_(other.name_) { facets_ = other.facets_; for (unsigned i = 0; i < facets_.size(); ++i) @@ -210,9 +243,11 @@ locale::__imp::__imp(const __imp& other) facets_[i]->__add_shared(); } +#pragma GCC diagnostic pop + locale::__imp::__imp(const __imp& other, const string& name, locale::category c) - : name_("*"), - facets_(N) + : facets_(N), + name_("*") { facets_ = other.facets_; for (unsigned i = 0; i < facets_.size(); ++i) @@ -282,8 +317,8 @@ locale::__imp::install_from(const locale::__imp& one) } locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c) - : name_("*"), - facets_(N) + : facets_(N), + name_("*") { facets_ = other.facets_; for (unsigned i = 0; i < facets_.size(); ++i) @@ -352,8 +387,8 @@ locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c) } locale::__imp::__imp(const __imp& other, facet* f, long id) - : name_("*"), - facets_(max(N, other.facets_.size()+1)) + : facets_(max(N, other.facets_.size()+1)), + name_("*") { f->__add_shared(); unique_ptr hold(f); @@ -376,11 +411,11 @@ locale::__imp::install(facet* f, long id) { f->__add_shared(); unique_ptr hold(f); - if (id >= facets_.size()) - facets_.resize(id+1); - if (facets_[id]) - facets_[id]->__release_shared(); - facets_[id] = hold.release(); + if (static_cast(id) >= facets_.size()) + facets_.resize(static_cast(id+1)); + if (facets_[static_cast(id)]) + facets_[static_cast(id)]->__release_shared(); + facets_[static_cast(id)] = hold.release(); } const locale::facet* @@ -390,7 +425,7 @@ locale::__imp::use_facet(long id) const if (!has_facet(id)) throw bad_cast(); #endif // _LIBCPP_NO_EXCEPTIONS - return facets_[id]; + return facets_[static_cast(id)]; } // locale @@ -401,7 +436,7 @@ locale::__imp::make_classic() // only one thread can get in here and it only gets in once static aligned_storage::type buf; locale* c = (locale*)&buf; - c->__locale_ = &make<__imp>(1); + c->__locale_ = &make<__imp>(1u); return *c; } @@ -417,7 +452,6 @@ locale::__imp::make_global() { // only one thread can get in here and it only gets in once static aligned_storage::type buf; - locale* g = (locale*)&buf; ::new (&buf) locale(locale::classic()); return *(locale*)&buf; } @@ -695,6 +729,19 @@ collate_byname::do_transform(const char_type* lo, const char_type* hi) // template <> class ctype; +const ctype_base::mask ctype_base::space; +const ctype_base::mask ctype_base::print; +const ctype_base::mask ctype_base::cntrl; +const ctype_base::mask ctype_base::upper; +const ctype_base::mask ctype_base::lower; +const ctype_base::mask ctype_base::alpha; +const ctype_base::mask ctype_base::digit; +const ctype_base::mask ctype_base::punct; +const ctype_base::mask ctype_base::xdigit; +const ctype_base::mask ctype_base::blank; +const ctype_base::mask ctype_base::alnum; +const ctype_base::mask ctype_base::graph; + locale::id ctype::id; ctype::~ctype() @@ -737,10 +784,12 @@ ctype::do_scan_not(mask m, const char_type* low, const char_type* high) wchar_t ctype::do_toupper(char_type c) const { -#if !(defined(_LIBCPP_STABLE_APPLE_ABI) || defined(__FreeBSD__)) +#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE + return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c; +#elif defined(__GLIBC__) || defined(EMSCRIPTEN) return isascii(c) ? ctype::__classic_upper_table()[c] : c; #else - return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c; + return (isascii(c) && iswlower_l(c, __cloc())) ? c-L'a'+L'A' : c; #endif } @@ -748,11 +797,13 @@ const wchar_t* ctype::do_toupper(char_type* low, const char_type* high) const { for (; low != high; ++low) -#if !(defined(_LIBCPP_STABLE_APPLE_ABI) || defined(__FreeBSD__)) +#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE + *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low; +#elif defined(__GLIBC__) || defined(EMSCRIPTEN) *low = isascii(*low) ? ctype::__classic_upper_table()[*low] : *low; #else - *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low; + *low = (isascii(*low) && islower_l(*low, __cloc())) ? (*low-L'a'+L'A') : *low; #endif return low; } @@ -760,10 +811,12 @@ ctype::do_toupper(char_type* low, const char_type* high) const wchar_t ctype::do_tolower(char_type c) const { -#ifndef _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE + return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c; +#elif defined(__GLIBC__) || defined(EMSCRIPTEN) return isascii(c) ? ctype::__classic_lower_table()[c] : c; #else - return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c; + return (isascii(c) && isupper_l(c, __cloc())) ? c-L'A'+'a' : c; #endif } @@ -771,11 +824,13 @@ const wchar_t* ctype::do_tolower(char_type* low, const char_type* high) const { for (; low != high; ++low) -#ifndef _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE + *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low; +#elif defined(__GLIBC__) || defined(EMSCRIPTEN) *low = isascii(*low) ? ctype::__classic_lower_table()[*low] : *low; #else - *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low; + *low = (isascii(*low) && isupper_l(*low, __cloc())) ? *low-L'A'+L'a' : *low; #endif return low; } @@ -807,7 +862,7 @@ ctype::do_narrow(const char_type* low, const char_type* high, char dfau { for (; low != high; ++low, ++dest) if (isascii(*low)) - *dest = *low; + *dest = static_cast(*low); else *dest = dfault; return low; @@ -835,10 +890,14 @@ ctype::~ctype() char ctype::do_toupper(char_type c) const { -#ifndef _LIBCPP_STABLE_APPLE_ABI - return isascii(c) ? __classic_upper_table()[c] : c; +#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE + return isascii(c) ? + static_cast(_DefaultRuneLocale.__mapupper[static_cast(c)]) : c; +#elif defined(__GLIBC__) || defined(EMSCRIPTEN) + return isascii(c) ? + static_cast(__classic_upper_table()[static_cast(c)]) : c; #else - return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c; + return (isascii(c) && islower_l(c, __cloc())) ? c-'a'+'A' : c; #endif } @@ -846,10 +905,14 @@ const char* ctype::do_toupper(char_type* low, const char_type* high) const { for (; low != high; ++low) -#ifndef _LIBCPP_STABLE_APPLE_ABI - *low = isascii(*low) ? __classic_upper_table()[*low] : *low; +#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE + *low = isascii(*low) ? + static_cast(_DefaultRuneLocale.__mapupper[static_cast(*low)]) : *low; +#elif defined(__GLIBC__) || defined(EMSCRIPTEN) + *low = isascii(*low) ? + static_cast(__classic_upper_table()[static_cast(*low)]) : *low; #else - *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low; + *low = (isascii(*low) && islower_l(*low, __cloc())) ? *low-'a'+'A' : *low; #endif return low; } @@ -857,10 +920,14 @@ ctype::do_toupper(char_type* low, const char_type* high) const char ctype::do_tolower(char_type c) const { -#ifndef _LIBCPP_STABLE_APPLE_ABI - return isascii(c) ? __classic_lower_table()[c] : c; +#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE + return isascii(c) ? + static_cast(_DefaultRuneLocale.__maplower[static_cast(c)]) : c; +#elif defined(__GLIBC__) || defined(EMSCRIPTEN) + return isascii(c) ? + static_cast(__classic_lower_table()[static_cast(c)]) : c; #else - return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c; + return (isascii(c) && isupper_l(c, __cloc())) ? c-'A'+'a' : c; #endif } @@ -868,10 +935,12 @@ const char* ctype::do_tolower(char_type* low, const char_type* high) const { for (; low != high; ++low) -#ifndef _LIBCPP_STABLE_APPLE_ABI - *low = isascii(*low) ? __classic_lower_table()[*low] : *low; +#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE + *low = isascii(*low) ? static_cast(_DefaultRuneLocale.__maplower[static_cast(*low)]) : *low; +#elif defined(__GLIBC__) || defined(EMSCRIPTEN) + *low = isascii(*low) ? static_cast(__classic_lower_table()[static_cast(*low)]) : *low; #else - *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low; + *low = (isascii(*low) && isupper_l(*low, __cloc())) ? *low-'A'+'a' : *low; #endif return low; } @@ -909,10 +978,11 @@ ctype::do_narrow(const char_type* low, const char_type* high, char dfault, return low; } -// XXX Emscripten define local table +#ifdef EMSCRIPTEN extern "C" const unsigned short ** __ctype_b_loc(); extern "C" const int ** __ctype_tolower_loc(); extern "C" const int ** __ctype_toupper_loc(); +#endif const ctype::mask* ctype::classic_table() _NOEXCEPT @@ -921,44 +991,50 @@ ctype::classic_table() _NOEXCEPT return _DefaultRuneLocale.__runetype; #elif defined(__GLIBC__) return __cloc()->__ctype_b; +#elif __sun__ + return __ctype_mask; +#elif _WIN32 + return _ctype+1; // internal ctype mask table defined in msvcrt.dll // This is assumed to be safe, which is a nonsense assumption because we're // going to end up dereferencing it later... -#elif defined(EMSCRIPTEN) +#elif EMSCRIPTEN return *__ctype_b_loc(); #else + // Platform not supported: abort so the person doing the port knows what to + // fix +# warning ctype::classic_table() is not implemented + abort(); return NULL; #endif } -#ifndef _LIBCPP_STABLE_APPLE_ABI +#if defined(__GLIBC__) const int* ctype::__classic_lower_table() _NOEXCEPT { -#if defined(__APPLE__) || defined(__FreeBSD__) - return _DefaultRuneLocale.__maplower; -#elif defined(__GLIBC__) return __cloc()->__ctype_tolower; -#elif defined(EMSCRIPTEN) - return *__ctype_tolower_loc(); -#else - return NULL; -#endif } const int* ctype::__classic_upper_table() _NOEXCEPT { -#if defined(__APPLE__) || defined(__FreeBSD__) - return _DefaultRuneLocale.__mapupper; -#elif defined(__GLIBC__) return __cloc()->__ctype_toupper; -#elif defined(EMSCRIPTEN) +} +#endif // __GLIBC__ + +#if defined(EMSCRIPTEN) +const int* +ctype::__classic_lower_table() _NOEXCEPT +{ + return *__ctype_tolower_loc(); +} + +const int* +ctype::__classic_upper_table() _NOEXCEPT +{ return *__ctype_toupper_loc(); -#else - return NULL; -#endif } -#endif // _LIBCPP_STABLE_APPLE_ABI +#endif // EMSCRIPTEN // template <> class ctype_byname @@ -992,28 +1068,28 @@ ctype_byname::~ctype_byname() char ctype_byname::do_toupper(char_type c) const { - return toupper_l(c, __l); + return static_cast(toupper_l(c, __l)); } const char* ctype_byname::do_toupper(char_type* low, const char_type* high) const { for (; low != high; ++low) - *low = toupper_l(*low, __l); + *low = static_cast(toupper_l(*low, __l)); return low; } char ctype_byname::do_tolower(char_type c) const { - return tolower_l(c, __l); + return static_cast(tolower_l(c, __l)); } const char* ctype_byname::do_tolower(char_type* low, const char_type* high) const { for (; low != high; ++low) - *low = tolower_l(*low, __l); + *low = static_cast(tolower_l(*low, __l)); return low; } @@ -1052,18 +1128,19 @@ ctype_byname::do_is(mask m, char_type c) const #ifdef _LIBCPP_WCTYPE_IS_MASK return static_cast(iswctype_l(c, m, __l)); #else - // FIXME: This is broken for things that test more than one flag. - if (m & space && !iswspace_l(c, __l)) return false; - if (m & print && !iswprint_l(c, __l)) return false; - if (m & cntrl && !iswcntrl_l(c, __l)) return false; - if (m & upper && !iswupper_l(c, __l)) return false; - if (m & lower && !iswlower_l(c, __l)) return false; - if (m & alpha && !iswalpha_l(c, __l)) return false; - if (m & digit && !iswdigit_l(c, __l)) return false; - if (m & punct && !iswpunct_l(c, __l)) return false; - if (m & xdigit && !iswxdigit_l(c, __l)) return false; - if (m & blank && !iswblank_l(c, __l)) return false; - return true; + bool result = false; + wint_t ch = static_cast(c); + if (m & space) result |= (iswspace_l(ch, __l) != 0); + if (m & print) result |= (iswprint_l(ch, __l) != 0); + if (m & cntrl) result |= (iswcntrl_l(ch, __l) != 0); + if (m & upper) result |= (iswupper_l(ch, __l) != 0); + if (m & lower) result |= (iswlower_l(ch, __l) != 0); + if (m & alpha) result |= (iswalpha_l(ch, __l) != 0); + if (m & digit) result |= (iswdigit_l(ch, __l) != 0); + if (m & punct) result |= (iswpunct_l(ch, __l) != 0); + if (m & xdigit) result |= (iswxdigit_l(ch, __l) != 0); + if (m & blank) result |= (iswblank_l(ch, __l) != 0); + return result; #endif } @@ -1077,23 +1154,24 @@ ctype_byname::do_is(const char_type* low, const char_type* high, mask* else { *vec = 0; - if (iswspace_l(*low, __l)) + wint_t ch = static_cast(*low); + if (iswspace_l(ch, __l)) *vec |= space; - if (iswprint_l(*low, __l)) + if (iswprint_l(ch, __l)) *vec |= print; - if (iswcntrl_l(*low, __l)) + if (iswcntrl_l(ch, __l)) *vec |= cntrl; - if (iswupper_l(*low, __l)) + if (iswupper_l(ch, __l)) *vec |= upper; - if (iswlower_l(*low, __l)) + if (iswlower_l(ch, __l)) *vec |= lower; - if (iswalpha_l(*low, __l)) + if (iswalpha_l(ch, __l)) *vec |= alpha; - if (iswdigit_l(*low, __l)) + if (iswdigit_l(ch, __l)) *vec |= digit; - if (iswpunct_l(*low, __l)) + if (iswpunct_l(ch, __l)) *vec |= punct; - if (iswxdigit_l(*low, __l)) + if (iswxdigit_l(ch, __l)) *vec |= xdigit; } } @@ -1109,17 +1187,17 @@ 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; + wint_t ch = static_cast(*low); + if (m & space && iswspace_l(ch, __l)) break; + if (m & print && iswprint_l(ch, __l)) break; + if (m & cntrl && iswcntrl_l(ch, __l)) break; + if (m & upper && iswupper_l(ch, __l)) break; + if (m & lower && iswlower_l(ch, __l)) break; + if (m & alpha && iswalpha_l(ch, __l)) break; + if (m & digit && iswdigit_l(ch, __l)) break; + if (m & punct && iswpunct_l(ch, __l)) break; + if (m & xdigit && iswxdigit_l(ch, __l)) break; + if (m & blank && iswblank_l(ch, __l)) break; #endif } return low; @@ -1134,16 +1212,17 @@ ctype_byname::do_scan_not(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; + wint_t ch = static_cast(*low); + if (m & space && iswspace_l(ch, __l)) continue; + if (m & print && iswprint_l(ch, __l)) continue; + if (m & cntrl && iswcntrl_l(ch, __l)) continue; + if (m & upper && iswupper_l(ch, __l)) continue; + if (m & lower && iswlower_l(ch, __l)) continue; + if (m & alpha && iswalpha_l(ch, __l)) continue; + if (m & digit && iswdigit_l(ch, __l)) continue; + if (m & punct && iswpunct_l(ch, __l)) continue; + if (m & xdigit && iswxdigit_l(ch, __l)) continue; + if (m & blank && iswblank_l(ch, __l)) continue; break; #endif } @@ -1181,7 +1260,7 @@ ctype_byname::do_tolower(char_type* low, const char_type* high) const wchar_t ctype_byname::do_widen(char c) const { -#ifdef _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS return btowc_l(c, __l); #else return __btowc_l(c, __l); @@ -1192,7 +1271,7 @@ const char* ctype_byname::do_widen(const char* low, const char* high, char_type* dest) const { for (; low != high; ++low, ++dest) -#ifdef _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS *dest = btowc_l(*low, __l); #else *dest = __btowc_l(*low, __l); @@ -1203,12 +1282,12 @@ ctype_byname::do_widen(const char* low, const char* high, char_type* de char ctype_byname::do_narrow(char_type c, char dfault) const { -#ifdef _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS int r = wctob_l(c, __l); #else int r = __wctob_l(c, __l); #endif - return r != WEOF ? static_cast(r) : dfault; + return r != static_cast(WEOF) ? static_cast(r) : dfault; } const wchar_t* @@ -1216,12 +1295,12 @@ ctype_byname::do_narrow(const char_type* low, const char_type* high, ch { for (; low != high; ++low, ++dest) { -#ifdef _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS int r = wctob_l(*low, __l); #else int r = __wctob_l(*low, __l); #endif - *dest = r != WEOF ? static_cast(r) : dfault; + *dest = r != static_cast(WEOF) ? static_cast(r) : dfault; } return low; } @@ -1278,7 +1357,7 @@ int codecvt::do_length(state_type&, const extern_type* frm, const extern_type* end, size_t mx) const { - return static_cast(min(mx, end-frm)); + return static_cast(min(mx, static_cast(end-frm))); } int @@ -1330,8 +1409,9 @@ codecvt::do_out(state_type& st, { // save state in case needed to reover to_nxt on error mbstate_t save_state = st; -#ifdef _LIBCPP_STABLE_APPLE_ABI - size_t n = wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + size_t n = wcsnrtombs_l(to, &frm_nxt, static_cast(fend-frm), + static_cast(to_end-to), &st, __l); #else size_t n = __wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l); #endif @@ -1340,7 +1420,7 @@ codecvt::do_out(state_type& st, // need to recover to_nxt for (to_nxt = to; frm != frm_nxt; ++frm) { -#ifdef _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS n = wcrtomb_l(to_nxt, *frm, &save_state, __l); #else n = __wcrtomb_l(to_nxt, *frm, &save_state, __l); @@ -1361,14 +1441,14 @@ codecvt::do_out(state_type& st, { // Try to write the terminating null extern_type tmp[MB_LEN_MAX]; -#ifdef _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS n = wcrtomb_l(tmp, intern_type(), &st, __l); #else n = __wcrtomb_l(tmp, intern_type(), &st, __l); #endif if (n == size_t(-1)) // on error return error; - if (n > to_end-to_nxt) // is there room? + if (n > static_cast(to_end-to_nxt)) // is there room? return partial; for (extern_type* p = tmp; n; --n) // write it *to_nxt++ = *p++; @@ -1398,8 +1478,9 @@ codecvt::do_in(state_type& st, { // save state in case needed to reover to_nxt on error mbstate_t save_state = st; -#ifdef _LIBCPP_STABLE_APPLE_ABI - size_t n = mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + size_t n = mbsnrtowcs_l(to, &frm_nxt, static_cast(fend-frm), + static_cast(to_end-to), &st, __l); #else size_t n = __mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l); #endif @@ -1408,8 +1489,9 @@ codecvt::do_in(state_type& st, // need to recover to_nxt for (to_nxt = to; frm != frm_nxt; ++to_nxt) { -#ifdef _LIBCPP_STABLE_APPLE_ABI - n = mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + n = mbrtowc_l(to_nxt, frm, static_cast(fend-frm), + &save_state, __l); #else n = __mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l); #endif @@ -1418,10 +1500,10 @@ codecvt::do_in(state_type& st, case 0: ++frm; break; - case static_cast(-1): // XXX EMSCRIPTEN + case size_t(-1): frm_nxt = frm; return error; - case static_cast(-2): // XXX EMSCRIPTEN + case size_t(-2): frm_nxt = frm; return partial; default: @@ -1440,7 +1522,7 @@ codecvt::do_in(state_type& st, if (fend != frm_end) // set up next null terminated sequence { // Try to write the terminating null -#ifdef _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS n = mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l); #else n = __mbrtowc_l(to_nxt, frm_nxt, 1, &st, __l); @@ -1464,7 +1546,7 @@ codecvt::do_unshift(state_type& st, { to_nxt = to; extern_type tmp[MB_LEN_MAX]; -#ifdef _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS size_t n = wcrtomb_l(tmp, intern_type(), &st, __l); #else size_t n = __wcrtomb_l(tmp, intern_type(), &st, __l); @@ -1472,7 +1554,7 @@ codecvt::do_unshift(state_type& st, if (n == size_t(-1) || n == 0) // on error return error; --n; - if (n > to_end-to_nxt) // is there room? + if (n > static_cast(to_end-to_nxt)) // is there room? return partial; for (extern_type* p = tmp; n; --n) // write it *to_nxt++ = *p++; @@ -1482,14 +1564,14 @@ codecvt::do_unshift(state_type& st, int codecvt::do_encoding() const _NOEXCEPT { -#ifdef _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS if (mbtowc_l((wchar_t*) 0, (const char*) 0, MB_LEN_MAX, __l) == 0) #else if (__mbtowc_l((wchar_t*) 0, (const char*) 0, MB_LEN_MAX, __l) == 0) #endif { // stateless encoding -#ifdef _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS if (__l == 0 || MB_CUR_MAX_L(__l) == 1) // there are no known constant length encodings #else if (__l == 0 || __mb_cur_max_l(__l) == 1) // there are no known constant length encodings @@ -1513,8 +1595,8 @@ codecvt::do_length(state_type& st, int nbytes = 0; for (size_t nwchar_t = 0; nwchar_t < mx && frm != frm_end; ++nwchar_t) { -#ifdef _LIBCPP_STABLE_APPLE_ABI - size_t n = mbrlen_l(frm, frm_end-frm, &st, __l); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + size_t n = mbrlen_l(frm, static_cast(frm_end-frm), &st, __l); #else size_t n = __mbrlen_l(frm, frm_end-frm, &st, __l); #endif @@ -1524,8 +1606,8 @@ codecvt::do_length(state_type& st, ++nbytes; ++frm; break; - case static_cast(-1): // XXX EMSCRIPTEN - case static_cast(-2): // XXX EMSCRIPTEN + case size_t(-1): + case size_t(-2): return nbytes; default: nbytes += n; @@ -1539,10 +1621,10 @@ codecvt::do_length(state_type& st, int codecvt::do_max_length() const _NOEXCEPT { -#ifdef _LIBCPP_STABLE_APPLE_ABI - return __l == 0 ? 1 : MB_CUR_MAX_L(__l); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + return __l == 0 ? 1 : static_cast( MB_CUR_MAX_L(__l)); #else - return __l == 0 ? 1 : __mb_cur_max_l(__l); + return __l == 0 ? 1 : static_cast(__mb_cur_max_l(__l)); #endif } @@ -1997,9 +2079,6 @@ utf8_to_utf16_length(const uint8_t* frm, const uint8_t* frm_end, break; uint8_t c2 = frm_nxt[1]; uint8_t c3 = frm_nxt[2]; - uint16_t t = static_cast(((c1 & 0x0F) << 12) - | ((c2 & 0x3F) << 6) - | (c3 & 0x3F)); switch (c1) { case 0xE0: @@ -2017,7 +2096,7 @@ utf8_to_utf16_length(const uint8_t* frm, const uint8_t* frm_end, } if ((c3 & 0xC0) != 0x80) break; - if ((((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F)) > Maxcode) + if ((((c1 & 0x0Fu) << 12) | ((c2 & 0x3Fu) << 6) | (c3 & 0x3Fu)) > Maxcode) break; frm_nxt += 3; } @@ -2259,7 +2338,7 @@ utf8_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end, { if ((frm_end-frm_nxt < 2) || ((frm_nxt[1] & 0xC0) != 0x80)) break; - if ((((c1 & 0x1F) << 6) | (frm_nxt[1] & 0x3F)) > Maxcode) + if ((((c1 & 0x1Fu) << 6) | (frm_nxt[1] & 0x3Fu)) > Maxcode) break; frm_nxt += 2; } @@ -2286,7 +2365,7 @@ utf8_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end, } if ((c3 & 0xC0) != 0x80) break; - if ((((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F)) > Maxcode) + if ((((c1 & 0x0Fu) << 12) | ((c2 & 0x3Fu) << 6) | (c3 & 0x3Fu)) > Maxcode) break; frm_nxt += 3; } @@ -2314,12 +2393,8 @@ utf8_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end, } if ((c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80) break; - uint32_t t = static_cast(((c1 & 0x07) << 18) - | ((c2 & 0x3F) << 12) - | ((c3 & 0x3F) << 6) - | (c4 & 0x3F)); - if ((((c1 & 0x07) << 18) | ((c2 & 0x3F) << 12) | - ((c3 & 0x3F) << 6) | (c4 & 0x3F)) > Maxcode) + if ((((c1 & 0x07u) << 18) | ((c2 & 0x3Fu) << 12) | + ((c3 & 0x3Fu) << 6) | (c4 & 0x3Fu)) > Maxcode) break; frm_nxt += 4; } @@ -2488,7 +2563,7 @@ utf8_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end, { if ((frm_end-frm_nxt < 2) || ((frm_nxt[1] & 0xC0) != 0x80)) break; - if ((((c1 & 0x1F) << 6) | (frm_nxt[1] & 0x3F)) > Maxcode) + if ((((c1 & 0x1Fu) << 6) | (frm_nxt[1] & 0x3Fu)) > Maxcode) break; frm_nxt += 2; } @@ -2515,7 +2590,7 @@ utf8_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end, } if ((c3 & 0xC0) != 0x80) break; - if ((((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F)) > Maxcode) + if ((((c1 & 0x0Fu) << 12) | ((c2 & 0x3Fu) << 6) | (c3 & 0x3Fu)) > Maxcode) break; frm_nxt += 3; } @@ -2587,7 +2662,7 @@ utf16be_to_ucs4(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_ } for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) { - uint16_t c1 = frm_nxt[0] << 8 | frm_nxt[1]; + uint16_t c1 = static_cast(frm_nxt[0] << 8 | frm_nxt[1]); if ((c1 & 0xFC00) == 0xDC00) return codecvt_base::error; if ((c1 & 0xFC00) != 0xD800) @@ -2601,7 +2676,7 @@ utf16be_to_ucs4(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_ { if (frm_end-frm_nxt < 4) return codecvt_base::partial; - uint16_t c2 = frm_nxt[2] << 8 | frm_nxt[3]; + uint16_t c2 = static_cast(frm_nxt[2] << 8 | frm_nxt[3]); if ((c2 & 0xFC00) != 0xDC00) return codecvt_base::error; uint32_t t = static_cast( @@ -2624,7 +2699,6 @@ utf16be_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end, codecvt_mode mode = codecvt_mode(0)) { const uint8_t* frm_nxt = frm; - frm_nxt = frm; if (mode & consume_header) { if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFE && frm_nxt[1] == 0xFF) @@ -2632,7 +2706,7 @@ utf16be_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end, } for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t) { - uint16_t c1 = frm_nxt[0] << 8 | frm_nxt[1]; + uint16_t c1 = static_cast(frm_nxt[0] << 8 | frm_nxt[1]); if ((c1 & 0xFC00) == 0xDC00) break; if ((c1 & 0xFC00) != 0xD800) @@ -2645,7 +2719,7 @@ utf16be_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end, { if (frm_end-frm_nxt < 4) break; - uint16_t c2 = frm_nxt[2] << 8 | frm_nxt[3]; + uint16_t c2 = static_cast(frm_nxt[2] << 8 | frm_nxt[3]); if ((c2 & 0xFC00) != 0xDC00) break; uint32_t t = static_cast( @@ -2720,7 +2794,7 @@ utf16le_to_ucs4(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_ } for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) { - uint16_t c1 = frm_nxt[1] << 8 | frm_nxt[0]; + uint16_t c1 = static_cast(frm_nxt[1] << 8 | frm_nxt[0]); if ((c1 & 0xFC00) == 0xDC00) return codecvt_base::error; if ((c1 & 0xFC00) != 0xD800) @@ -2734,7 +2808,7 @@ utf16le_to_ucs4(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_ { if (frm_end-frm_nxt < 4) return codecvt_base::partial; - uint16_t c2 = frm_nxt[3] << 8 | frm_nxt[2]; + uint16_t c2 = static_cast(frm_nxt[3] << 8 | frm_nxt[2]); if ((c2 & 0xFC00) != 0xDC00) return codecvt_base::error; uint32_t t = static_cast( @@ -2757,7 +2831,6 @@ utf16le_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end, codecvt_mode mode = codecvt_mode(0)) { const uint8_t* frm_nxt = frm; - frm_nxt = frm; if (mode & consume_header) { if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFF && frm_nxt[1] == 0xFE) @@ -2765,7 +2838,7 @@ utf16le_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end, } for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t) { - uint16_t c1 = frm_nxt[1] << 8 | frm_nxt[0]; + uint16_t c1 = static_cast(frm_nxt[1] << 8 | frm_nxt[0]); if ((c1 & 0xFC00) == 0xDC00) break; if ((c1 & 0xFC00) != 0xD800) @@ -2778,7 +2851,7 @@ utf16le_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end, { if (frm_end-frm_nxt < 4) break; - uint16_t c2 = frm_nxt[3] << 8 | frm_nxt[2]; + uint16_t c2 = static_cast(frm_nxt[3] << 8 | frm_nxt[2]); if ((c2 & 0xFC00) != 0xDC00) break; uint32_t t = static_cast( @@ -2836,7 +2909,7 @@ utf16be_to_ucs2(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_ } for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) { - uint16_t c1 = frm_nxt[0] << 8 | frm_nxt[1]; + uint16_t c1 = static_cast(frm_nxt[0] << 8 | frm_nxt[1]); if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode) return codecvt_base::error; *to_nxt = c1; @@ -2852,7 +2925,6 @@ utf16be_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end, codecvt_mode mode = codecvt_mode(0)) { const uint8_t* frm_nxt = frm; - frm_nxt = frm; if (mode & consume_header) { if (frm_end-frm_nxt >= 2 && frm_nxt[0] == 0xFE && frm_nxt[1] == 0xFF) @@ -2860,7 +2932,7 @@ utf16be_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end, } for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t) { - uint16_t c1 = frm_nxt[0] << 8 | frm_nxt[1]; + uint16_t c1 = static_cast(frm_nxt[0] << 8 | frm_nxt[1]); if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode) break; frm_nxt += 2; @@ -2911,7 +2983,7 @@ utf16le_to_ucs2(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_ } for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) { - uint16_t c1 = frm_nxt[1] << 8 | frm_nxt[0]; + uint16_t c1 = static_cast(frm_nxt[1] << 8 | frm_nxt[0]); if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode) return codecvt_base::error; *to_nxt = c1; @@ -2935,7 +3007,7 @@ utf16le_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end, } for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t) { - uint16_t c1 = frm_nxt[1] << 8 | frm_nxt[0]; + uint16_t c1 = static_cast(frm_nxt[1] << 8 | frm_nxt[0]); if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode) break; frm_nxt += 2; @@ -4088,11 +4160,11 @@ numpunct_byname::__init(const char* nm) { __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); #ifndef _LIBCPP_NO_EXCEPTIONS - if (loc == 0) + if (loc == nullptr) throw runtime_error("numpunct_byname::numpunct_byname" " failed to construct for " + string(nm)); #endif // _LIBCPP_NO_EXCEPTIONS -#ifdef _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS lconv* lc = localeconv_l(loc.get()); #else lconv* lc = __localeconv_l(loc.get()); @@ -4131,11 +4203,11 @@ numpunct_byname::__init(const char* nm) { __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); #ifndef _LIBCPP_NO_EXCEPTIONS - if (loc == 0) + if (loc == nullptr) throw runtime_error("numpunct_byname::numpunct_byname" " failed to construct for " + string(nm)); #endif // _LIBCPP_NO_EXCEPTIONS -#ifdef _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS lconv* lc = localeconv_l(loc.get()); #else lconv* lc = __localeconv_l(loc.get()); @@ -4179,7 +4251,7 @@ __check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end, { if (0 < *__ig && *__ig < numeric_limits::max()) { - if (*__ig != *__r) + if (static_cast(*__ig) != *__r) { __err = ios_base::failbit; return; @@ -4190,7 +4262,7 @@ __check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end, } if (0 < *__ig && *__ig < numeric_limits::max()) { - if (*__ig < __g_end[-1] || __g_end[-1] == 0) + if (static_cast(*__ig) < __g_end[-1] || __g_end[-1] == 0) __err = ios_base::failbit; } } @@ -4563,11 +4635,14 @@ __time_get::~__time_get() freelocale(__loc_); } +#pragma clang diagnostic ignored "-Wmissing-field-initializers" +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" + template <> string __time_get_storage::__analyze(char fmt, const ctype& ct) { - tm t; + tm t = {0}; t.tm_sec = 59; t.tm_min = 55; t.tm_hour = 23; @@ -4581,7 +4656,7 @@ __time_get_storage::__analyze(char fmt, const ctype& ct) char f[3] = {0}; f[0] = '%'; f[1] = fmt; - size_t n = strftime_l(buf, 100, f, &t, __loc_); + size_t n = strftime_l(buf, countof(buf), f, &t, __loc_); char* bb = buf; char* be = buf + n; string result; @@ -4596,7 +4671,7 @@ __time_get_storage::__analyze(char fmt, const ctype& ct) } char* w = bb; ios_base::iostate err = ios_base::goodbit; - int i = __scan_keyword(w, be, this->__weeks_, this->__weeks_+14, + ptrdiff_t i = __scan_keyword(w, be, this->__weeks_, this->__weeks_+14, ct, err, false) - this->__weeks_; if (i < 14) @@ -4707,11 +4782,13 @@ __time_get_storage::__analyze(char fmt, const ctype& ct) return result; } +#pragma clang diagnostic ignored "-Wmissing-braces" + template <> wstring __time_get_storage::__analyze(char fmt, const ctype& ct) { - tm t; + tm t = {0}; t.tm_sec = 59; t.tm_min = 55; t.tm_hour = 23; @@ -4725,19 +4802,19 @@ __time_get_storage::__analyze(char fmt, const ctype& ct) char f[3] = {0}; f[0] = '%'; f[1] = fmt; - size_t be = strftime_l(buf, 100, f, &t, __loc_); + strftime_l(buf, countof(buf), f, &t, __loc_); wchar_t wbuf[100]; wchar_t* wbb = wbuf; mbstate_t mb = {0}; const char* bb = buf; -#ifdef _LIBCPP_STABLE_APPLE_ABI - size_t i = mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + size_t j = mbsrtowcs_l( wbb, &bb, countof(wbuf), &mb, __loc_); #else - size_t i = __mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); + size_t j = __mbsrtowcs_l( wbb, &bb, countof(wbuf), &mb, __loc_); #endif - if (i == -1) + if (j == size_t(-1)) __throw_runtime_error("locale not supported"); - wchar_t* wbe = wbb + i; + wchar_t* wbe = wbb + j; wstring result; while (wbb != wbe) { @@ -4750,7 +4827,7 @@ __time_get_storage::__analyze(char fmt, const ctype& ct) } wchar_t* w = wbb; ios_base::iostate err = ios_base::goodbit; - int i = __scan_keyword(w, wbe, this->__weeks_, this->__weeks_+14, + ptrdiff_t i = __scan_keyword(w, wbe, this->__weeks_, this->__weeks_+14, ct, err, false) - this->__weeks_; if (i < 14) @@ -4865,32 +4942,32 @@ 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) { t.tm_wday = i; - strftime_l(buf, 100, "%A", &t, __loc_); + strftime_l(buf, countof(buf), "%A", &t, __loc_); __weeks_[i] = buf; - strftime_l(buf, 100, "%a", &t, __loc_); + strftime_l(buf, countof(buf), "%a", &t, __loc_); __weeks_[i+7] = buf; } // __months_ for (int i = 0; i < 12; ++i) { t.tm_mon = i; - strftime_l(buf, 100, "%B", &t, __loc_); + strftime_l(buf, countof(buf), "%B", &t, __loc_); __months_[i] = buf; - strftime_l(buf, 100, "%b", &t, __loc_); + strftime_l(buf, countof(buf), "%b", &t, __loc_); __months_[i+12] = buf; } // __am_pm_ t.tm_hour = 1; - strftime_l(buf, 100, "%p", &t, __loc_); + strftime_l(buf, countof(buf), "%p", &t, __loc_); __am_pm_[0] = buf; t.tm_hour = 13; - strftime_l(buf, 100, "%p", &t, __loc_); + strftime_l(buf, countof(buf), "%p", &t, __loc_); __am_pm_[1] = buf; __c_ = __analyze('c', ct); __r_ = __analyze('r', ct); @@ -4904,7 +4981,6 @@ __time_get_storage::init(const ctype& ct) { tm t = {0}; char buf[100]; - size_t be; wchar_t wbuf[100]; wchar_t* wbe; mbstate_t mb = {0}; @@ -4912,27 +4988,27 @@ __time_get_storage::init(const ctype& ct) for (int i = 0; i < 7; ++i) { t.tm_wday = i; - be = strftime_l(buf, 100, "%A", &t, __loc_); + strftime_l(buf, countof(buf), "%A", &t, __loc_); mb = mbstate_t(); const char* bb = buf; -#ifdef _LIBCPP_STABLE_APPLE_ABI - size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + size_t j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); #else - size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); + size_t j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); #endif - if (j == -1) + if (j == size_t(-1)) __throw_runtime_error("locale not supported"); wbe = wbuf + j; __weeks_[i].assign(wbuf, wbe); - be = strftime_l(buf, 100, "%a", &t, __loc_); + strftime_l(buf, countof(buf), "%a", &t, __loc_); mb = mbstate_t(); bb = buf; -#ifdef _LIBCPP_STABLE_APPLE_ABI - j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); #else - j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); + j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); #endif - if (j == -1) + if (j == size_t(-1)) __throw_runtime_error("locale not supported"); wbe = wbuf + j; __weeks_[i+7].assign(wbuf, wbe); @@ -4941,55 +5017,55 @@ __time_get_storage::init(const ctype& ct) for (int i = 0; i < 12; ++i) { t.tm_mon = i; - be = strftime_l(buf, 100, "%B", &t, __loc_); + strftime_l(buf, countof(buf), "%B", &t, __loc_); mb = mbstate_t(); const char* bb = buf; -#ifdef _LIBCPP_STABLE_APPLE_ABI - size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + size_t j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); #else - size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); + size_t j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); #endif - if (j == -1) + if (j == size_t(-1)) __throw_runtime_error("locale not supported"); wbe = wbuf + j; __months_[i].assign(wbuf, wbe); - be = strftime_l(buf, 100, "%b", &t, __loc_); + strftime_l(buf, countof(buf), "%b", &t, __loc_); mb = mbstate_t(); bb = buf; -#ifdef _LIBCPP_STABLE_APPLE_ABI - j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); #else - j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); + j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); #endif - if (j == -1) + if (j == size_t(-1)) __throw_runtime_error("locale not supported"); wbe = wbuf + j; __months_[i+12].assign(wbuf, wbe); } // __am_pm_ t.tm_hour = 1; - be = strftime_l(buf, 100, "%p", &t, __loc_); + strftime_l(buf, countof(buf), "%p", &t, __loc_); mb = mbstate_t(); const char* bb = buf; -#ifdef _LIBCPP_STABLE_APPLE_ABI - size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + size_t j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); #else - size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); + size_t j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); #endif - if (j == -1) + if (j == size_t(-1)) __throw_runtime_error("locale not supported"); wbe = wbuf + j; __am_pm_[0].assign(wbuf, wbe); t.tm_hour = 13; - be = strftime_l(buf, 100, "%p", &t, __loc_); + strftime_l(buf, countof(buf), "%p", &t, __loc_); mb = mbstate_t(); bb = buf; -#ifdef _LIBCPP_STABLE_APPLE_ABI - j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); #else - j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); + j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); #endif - if (j == -1) + if (j == size_t(-1)) __throw_runtime_error("locale not supported"); wbe = wbuf + j; __am_pm_[1].assign(wbuf, wbe); @@ -5250,7 +5326,7 @@ __time_put::__do_put(char* __nb, char*& __ne, const tm* __tm, char fmt[] = {'%', __fmt, __mod, 0}; if (__mod != 0) swap(fmt[1], fmt[2]); - size_t n = strftime_l(__nb, __ne-__nb, fmt, __tm, __loc_); + size_t n = strftime_l(__nb, countof(__nb, __ne), fmt, __tm, __loc_); __ne = __nb + n; } @@ -5263,128 +5339,212 @@ __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, __do_put(__nar, __ne, __tm, __fmt, __mod); mbstate_t mb = {0}; const char* __nb = __nar; -#ifdef _LIBCPP_STABLE_APPLE_ABI - size_t j = mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + size_t j = mbsrtowcs_l(__wb, &__nb, countof(__wb, __we), &mb, __loc_); #else - size_t j = __mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_); + size_t j = __mbsrtowcs_l(__wb, &__nb, countof(__wb, __we), &mb, __loc_); #endif - if (j == -1) + if (j == size_t(-1)) __throw_runtime_error("locale not supported"); __we = __wb + j; } // moneypunct_byname +template static void -__init_pat(money_base::pattern& pat, char cs_precedes, char sep_by_space, char sign_posn) +__init_pat(money_base::pattern& pat, basic_string& __curr_symbol_, + bool intl, char cs_precedes, char sep_by_space, char sign_posn, + charT space_char) { const char sign = static_cast(money_base::sign); const char space = static_cast(money_base::space); const char none = static_cast(money_base::none); const char symbol = static_cast(money_base::symbol); const char value = static_cast(money_base::value); + const bool symbol_contains_sep = intl && __curr_symbol_.size() == 4; + + // Comments on case branches reflect 'C11 7.11.2.1 The localeconv + // function'. "Space between sign and symbol or value" means that + // if the sign is adjacent to the symbol, there's a space between + // them, and otherwise there's a space between the sign and value. + // + // C11's localeconv specifies that the fourth character of an + // international curr_symbol is used to separate the sign and + // value when sep_by_space says to do so. C++ can't represent + // that, so we just use a space. When sep_by_space says to + // separate the symbol and value-or-sign with a space, we rearrange the + // curr_symbol to put its spacing character on the correct side of + // the symbol. + // + // We also need to avoid adding an extra space between the sign + // and value when the currency symbol is suppressed (by not + // setting showbase). We match glibc's strfmon by interpreting + // sep_by_space==1 as "omit the space when the currency symbol is + // absent". + // + // Users who want to get this right should use ICU instead. + switch (cs_precedes) { - case 0: + case 0: // value before curr_symbol + if (symbol_contains_sep) { + // Move the separator to before the symbol, to place it + // between the value and symbol. + rotate(__curr_symbol_.begin(), __curr_symbol_.begin() + 3, + __curr_symbol_.end()); + } switch (sign_posn) { - case 0: + case 0: // Parentheses surround the quantity and currency symbol. pat.field[0] = sign; pat.field[1] = value; + pat.field[2] = none; // Any space appears in the symbol. pat.field[3] = symbol; switch (sep_by_space) { - case 0: - pat.field[2] = none; + case 0: // No space separates the currency symbol and value. + // This case may have changed between C99 and C11; + // assume the currency symbol matches the intention. + case 2: // Space between sign and currency or value. + // The "sign" is two parentheses, so no space here either. return; - case 1: - case 2: - pat.field[2] = space; + case 1: // Space between currency-and-sign or currency and value. + if (!symbol_contains_sep) { + // We insert the space into the symbol instead of + // setting pat.field[2]=space so that when + // showbase is not set, the space goes away too. + __curr_symbol_.insert(0, 1, space_char); + } return; default: break; } break; - case 1: + case 1: // The sign string precedes the quantity and currency symbol. pat.field[0] = sign; pat.field[3] = symbol; switch (sep_by_space) { - case 0: + case 0: // No space separates the currency symbol and value. pat.field[1] = value; pat.field[2] = none; return; - case 1: + case 1: // Space between currency-and-sign or currency and value. pat.field[1] = value; - pat.field[2] = space; + pat.field[2] = none; + if (!symbol_contains_sep) { + // We insert the space into the symbol instead of + // setting pat.field[2]=space so that when + // showbase is not set, the space goes away too. + __curr_symbol_.insert(0, 1, space_char); + } return; - case 2: + case 2: // Space between sign and currency or value. pat.field[1] = space; pat.field[2] = value; + if (symbol_contains_sep) { + // Remove the separator from the symbol, since it + // has already appeared after the sign. + __curr_symbol_.erase(__curr_symbol_.begin()); + } return; default: break; } break; - case 2: + case 2: // The sign string succeeds the quantity and currency symbol. pat.field[0] = value; pat.field[3] = sign; switch (sep_by_space) { - case 0: + case 0: // No space separates the currency symbol and value. pat.field[1] = none; pat.field[2] = symbol; return; - case 1: - pat.field[1] = space; + case 1: // Space between currency-and-sign or currency and value. + if (!symbol_contains_sep) { + // We insert the space into the symbol instead of + // setting pat.field[1]=space so that when + // showbase is not set, the space goes away too. + __curr_symbol_.insert(0, 1, space_char); + } + pat.field[1] = none; pat.field[2] = symbol; return; - case 2: + case 2: // Space between sign and currency or value. pat.field[1] = symbol; pat.field[2] = space; + if (symbol_contains_sep) { + // Remove the separator from the symbol, since it + // should not be removed if showbase is absent. + __curr_symbol_.erase(__curr_symbol_.begin()); + } return; default: break; } break; - case 3: + case 3: // The sign string immediately precedes the currency symbol. pat.field[0] = value; pat.field[3] = symbol; switch (sep_by_space) { - case 0: + case 0: // No space separates the currency symbol and value. pat.field[1] = none; pat.field[2] = sign; return; - case 1: + case 1: // Space between currency-and-sign or currency and value. pat.field[1] = space; pat.field[2] = sign; + if (symbol_contains_sep) { + // Remove the separator from the symbol, since it + // has already appeared before the sign. + __curr_symbol_.erase(__curr_symbol_.begin()); + } return; - case 2: + case 2: // Space between sign and currency or value. pat.field[1] = sign; - pat.field[2] = space; + pat.field[2] = none; + if (!symbol_contains_sep) { + // We insert the space into the symbol instead of + // setting pat.field[2]=space so that when + // showbase is not set, the space goes away too. + __curr_symbol_.insert(0, 1, space_char); + } return; default: break; } break; - case 4: + case 4: // The sign string immediately succeeds the currency symbol. pat.field[0] = value; pat.field[3] = sign; switch (sep_by_space) { - case 0: + case 0: // No space separates the currency symbol and value. pat.field[1] = none; pat.field[2] = symbol; return; - case 1: - pat.field[1] = space; + case 1: // Space between currency-and-sign or currency and value. + pat.field[1] = none; pat.field[2] = symbol; + if (!symbol_contains_sep) { + // We insert the space into the symbol instead of + // setting pat.field[1]=space so that when + // showbase is not set, the space goes away too. + __curr_symbol_.insert(0, 1, space_char); + } return; - case 2: + case 2: // Space between sign and currency or value. pat.field[1] = symbol; pat.field[2] = space; + if (symbol_contains_sep) { + // Remove the separator from the symbol, since it + // should not disappear when showbase is absent. + __curr_symbol_.erase(__curr_symbol_.begin()); + } return; default: break; @@ -5394,105 +5554,157 @@ __init_pat(money_base::pattern& pat, char cs_precedes, char sep_by_space, char s break; } break; - case 1: + case 1: // curr_symbol before value switch (sign_posn) { - case 0: + case 0: // Parentheses surround the quantity and currency symbol. pat.field[0] = sign; pat.field[1] = symbol; + pat.field[2] = none; // Any space appears in the symbol. pat.field[3] = value; switch (sep_by_space) { - case 0: - pat.field[2] = none; + case 0: // No space separates the currency symbol and value. + // This case may have changed between C99 and C11; + // assume the currency symbol matches the intention. + case 2: // Space between sign and currency or value. + // The "sign" is two parentheses, so no space here either. return; - case 1: - case 2: - pat.field[2] = space; + case 1: // Space between currency-and-sign or currency and value. + if (!symbol_contains_sep) { + // We insert the space into the symbol instead of + // setting pat.field[2]=space so that when + // showbase is not set, the space goes away too. + __curr_symbol_.insert(0, 1, space_char); + } return; default: break; } break; - case 1: + case 1: // The sign string precedes the quantity and currency symbol. pat.field[0] = sign; pat.field[3] = value; switch (sep_by_space) { - case 0: + case 0: // No space separates the currency symbol and value. pat.field[1] = symbol; pat.field[2] = none; return; - case 1: + case 1: // Space between currency-and-sign or currency and value. pat.field[1] = symbol; - pat.field[2] = space; + pat.field[2] = none; + if (!symbol_contains_sep) { + // We insert the space into the symbol instead of + // setting pat.field[2]=space so that when + // showbase is not set, the space goes away too. + __curr_symbol_.push_back(space_char); + } return; - case 2: + case 2: // Space between sign and currency or value. pat.field[1] = space; pat.field[2] = symbol; + if (symbol_contains_sep) { + // Remove the separator from the symbol, since it + // has already appeared after the sign. + __curr_symbol_.pop_back(); + } return; default: break; } break; - case 2: + case 2: // The sign string succeeds the quantity and currency symbol. pat.field[0] = symbol; pat.field[3] = sign; switch (sep_by_space) { - case 0: + case 0: // No space separates the currency symbol and value. pat.field[1] = none; pat.field[2] = value; return; - case 1: - pat.field[1] = space; + case 1: // Space between currency-and-sign or currency and value. + pat.field[1] = none; pat.field[2] = value; + if (!symbol_contains_sep) { + // We insert the space into the symbol instead of + // setting pat.field[1]=space so that when + // showbase is not set, the space goes away too. + __curr_symbol_.push_back(space_char); + } return; - case 2: + case 2: // Space between sign and currency or value. pat.field[1] = value; pat.field[2] = space; + if (symbol_contains_sep) { + // Remove the separator from the symbol, since it + // will appear before the sign. + __curr_symbol_.pop_back(); + } return; default: break; } break; - case 3: + case 3: // The sign string immediately precedes the currency symbol. pat.field[0] = sign; pat.field[3] = value; switch (sep_by_space) { - case 0: + case 0: // No space separates the currency symbol and value. pat.field[1] = symbol; pat.field[2] = none; return; - case 1: + case 1: // Space between currency-and-sign or currency and value. pat.field[1] = symbol; - pat.field[2] = space; + pat.field[2] = none; + if (!symbol_contains_sep) { + // We insert the space into the symbol instead of + // setting pat.field[2]=space so that when + // showbase is not set, the space goes away too. + __curr_symbol_.push_back(space_char); + } return; - case 2: + case 2: // Space between sign and currency or value. pat.field[1] = space; pat.field[2] = symbol; + if (symbol_contains_sep) { + // Remove the separator from the symbol, since it + // has already appeared after the sign. + __curr_symbol_.pop_back(); + } return; default: break; } break; - case 4: + case 4: // The sign string immediately succeeds the currency symbol. pat.field[0] = symbol; pat.field[3] = value; switch (sep_by_space) { - case 0: + case 0: // No space separates the currency symbol and value. pat.field[1] = sign; pat.field[2] = none; return; - case 1: + case 1: // Space between currency-and-sign or currency and value. pat.field[1] = sign; pat.field[2] = space; + if (symbol_contains_sep) { + // Remove the separator from the symbol, since it + // should not disappear when showbase is absent. + __curr_symbol_.pop_back(); + } return; - case 2: - pat.field[1] = space; + case 2: // Space between sign and currency or value. + pat.field[1] = none; pat.field[2] = sign; + if (!symbol_contains_sep) { + // We insert the space into the symbol instead of + // setting pat.field[1]=space so that when + // showbase is not set, the space goes away too. + __curr_symbol_.push_back(space_char); + } return; default: break; @@ -5518,11 +5730,11 @@ moneypunct_byname::init(const char* nm) typedef moneypunct base; __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); #ifndef _LIBCPP_NO_EXCEPTIONS - if (loc == 0) + if (loc == nullptr) throw runtime_error("moneypunct_byname" " failed to construct for " + string(nm)); #endif // _LIBCPP_NO_EXCEPTIONS -#ifdef _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS lconv* lc = localeconv_l(loc.get()); #else lconv* lc = __localeconv_l(loc.get()); @@ -5549,8 +5761,14 @@ moneypunct_byname::init(const char* nm) __negative_sign_ = "()"; else __negative_sign_ = lc->negative_sign; - __init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn); - __init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn); + // Assume the positive and negative formats will want spaces in + // the same places in curr_symbol since there's no way to + // represent anything else. + string_type __dummy_curr_symbol = __curr_symbol_; + __init_pat(__pos_format_, __dummy_curr_symbol, false, + lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, ' '); + __init_pat(__neg_format_, __curr_symbol_, false, + lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, ' '); } template<> @@ -5560,11 +5778,11 @@ moneypunct_byname::init(const char* nm) typedef moneypunct base; __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); #ifndef _LIBCPP_NO_EXCEPTIONS - if (loc == 0) + if (loc == nullptr) throw runtime_error("moneypunct_byname" " failed to construct for " + string(nm)); #endif // _LIBCPP_NO_EXCEPTIONS -#ifdef _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS lconv* lc = localeconv_l(loc.get()); #else lconv* lc = __localeconv_l(loc.get()); @@ -5599,12 +5817,22 @@ moneypunct_byname::init(const char* nm) __negative_sign_ = "()"; else __negative_sign_ = lc->negative_sign; + // Assume the positive and negative formats will want spaces in + // the same places in curr_symbol since there's no way to + // represent anything else. + string_type __dummy_curr_symbol = __curr_symbol_; #if _WIN32 - __init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn); - __init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn); + __init_pat(__pos_format_, __dummy_curr_symbol, true, + lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, ' '); + __init_pat(__neg_format_, __curr_symbol_, true, + lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, ' '); #else - __init_pat(__pos_format_, lc->int_p_cs_precedes, lc->int_p_sep_by_space, lc->int_p_sign_posn); - __init_pat(__neg_format_, lc->int_n_cs_precedes, lc->int_n_sep_by_space, lc->int_n_sign_posn); + __init_pat(__pos_format_, __dummy_curr_symbol, true, + lc->int_p_cs_precedes, lc->int_p_sep_by_space, + lc->int_p_sign_posn, ' '); + __init_pat(__neg_format_, __curr_symbol_, true, + lc->int_n_cs_precedes, lc->int_n_sep_by_space, + lc->int_n_sign_posn, ' '); #endif // _WIN32 } @@ -5615,11 +5843,11 @@ moneypunct_byname::init(const char* nm) typedef moneypunct base; __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); #ifndef _LIBCPP_NO_EXCEPTIONS - if (loc == 0) + if (loc == nullptr) throw runtime_error("moneypunct_byname" " failed to construct for " + string(nm)); #endif // _LIBCPP_NO_EXCEPTIONS -#ifdef _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS lconv* lc = localeconv_l(loc.get()); #else lconv* lc = __localeconv_l(loc.get()); @@ -5636,12 +5864,12 @@ moneypunct_byname::init(const char* nm) wchar_t wbuf[100]; mbstate_t mb = {0}; const char* bb = lc->currency_symbol; -#ifdef _LIBCPP_STABLE_APPLE_ABI - size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + size_t j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); #else - size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); + size_t j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); #endif - if (j == -1) + if (j == size_t(-1)) __throw_runtime_error("locale not supported"); wchar_t* wbe = wbuf + j; __curr_symbol_.assign(wbuf, wbe); @@ -5655,12 +5883,12 @@ moneypunct_byname::init(const char* nm) { mb = mbstate_t(); bb = lc->positive_sign; -#ifdef _LIBCPP_STABLE_APPLE_ABI - j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); #else - j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); + j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); #endif - if (j == -1) + if (j == size_t(-1)) __throw_runtime_error("locale not supported"); wbe = wbuf + j; __positive_sign_.assign(wbuf, wbe); @@ -5671,18 +5899,24 @@ moneypunct_byname::init(const char* nm) { mb = mbstate_t(); bb = lc->negative_sign; -#ifdef _LIBCPP_STABLE_APPLE_ABI - j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); #else - j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); + j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); #endif - if (j == -1) + if (j == size_t(-1)) __throw_runtime_error("locale not supported"); wbe = wbuf + j; __negative_sign_.assign(wbuf, wbe); } - __init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn); - __init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn); + // Assume the positive and negative formats will want spaces in + // the same places in curr_symbol since there's no way to + // represent anything else. + string_type __dummy_curr_symbol = __curr_symbol_; + __init_pat(__pos_format_, __dummy_curr_symbol, false, + lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, L' '); + __init_pat(__neg_format_, __curr_symbol_, false, + lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, L' '); } template<> @@ -5692,11 +5926,11 @@ moneypunct_byname::init(const char* nm) typedef moneypunct base; __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); #ifndef _LIBCPP_NO_EXCEPTIONS - if (loc == 0) + if (loc == nullptr) throw runtime_error("moneypunct_byname" " failed to construct for " + string(nm)); #endif // _LIBCPP_NO_EXCEPTIONS -#ifdef _LIBCPP_STABLE_APPLE_ABI +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS lconv* lc = localeconv_l(loc.get()); #else lconv* lc = __localeconv_l(loc.get()); @@ -5713,12 +5947,12 @@ moneypunct_byname::init(const char* nm) wchar_t wbuf[100]; mbstate_t mb = {0}; const char* bb = lc->int_curr_symbol; -#ifdef _LIBCPP_STABLE_APPLE_ABI - size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + size_t j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); #else - size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); + size_t j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); #endif - if (j == -1) + if (j == size_t(-1)) __throw_runtime_error("locale not supported"); wchar_t* wbe = wbuf + j; __curr_symbol_.assign(wbuf, wbe); @@ -5736,12 +5970,12 @@ moneypunct_byname::init(const char* nm) { mb = mbstate_t(); bb = lc->positive_sign; -#ifdef _LIBCPP_STABLE_APPLE_ABI - j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); #else - j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); + j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); #endif - if (j == -1) + if (j == size_t(-1)) __throw_runtime_error("locale not supported"); wbe = wbuf + j; __positive_sign_.assign(wbuf, wbe); @@ -5756,22 +5990,32 @@ moneypunct_byname::init(const char* nm) { mb = mbstate_t(); bb = lc->negative_sign; -#ifdef _LIBCPP_STABLE_APPLE_ABI - j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS + j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); #else - j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); + j = __mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); #endif - if (j == -1) + if (j == size_t(-1)) __throw_runtime_error("locale not supported"); wbe = wbuf + j; __negative_sign_.assign(wbuf, wbe); } + // Assume the positive and negative formats will want spaces in + // the same places in curr_symbol since there's no way to + // represent anything else. + string_type __dummy_curr_symbol = __curr_symbol_; #if _WIN32 - __init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn); - __init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn); + __init_pat(__pos_format_, __dummy_curr_symbol, true, + lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, L' '); + __init_pat(__neg_format_, __curr_symbol_, true, + lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, L' '); #else // _WIN32 - __init_pat(__pos_format_, lc->int_p_cs_precedes, lc->int_p_sep_by_space, lc->int_p_sign_posn); - __init_pat(__neg_format_, lc->int_n_cs_precedes, lc->int_n_sep_by_space, lc->int_n_sign_posn); + __init_pat(__pos_format_, __dummy_curr_symbol, true, + lc->int_p_cs_precedes, lc->int_p_sep_by_space, + lc->int_p_sign_posn, L' '); + __init_pat(__neg_format_, __curr_symbol_, true, + lc->int_n_cs_precedes, lc->int_n_sep_by_space, + lc->int_n_sign_posn, L' '); #endif // _WIN32 } @@ -5790,14 +6034,14 @@ template class collate; template class num_get; template class num_get; -template class __num_get; -template class __num_get; +template struct __num_get; +template struct __num_get; template class num_put; template class num_put; -template class __num_put; -template class __num_put; +template struct __num_put; +template struct __num_put; template class time_get; template class time_get; diff --git a/system/lib/libcxx/memory.cpp b/system/lib/libcxx/memory.cpp index cb5e5e7b06ad8..14084a5206aae 100644 --- a/system/lib/libcxx/memory.cpp +++ b/system/lib/libcxx/memory.cpp @@ -7,7 +7,10 @@ // //===----------------------------------------------------------------------===// +#define _LIBCPP_BUILDING_MEMORY #include "memory" +#include "mutex" +#include "thread" _LIBCPP_BEGIN_NAMESPACE_STD @@ -100,10 +103,7 @@ __shared_weak_count::lock() _NOEXCEPT if (__sync_bool_compare_and_swap(&__shared_owners_, object_owners, object_owners+1)) - { - __add_weak(); return this; - } object_owners = __shared_owners_; } return 0; @@ -119,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 + : __lx(p) +{ +} + +void +__sp_mut::lock() _NOEXCEPT +{ + mutex& m = *static_cast(__lx); + unsigned count = 0; + while (!m.try_lock()) + { + if (++count > 16) + { + m.lock(); + break; + } + this_thread::yield(); + } +} + +void +__sp_mut::unlock() _NOEXCEPT +{ + static_cast(__lx)->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*) { @@ -154,7 +201,7 @@ align(size_t alignment, size_t size, void*& ptr, size_t& space) { char* p1 = static_cast(ptr); char* p2 = (char*)((size_t)(p1 + (alignment - 1)) & -alignment); - ptrdiff_t d = p2 - p1; + size_t d = static_cast(p2 - p1); if (d <= space - size) { r = p2; diff --git a/system/lib/libcxx/mutex.cpp b/system/lib/libcxx/mutex.cpp index 16817198b37c5..42195aa806487 100644 --- a/system/lib/libcxx/mutex.cpp +++ b/system/lib/libcxx/mutex.cpp @@ -7,6 +7,7 @@ // //===----------------------------------------------------------------------===// +#define _LIBCPP_BUILDING_MUTEX #include "mutex" #include "limits" #include "system_error" @@ -20,8 +21,7 @@ const adopt_lock_t adopt_lock = {}; mutex::~mutex() { - int e = pthread_mutex_destroy(&__m_); -// assert(e == 0); + pthread_mutex_destroy(&__m_); } void @@ -33,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); @@ -91,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; } @@ -125,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_) @@ -137,7 +137,7 @@ timed_mutex::try_lock() } void -timed_mutex::unlock() +timed_mutex::unlock() _NOEXCEPT { lock_guard _(__m_); __locked_ = false; @@ -176,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); @@ -192,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/system/lib/libcxx/new.cpp b/system/lib/libcxx/new.cpp index 1e8ed88dc4c15..3ad593a3c0e00 100644 --- a/system/lib/libcxx/new.cpp +++ b/system/lib/libcxx/new.cpp @@ -11,14 +11,26 @@ #include "new" +#ifndef __has_include +#define __has_include(inc) 0 +#endif + #if __APPLE__ #include - // On Darwin, there are two STL shared libraries and a lower level ABI - // shared libray. The global holding the current new handler is - // in the ABI library and named __cxa_new_handler. - #define __new_handler __cxxabiapple::__cxa_new_handler + + #ifndef _LIBCPPABI_VERSION + // On Darwin, there are two STL shared libraries and a lower level ABI + // shared libray. The global holding the current new handler is + // in the ABI library and named __cxa_new_handler. + #define __new_handler __cxxabiapple::__cxa_new_handler + #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 @@ -83,7 +95,7 @@ operator new[](size_t size) __attribute__((__weak__, __visibility__("default"))) void* -operator new[](size_t size, const std::nothrow_t& nothrow) _NOEXCEPT +operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT { void* p = 0; #ifndef _LIBCPP_NO_EXCEPTIONS @@ -134,6 +146,8 @@ namespace std const nothrow_t nothrow = {}; +#ifndef _LIBCPPABI_VERSION + new_handler set_new_handler(new_handler handler) _NOEXCEPT { @@ -146,6 +160,8 @@ get_new_handler() _NOEXCEPT return __sync_fetch_and_add(&__new_handler, (new_handler)0); } +#ifndef LIBCXXRT + bad_alloc::bad_alloc() _NOEXCEPT { } @@ -160,6 +176,8 @@ bad_alloc::what() const _NOEXCEPT return "std::bad_alloc"; } +#endif //LIBCXXRT + bad_array_new_length::bad_array_new_length() _NOEXCEPT { } @@ -174,6 +192,8 @@ bad_array_new_length::what() const _NOEXCEPT return "bad_array_new_length"; } +#endif + void __throw_bad_alloc() { diff --git a/system/lib/libcxx/random.cpp b/system/lib/libcxx/random.cpp index eca97bc819431..97a40c509dc9a 100644 --- a/system/lib/libcxx/random.cpp +++ b/system/lib/libcxx/random.cpp @@ -10,6 +10,9 @@ #include "random" #include "system_error" +#ifdef __sun__ +#define rename solaris_headers_are_broken +#endif #include #include #include @@ -37,7 +40,7 @@ random_device::operator()() } double -random_device::entropy() const +random_device::entropy() const _NOEXCEPT { return 0; } diff --git a/system/lib/libcxx/readme.txt b/system/lib/libcxx/readme.txt index c7e41df98445b..c0c90c3a47663 100644 --- a/system/lib/libcxx/readme.txt +++ b/system/lib/libcxx/readme.txt @@ -1 +1 @@ -These files are from libc++, svn revision 140465, Sep 24 2011 +These files are from libc++, svn revision 176559, Mar 7 2013 diff --git a/system/lib/libcxx/regex.cpp b/system/lib/libcxx/regex.cpp index 65e9f886dfb8b..e3ec2810c7746 100644 --- a/system/lib/libcxx/regex.cpp +++ b/system/lib/libcxx/regex.cpp @@ -69,12 +69,17 @@ regex_error::~regex_error() throw() {} namespace { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" + struct collationnames { const char* elem_; char char_; }; +#pragma clang diagnostic pop + const collationnames collatenames[] = { {"A", 0x41}, @@ -190,12 +195,17 @@ const collationnames collatenames[] = {"zero", 0x30} }; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" + struct classnames { const char* elem_; ctype_base::mask mask_; }; +#pragma clang diagnostic pop + const classnames ClassNames[] = { {"alnum", ctype_base::alnum}, diff --git a/system/lib/libcxx/stdexcept.cpp b/system/lib/libcxx/stdexcept.cpp index 28917887587ec..660ebfe273552 100644 --- a/system/lib/libcxx/stdexcept.cpp +++ b/system/lib/libcxx/stdexcept.cpp @@ -16,6 +16,16 @@ #include #include "system_error" +#ifndef __has_include +#define __has_include(inc) 0 +#endif + +#if __APPLE__ +#include +#elif defined(LIBCXXRT) || __has_include() +#include +#endif + // Note: optimize for size #pragma GCC visibility push(hidden) @@ -29,7 +39,7 @@ class __libcpp_nmstr 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)); @@ -67,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; } @@ -75,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); } @@ -113,6 +123,8 @@ logic_error::operator=(const logic_error& le) _NOEXCEPT return *this; } +#ifndef _LIBCPPABI_VERSION + logic_error::~logic_error() _NOEXCEPT { __libcpp_nmstr& s = (__libcpp_nmstr&)__imp_; @@ -126,6 +138,8 @@ logic_error::what() const _NOEXCEPT return s.c_str(); } +#endif + runtime_error::runtime_error(const string& msg) { __libcpp_nmstr& s = (__libcpp_nmstr&)__imp_; @@ -153,6 +167,8 @@ runtime_error::operator=(const runtime_error& le) _NOEXCEPT return *this; } +#ifndef _LIBCPPABI_VERSION + runtime_error::~runtime_error() _NOEXCEPT { __libcpp_nmstr& s = (__libcpp_nmstr&)__imp_; @@ -175,4 +191,6 @@ range_error::~range_error() _NOEXCEPT {} overflow_error::~overflow_error() _NOEXCEPT {} underflow_error::~underflow_error() _NOEXCEPT {} +#endif + } // std diff --git a/system/lib/libcxx/string.cpp b/system/lib/libcxx/string.cpp index 1f58e3657a89a..40723e74a1567 100644 --- a/system/lib/libcxx/string.cpp +++ b/system/lib/libcxx/string.cpp @@ -31,17 +31,17 @@ stoi(const string& str, size_t* idx, int base) { char* ptr; const char* const p = str.c_str(); + typename remove_reference::type errno_save = errno; + errno = 0; long r = strtol(p, &ptr, base); - if (r < numeric_limits::min() || numeric_limits::max() < r) - ptr = const_cast(p); - if (ptr == p) - { + swap(errno, errno_save); #ifndef _LIBCPP_NO_EXCEPTIONS - if (r == 0) - throw invalid_argument("stoi: no conversion"); + if (errno_save == ERANGE || r < numeric_limits::min() || + numeric_limits::max() < r) throw out_of_range("stoi: out of range"); + if (ptr == p) + throw invalid_argument("stoi: no conversion"); #endif // _LIBCPP_NO_EXCEPTIONS - } if (idx) *idx = static_cast(ptr - p); return static_cast(r); @@ -52,17 +52,17 @@ stoi(const wstring& str, size_t* idx, int base) { wchar_t* ptr; const wchar_t* const p = str.c_str(); + typename remove_reference::type errno_save = errno; + errno = 0; long r = wcstol(p, &ptr, base); - if (r < numeric_limits::min() || numeric_limits::max() < r) - ptr = const_cast(p); - if (ptr == p) - { + swap(errno, errno_save); #ifndef _LIBCPP_NO_EXCEPTIONS - if (r == 0) - throw invalid_argument("stoi: no conversion"); + if (errno_save == ERANGE || r < numeric_limits::min() || + numeric_limits::max() < r) throw out_of_range("stoi: out of range"); + if (ptr == p) + throw invalid_argument("stoi: no conversion"); #endif // _LIBCPP_NO_EXCEPTIONS - } if (idx) *idx = static_cast(ptr - p); return static_cast(r); @@ -73,15 +73,16 @@ stol(const string& str, size_t* idx, int base) { char* ptr; const char* const p = str.c_str(); + typename remove_reference::type errno_save = errno; + errno = 0; long r = strtol(p, &ptr, base); - if (ptr == p) - { + swap(errno, errno_save); #ifndef _LIBCPP_NO_EXCEPTIONS - if (r == 0) - throw invalid_argument("stol: no conversion"); + if (errno_save == ERANGE) throw out_of_range("stol: out of range"); + if (ptr == p) + throw invalid_argument("stol: no conversion"); #endif // _LIBCPP_NO_EXCEPTIONS - } if (idx) *idx = static_cast(ptr - p); return r; @@ -92,15 +93,16 @@ stol(const wstring& str, size_t* idx, int base) { wchar_t* ptr; const wchar_t* const p = str.c_str(); + typename remove_reference::type errno_save = errno; + errno = 0; long r = wcstol(p, &ptr, base); - if (ptr == p) - { + swap(errno, errno_save); #ifndef _LIBCPP_NO_EXCEPTIONS - if (r == 0) - throw invalid_argument("stol: no conversion"); + if (errno_save == ERANGE) throw out_of_range("stol: out of range"); + if (ptr == p) + throw invalid_argument("stol: no conversion"); #endif // _LIBCPP_NO_EXCEPTIONS - } if (idx) *idx = static_cast(ptr - p); return r; @@ -111,15 +113,16 @@ stoul(const string& str, size_t* idx, int base) { char* ptr; const char* const p = str.c_str(); + typename remove_reference::type errno_save = errno; + errno = 0; unsigned long r = strtoul(p, &ptr, base); - if (ptr == p) - { + swap(errno, errno_save); #ifndef _LIBCPP_NO_EXCEPTIONS - if (r == 0) - throw invalid_argument("stoul: no conversion"); + if (errno_save == ERANGE) throw out_of_range("stoul: out of range"); + if (ptr == p) + throw invalid_argument("stoul: no conversion"); #endif // _LIBCPP_NO_EXCEPTIONS - } if (idx) *idx = static_cast(ptr - p); return r; @@ -130,15 +133,16 @@ stoul(const wstring& str, size_t* idx, int base) { wchar_t* ptr; const wchar_t* const p = str.c_str(); + typename remove_reference::type errno_save = errno; + errno = 0; unsigned long r = wcstoul(p, &ptr, base); - if (ptr == p) - { + swap(errno, errno_save); #ifndef _LIBCPP_NO_EXCEPTIONS - if (r == 0) - throw invalid_argument("stoul: no conversion"); + if (errno_save == ERANGE) throw out_of_range("stoul: out of range"); + if (ptr == p) + throw invalid_argument("stoul: no conversion"); #endif // _LIBCPP_NO_EXCEPTIONS - } if (idx) *idx = static_cast(ptr - p); return r; @@ -149,15 +153,16 @@ stoll(const string& str, size_t* idx, int base) { char* ptr; const char* const p = str.c_str(); + typename remove_reference::type errno_save = errno; + errno = 0; long long r = strtoll(p, &ptr, base); - if (ptr == p) - { + swap(errno, errno_save); #ifndef _LIBCPP_NO_EXCEPTIONS - if (r == 0) - throw invalid_argument("stoll: no conversion"); + if (errno_save == ERANGE) throw out_of_range("stoll: out of range"); + if (ptr == p) + throw invalid_argument("stoll: no conversion"); #endif // _LIBCPP_NO_EXCEPTIONS - } if (idx) *idx = static_cast(ptr - p); return r; @@ -168,15 +173,16 @@ stoll(const wstring& str, size_t* idx, int base) { wchar_t* ptr; const wchar_t* const p = str.c_str(); + typename remove_reference::type errno_save = errno; + errno = 0; long long r = wcstoll(p, &ptr, base); - if (ptr == p) - { + swap(errno, errno_save); #ifndef _LIBCPP_NO_EXCEPTIONS - if (r == 0) - throw invalid_argument("stoll: no conversion"); + if (errno_save == ERANGE) throw out_of_range("stoll: out of range"); + if (ptr == p) + throw invalid_argument("stoll: no conversion"); #endif // _LIBCPP_NO_EXCEPTIONS - } if (idx) *idx = static_cast(ptr - p); return r; @@ -187,15 +193,16 @@ stoull(const string& str, size_t* idx, int base) { char* ptr; const char* const p = str.c_str(); + typename remove_reference::type errno_save = errno; + errno = 0; unsigned long long r = strtoull(p, &ptr, base); - if (ptr == p) - { + swap(errno, errno_save); #ifndef _LIBCPP_NO_EXCEPTIONS - if (r == 0) - throw invalid_argument("stoull: no conversion"); + if (errno_save == ERANGE) throw out_of_range("stoull: out of range"); + if (ptr == p) + throw invalid_argument("stoull: no conversion"); #endif // _LIBCPP_NO_EXCEPTIONS - } if (idx) *idx = static_cast(ptr - p); return r; @@ -206,15 +213,16 @@ stoull(const wstring& str, size_t* idx, int base) { wchar_t* ptr; const wchar_t* const p = str.c_str(); + typename remove_reference::type errno_save = errno; + errno = 0; unsigned long long r = wcstoull(p, &ptr, base); - if (ptr == p) - { + swap(errno, errno_save); #ifndef _LIBCPP_NO_EXCEPTIONS - if (r == 0) - throw invalid_argument("stoull: no conversion"); + if (errno_save == ERANGE) throw out_of_range("stoull: out of range"); + if (ptr == p) + throw invalid_argument("stoull: no conversion"); #endif // _LIBCPP_NO_EXCEPTIONS - } if (idx) *idx = static_cast(ptr - p); return r; @@ -225,9 +233,9 @@ stof(const string& str, size_t* idx) { char* ptr; const char* const p = str.c_str(); - int errno_save = errno; + typename remove_reference::type errno_save = errno; errno = 0; - double r = strtod(p, &ptr); + float r = strtof(p, &ptr); swap(errno, errno_save); #ifndef _LIBCPP_NO_EXCEPTIONS if (errno_save == ERANGE) @@ -237,7 +245,7 @@ stof(const string& str, size_t* idx) #endif // _LIBCPP_NO_EXCEPTIONS if (idx) *idx = static_cast(ptr - p); - return static_cast(r); + return r; } float @@ -245,9 +253,9 @@ stof(const wstring& str, size_t* idx) { wchar_t* ptr; const wchar_t* const p = str.c_str(); - int errno_save = errno; + typename remove_reference::type errno_save = errno; errno = 0; - double r = wcstod(p, &ptr); + float r = wcstof(p, &ptr); swap(errno, errno_save); #ifndef _LIBCPP_NO_EXCEPTIONS if (errno_save == ERANGE) @@ -257,7 +265,7 @@ stof(const wstring& str, size_t* idx) #endif // _LIBCPP_NO_EXCEPTIONS if (idx) *idx = static_cast(ptr - p); - return static_cast(r); + return r; } double @@ -265,7 +273,7 @@ stod(const string& str, size_t* idx) { char* ptr; const char* const p = str.c_str(); - int errno_save = errno; + typename remove_reference::type errno_save = errno; errno = 0; double r = strtod(p, &ptr); swap(errno, errno_save); @@ -285,7 +293,7 @@ stod(const wstring& str, size_t* idx) { wchar_t* ptr; const wchar_t* const p = str.c_str(); - int errno_save = errno; + typename remove_reference::type errno_save = errno; errno = 0; double r = wcstod(p, &ptr); swap(errno, errno_save); @@ -305,7 +313,7 @@ stold(const string& str, size_t* idx) { char* ptr; const char* const p = str.c_str(); - int errno_save = errno; + typename remove_reference::type errno_save = errno; errno = 0; long double r = strtold(p, &ptr); swap(errno, errno_save); @@ -325,7 +333,7 @@ stold(const wstring& str, size_t* idx) { wchar_t* ptr; const wchar_t* const p = str.c_str(); - int errno_save = errno; + typename remove_reference::type errno_save = errno; errno = 0; long double r = wcstold(p, &ptr); swap(errno, errno_save); @@ -346,7 +354,7 @@ string to_string(int val) s.resize(s.capacity()); while (true) { - int n2 = snprintf(&s[0], s.size()+1, "%d", val); + size_t n2 = static_cast(snprintf(&s[0], s.size()+1, "%d", val)); if (n2 <= s.size()) { s.resize(n2); @@ -363,7 +371,7 @@ string to_string(unsigned val) s.resize(s.capacity()); while (true) { - int n2 = snprintf(&s[0], s.size()+1, "%u", val); + size_t n2 = static_cast(snprintf(&s[0], s.size()+1, "%u", val)); if (n2 <= s.size()) { s.resize(n2); @@ -380,7 +388,7 @@ string to_string(long val) s.resize(s.capacity()); while (true) { - int n2 = snprintf(&s[0], s.size()+1, "%ld", val); + size_t n2 = static_cast(snprintf(&s[0], s.size()+1, "%ld", val)); if (n2 <= s.size()) { s.resize(n2); @@ -397,7 +405,7 @@ string to_string(unsigned long val) s.resize(s.capacity()); while (true) { - int n2 = snprintf(&s[0], s.size()+1, "%lu", val); + size_t n2 = static_cast(snprintf(&s[0], s.size()+1, "%lu", val)); if (n2 <= s.size()) { s.resize(n2); @@ -414,7 +422,7 @@ string to_string(long long val) s.resize(s.capacity()); while (true) { - int n2 = snprintf(&s[0], s.size()+1, "%lld", val); + size_t n2 = static_cast(snprintf(&s[0], s.size()+1, "%lld", val)); if (n2 <= s.size()) { s.resize(n2); @@ -431,7 +439,7 @@ string to_string(unsigned long long val) s.resize(s.capacity()); while (true) { - int n2 = snprintf(&s[0], s.size()+1, "%llu", val); + size_t n2 = static_cast(snprintf(&s[0], s.size()+1, "%llu", val)); if (n2 <= s.size()) { s.resize(n2); @@ -448,7 +456,7 @@ string to_string(float val) s.resize(s.capacity()); while (true) { - int n2 = snprintf(&s[0], s.size()+1, "%f", val); + size_t n2 = static_cast(snprintf(&s[0], s.size()+1, "%f", val)); if (n2 <= s.size()) { s.resize(n2); @@ -465,7 +473,7 @@ string to_string(double val) s.resize(s.capacity()); while (true) { - int n2 = snprintf(&s[0], s.size()+1, "%f", val); + size_t n2 = static_cast(snprintf(&s[0], s.size()+1, "%f", val)); if (n2 <= s.size()) { s.resize(n2); @@ -482,7 +490,7 @@ string to_string(long double val) s.resize(s.capacity()); while (true) { - int n2 = snprintf(&s[0], s.size()+1, "%Lf", val); + size_t n2 = static_cast(snprintf(&s[0], s.size()+1, "%Lf", val)); if (n2 <= s.size()) { s.resize(n2); @@ -505,7 +513,7 @@ wstring to_wstring(int val) int n2 = swprintf(&s[0], s.size()+1, L"%d", val); if (n2 > 0) { - s.resize(n2); + s.resize(static_cast(n2)); break; } s.resize(2*s.size()); @@ -526,7 +534,7 @@ wstring to_wstring(unsigned val) int n2 = swprintf(&s[0], s.size()+1, L"%u", val); if (n2 > 0) { - s.resize(n2); + s.resize(static_cast(n2)); break; } s.resize(2*s.size()); @@ -547,7 +555,7 @@ wstring to_wstring(long val) int n2 = swprintf(&s[0], s.size()+1, L"%ld", val); if (n2 > 0) { - s.resize(n2); + s.resize(static_cast(n2)); break; } s.resize(2*s.size()); @@ -568,7 +576,7 @@ wstring to_wstring(unsigned long val) int n2 = swprintf(&s[0], s.size()+1, L"%lu", val); if (n2 > 0) { - s.resize(n2); + s.resize(static_cast(n2)); break; } s.resize(2*s.size()); @@ -589,7 +597,7 @@ wstring to_wstring(long long val) int n2 = swprintf(&s[0], s.size()+1, L"%lld", val); if (n2 > 0) { - s.resize(n2); + s.resize(static_cast(n2)); break; } s.resize(2*s.size()); @@ -610,7 +618,7 @@ wstring to_wstring(unsigned long long val) int n2 = swprintf(&s[0], s.size()+1, L"%llu", val); if (n2 > 0) { - s.resize(n2); + s.resize(static_cast(n2)); break; } s.resize(2*s.size()); @@ -629,7 +637,7 @@ wstring to_wstring(float val) int n2 = swprintf(&s[0], s.size()+1, L"%f", val); if (n2 > 0) { - s.resize(n2); + s.resize(static_cast(n2)); break; } s.resize(2*s.size()); @@ -648,7 +656,7 @@ wstring to_wstring(double val) int n2 = swprintf(&s[0], s.size()+1, L"%f", val); if (n2 > 0) { - s.resize(n2); + s.resize(static_cast(n2)); break; } s.resize(2*s.size()); @@ -667,7 +675,7 @@ wstring to_wstring(long double val) int n2 = swprintf(&s[0], s.size()+1, L"%Lf", val); if (n2 > 0) { - s.resize(n2); + s.resize(static_cast(n2)); break; } s.resize(2*s.size()); diff --git a/system/lib/libcxx/strstream.cpp b/system/lib/libcxx/strstream.cpp index 53139509edfa8..8cd19e6a353cd 100644 --- a/system/lib/libcxx/strstream.cpp +++ b/system/lib/libcxx/strstream.cpp @@ -34,7 +34,7 @@ void strstreambuf::__init(char* __gnext, streamsize __n, char* __pbeg) { if (__n == 0) - __n = strlen(__gnext); + __n = static_cast(strlen(__gnext)); else if (__n < 0) __n = INT_MAX; if (__pbeg == nullptr) @@ -160,12 +160,12 @@ strstreambuf::overflow(int_type __c) streamsize new_size = max(__alsize_, 2*old_size); char* buf = nullptr; if (__palloc_) - buf = static_cast(__palloc_(new_size)); + buf = static_cast(__palloc_(static_cast(new_size))); else buf = new char[new_size]; if (buf == nullptr) return int_type(EOF); - memcpy(buf, eback(), old_size); + memcpy(buf, eback(), static_cast(old_size)); ptrdiff_t ninp = gptr() - eback(); ptrdiff_t einp = egptr() - eback(); ptrdiff_t nout = pptr() - pbase(); @@ -179,7 +179,7 @@ strstreambuf::overflow(int_type __c) } setg(buf, buf + ninp, buf + einp); setp(buf + einp, buf + einp + eout); - pbump(nout); + pbump(static_cast(nout)); __strmode_ |= __allocated; } *pptr() = static_cast(__c); diff --git a/system/lib/libcxx/support/solaris/README b/system/lib/libcxx/support/solaris/README new file mode 100644 index 0000000000000..89c887a3b4a39 --- /dev/null +++ b/system/lib/libcxx/support/solaris/README @@ -0,0 +1,4 @@ +This directory contains a partial implementation of the xlocale APIs for +Solaris. Some portions are lifted from FreeBSD libc, and so are covered by a +2-clause BSD license instead of the MIT/UUIC license that the rest of libc++ is +distributed under. diff --git a/system/lib/libcxx/support/solaris/mbsnrtowcs.inc b/system/lib/libcxx/support/solaris/mbsnrtowcs.inc new file mode 100644 index 0000000000000..074045277ca18 --- /dev/null +++ b/system/lib/libcxx/support/solaris/mbsnrtowcs.inc @@ -0,0 +1,76 @@ + + +/*- + * As noted in the source, some portions of this implementation are copied from + * FreeBSD libc. These are covered by the following copyright: + * + * Copyright (c) 2002-2004 Tim J. Robbins. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +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) +{ + const char *s; + size_t nchr; + wchar_t wc; + size_t nb; + FIX_LOCALE(loc); + + s = *src; + nchr = 0; + + if (dst == NULL) { + for (;;) { + if ((nb = mbrtowc_l(&wc, s, nms, ps, loc)) == (size_t)-1) + /* Invalid sequence - mbrtowc() sets errno. */ + return ((size_t)-1); + else if (nb == 0 || nb == (size_t)-2) + return (nchr); + s += nb; + nms -= nb; + nchr++; + } + /*NOTREACHED*/ + } + + while (len-- > 0) { + if ((nb = mbrtowc_l(dst, s, nms, ps, loc)) == (size_t)-1) { + *src = s; + return ((size_t)-1); + } else if (nb == (size_t)-2) { + *src = s + nms; + return (nchr); + } else if (nb == 0) { + *src = NULL; + return (nchr); + } + s += nb; + nms -= nb; + nchr++; + dst++; + } + *src = s; + return (nchr); +} diff --git a/system/lib/libcxx/support/solaris/wcsnrtombs.inc b/system/lib/libcxx/support/solaris/wcsnrtombs.inc new file mode 100644 index 0000000000000..67e7078f2d511 --- /dev/null +++ b/system/lib/libcxx/support/solaris/wcsnrtombs.inc @@ -0,0 +1,93 @@ +/*- + * Copyright (c) 2002-2004 Tim J. Robbins. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + +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) +{ + FIX_LOCALE(loc); + mbstate_t mbsbak; + char buf[MB_CUR_MAX_L(loc)]; + const wchar_t *s; + size_t nbytes; + size_t nb; + + s = *src; + nbytes = 0; + + if (dst == NULL) { + while (nwc-- > 0) { + if ((nb = wcrtomb_l(buf, *s, ps, loc)) == (size_t)-1) + /* Invalid character - wcrtomb() sets errno. */ + return ((size_t)-1); + else if (*s == L'\0') + return (nbytes + nb - 1); + s++; + nbytes += nb; + } + return (nbytes); + } + + while (len > 0 && nwc-- > 0) { + if (len > (size_t)MB_CUR_MAX_L(loc)) { + /* Enough space to translate in-place. */ + if ((nb = wcrtomb_l(dst, *s, ps, loc)) == (size_t)-1) { + *src = s; + return ((size_t)-1); + } + } else { + /* + * May not be enough space; use temp. buffer. + * + * We need to save a copy of the conversion state + * here so we can restore it if the multibyte + * character is too long for the buffer. + */ + mbsbak = *ps; + if ((nb = wcrtomb_l(buf, *s, ps, loc)) == (size_t)-1) { + *src = s; + return ((size_t)-1); + } + if (nb > (int)len) { + /* MB sequence for character won't fit. */ + *ps = mbsbak; + break; + } + memcpy(dst, buf, nb); + } + if (*s == L'\0') { + *src = NULL; + return (nbytes + nb - 1); + } + s++; + dst += nb; + len -= nb; + nbytes += nb; + } + *src = s; + return (nbytes); +} + diff --git a/system/lib/libcxx/support/solaris/xlocale.c b/system/lib/libcxx/support/solaris/xlocale.c new file mode 100644 index 0000000000000..a2c1fa905cccc --- /dev/null +++ b/system/lib/libcxx/support/solaris/xlocale.c @@ -0,0 +1,245 @@ + +#ifdef __sun__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "xlocale.h" + +static _LC_locale_t *__C_locale; + +#define FIX_LOCALE(l) l = (l == 0) ? __C_locale : l + +#include "mbsnrtowcs.inc" +#include "wcsnrtombs.inc" + +size_t __mb_cur_max(locale_t __l) { + FIX_LOCALE(__l); + return (__l->lc_ctype->cmapp->cm_mb_cur_max); +} + +wint_t btowc_l(int __c, locale_t __l) { + FIX_LOCALE(__l); + return __l->lc_ctype->cmapp->core.user_api->btowc(__l->lc_ctype->cmapp, __c); +} + +int wctob_l(wint_t __c, locale_t __l) { + FIX_LOCALE(__l); + return __l->lc_ctype->cmapp->core.user_api->wctob(__l->lc_ctype->cmapp, __c); +} + +size_t wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l) { + FIX_LOCALE(__l); + return __l->lc_ctype->cmapp->core.user_api->wcrtomb(__l->lc_ctype->cmapp, + __s, __wc, __ps); +} + +size_t mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n, + mbstate_t *__ps, locale_t __l) { + FIX_LOCALE(__l); + return __l->lc_ctype->cmapp->core.user_api->mbrtowc(__l->lc_ctype->cmapp, + __pwc, __s, __n, __ps); +} + +int mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l) { + FIX_LOCALE(__l); + return __l->lc_ctype->cmapp->core.user_api->mbtowc(__l->lc_ctype->cmapp, + __pwc, __pmb, __max); +} + +size_t mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l) { + FIX_LOCALE(__l); + return __l->lc_ctype->cmapp->core.user_api->mbrlen(__l->lc_ctype->cmapp, __s, + __n, __ps); +} + +struct lconv *localeconv_l(locale_t __l) { + FIX_LOCALE(__l); + return __l->core.user_api->localeconv(__l); +} + +size_t mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len, + mbstate_t *__ps, locale_t __l) { + FIX_LOCALE(__l); + return __l->lc_ctype->cmapp->core.user_api->mbsrtowcs(__l->lc_ctype->cmapp, + __dest, __src, __len, __ps); +} + +int wcscoll_l(const wchar_t *__s1, const wchar_t *__s2, locale_t __l) { + FIX_LOCALE(__l); + return __l->lc_collate->core.user_api->wcscoll(__l->lc_collate, + __s1, __s2); +} + +int strcoll_l(const char *__s1, const char *__s2, locale_t __l) { + FIX_LOCALE(__l); + return __l->lc_collate->core.user_api->strcoll(__l->lc_collate, + __s1, __s2); +} + +size_t strxfrm_l(char *__s1, const char *__s2, size_t __n, locale_t __l) { + FIX_LOCALE(__l); + return __l->lc_collate->core.user_api->strxfrm(__l->lc_collate, + __s1, __s2, __n); +} +size_t strftime_l(char *__s, size_t __size, const char *__fmt, const struct tm + *__tm, locale_t __l) { + FIX_LOCALE(__l); + return __l->lc_time->core.user_api->strftime(__l->lc_time, + __s, __size, __fmt, __tm); +} + +size_t wcsxfrm_l(wchar_t *__ws1, const wchar_t *__ws2, size_t __n, + locale_t __l) { + FIX_LOCALE(__l); + return __l->lc_collate->core.user_api->wcsxfrm(__l->lc_collate, + __ws1, __ws2, __n); +} + +#define LOCALE_ISCTYPE(ctype, m) \ + int is##ctype##_l(int __c, locale_t __l) { \ + if ((__c < 0) || (__c > 255)) return 0;\ + FIX_LOCALE(__l);\ + return __l->lc_ctype->mask[__c] & m;\ + }\ + int isw##ctype##_l(wchar_t __c, locale_t __l) { \ + FIX_LOCALE(__l);\ + return __l->lc_ctype->core.user_api->iswctype(__l->lc_ctype, __c, m);\ + } + +LOCALE_ISCTYPE(alnum, _ISALNUM) +LOCALE_ISCTYPE(alpha, _ISALPHA) +LOCALE_ISCTYPE(blank, _ISALPHA) +LOCALE_ISCTYPE(cntrl, _ISCNTRL) +LOCALE_ISCTYPE(digit, _ISDIGIT) +LOCALE_ISCTYPE(graph, _ISGRAPH) +LOCALE_ISCTYPE(lower, _ISLOWER) +LOCALE_ISCTYPE(print, _ISPRINT) +LOCALE_ISCTYPE(punct, _ISPUNCT) +LOCALE_ISCTYPE(space, _ISSPACE) +LOCALE_ISCTYPE(upper, _ISUPPER) +LOCALE_ISCTYPE(xdigit, _ISXDIGIT) + +int iswctype_l(wint_t __c, wctype_t __m, locale_t __l) { + FIX_LOCALE(__l);\ + return __l->lc_ctype->core.user_api->iswctype(__l->lc_ctype, __c, __m);\ +} + +int toupper_l(int __c, locale_t __l) { + FIX_LOCALE(__l); + if ((__c < 0) || (__c > __l->lc_ctype->max_upper)) return __c; + return __l->lc_ctype->upper[__c]; +} +int tolower_l(int __c, locale_t __l) { + FIX_LOCALE(__l); + if ((__c < 0) || (__c > __l->lc_ctype->max_lower)) return __c; + return __l->lc_ctype->lower[__c]; +} +wint_t towupper_l(wint_t __c, locale_t __l) { + FIX_LOCALE(__l); + return __l->lc_ctype->core.user_api->towupper(__l->lc_ctype, __c); +} +wint_t towlower_l(wint_t __c, locale_t __l) { + FIX_LOCALE(__l); + return __l->lc_ctype->core.user_api->towlower(__l->lc_ctype, __c); +} + +// FIXME: This disregards the locale, which is Very Wrong +#define vsnprintf_l(__s, __n, __l, __format, __va) \ + vsnprintf(__s, __n, __format, __va) + +int sprintf_l(char *__s, locale_t __l, const char *__format, ...) { + va_list __va; + va_start(__va, __format); + int __res = vsnprintf_l(__s, SIZE_MAX, __l, __format, __va); + va_end(__va); + return __res; +} + +int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) +{ + va_list __va; + va_start(__va, __format); + int __res = vsnprintf_l(__s, __n , __l, __format, __va); + va_end(__va); + return __res; +} + +int asprintf_l(char **__s, locale_t __l, const char *__format, ...) { + va_list __va; + va_start(__va, __format); + // FIXME: + int __res = vasprintf(__s, __format, __va); + va_end(__va); + return __res; +} + +int sscanf_l(const char *__s, locale_t __l, const char *__format, ...) { + va_list __va; + va_start(__va, __format); + // FIXME: + int __res = vsscanf(__s, __format, __va); + va_end(__va); + return __res; +} + +locale_t newlocale(int mask, const char *locale, locale_t base) { + + if ((locale == NULL) || (locale[0] == '\0') || + ((locale[0] == 'C') && (locale[1] == '\0'))) + { + return __C_locale; + } + + // Solaris locales are shared libraries that contain + char *path; +#ifdef __LP64 + asprintf(&path, "/usr/lib/locale/%1$s/amd64/%1$s.so.3", locale); +#else + asprintf(&path, "/usr/lib/locale/%1$s/%1$s.so.3", locale); +#endif + void *handle = dlopen(path, RTLD_LOCAL | RTLD_NOW); + free(path); + if (!handle) + return 0; + _LC_locale_t *(*init)() = dlsym(handle, "instantiate"); + if (!init) + return 0; + _LC_locale_t *p = init(); + if (!p) + return 0; + + if (!base) + base = __C_locale; + + locale_t ret = calloc(1, sizeof(struct _LC_locale_t)); + memcpy(ret, p, sizeof (_LC_locale_t)); + ret->lc_collate = (mask & LC_COLLATE_MASK) ? p->lc_collate : base->lc_collate; + ret->lc_ctype = (mask & LC_CTYPE_MASK) ? p->lc_ctype : base->lc_ctype; + ret->lc_messages = (mask & LC_MESSAGES_MASK) ? p->lc_messages : base->lc_messages; + ret->lc_monetary = (mask & LC_MONETARY_MASK) ? p->lc_monetary : base->lc_monetary; + ret->lc_time = (mask & LC_TIME_MASK) ? p->lc_time : base->lc_time; + return ret; +} + +void freelocale(locale_t loc) +{ + if (loc != __C_locale) + free(loc); +} + +__attribute__((constructor)) +static void setupCLocale(void) { + // The default initial locale is the C locale. This is a statically + // allocated locale inside libc. At program start, __lc_locale will point to + // this. We need to grab a copy because it's not a public symbol. If we had + // access to the source code for libc, then we'd just use it directly... + assert('C' == setlocale(LC_ALL, 0)[0]); + __C_locale = __lc_locale; +} +#endif diff --git a/system/lib/libcxx/support/win32/locale_win32.cpp b/system/lib/libcxx/support/win32/locale_win32.cpp new file mode 100644 index 0000000000000..02b5874e29449 --- /dev/null +++ b/system/lib/libcxx/support/win32/locale_win32.cpp @@ -0,0 +1,94 @@ +// -*- 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/system/lib/libcxx/support/win32/support.cpp b/system/lib/libcxx/support/win32/support.cpp new file mode 100644 index 0000000000000..9e85077a7ada3 --- /dev/null +++ b/system/lib/libcxx/support/win32/support.cpp @@ -0,0 +1,70 @@ +// -*- 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/system/lib/libcxx/symbols b/system/lib/libcxx/symbols index 0d412de71bc6f..2a9b51860c677 100644 --- a/system/lib/libcxx/symbols +++ b/system/lib/libcxx/symbols @@ -1,23 +1,5 @@ - W _ZGVNSt3__110moneypunctIcLb0EE2idE - W _ZGVNSt3__110moneypunctIcLb1EE2idE - W _ZGVNSt3__110moneypunctIwLb0EE2idE - W _ZGVNSt3__110moneypunctIwLb1EE2idE - W _ZGVNSt3__17collateIcE2idE - W _ZGVNSt3__17collateIwE2idE - W _ZGVNSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE - W _ZGVNSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE - W _ZGVNSt3__17num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE - W _ZGVNSt3__17num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE - W _ZGVNSt3__18messagesIcE2idE - W _ZGVNSt3__18messagesIwE2idE - W _ZGVNSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE - W _ZGVNSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE - W _ZGVNSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE - W _ZGVNSt3__18time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE - W _ZGVNSt3__19money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE - W _ZGVNSt3__19money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE - W _ZGVNSt3__19money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE - W _ZGVNSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE + t _GLOBAL__I_a + t _GLOBAL__I_a23 d _ZGVZNKSt3__120__time_get_c_storageIcE3__XEvE1s d _ZGVZNKSt3__120__time_get_c_storageIcE3__cEvE1s d _ZGVZNKSt3__120__time_get_c_storageIcE3__rEvE1s @@ -33,6 +15,7 @@ d _ZGVZNKSt3__120__time_get_c_storageIwE7__weeksEvE5weeks d _ZGVZNKSt3__120__time_get_c_storageIwE8__monthsEvE6months d _ZGVZNSt3__112_GLOBAL__N_13mutEvE1m + d _ZGVZNSt3__112__get_sp_mutEPKvE4muts d _ZGVZNSt3__112__rs_defaultclEvE6__rs_g d _ZGVZNSt3__115future_categoryEvE3__f d _ZGVZNSt3__115system_categoryEvE1s @@ -49,21 +32,13 @@ d _ZGVZNSt3__1L11init_wam_pmEvE5am_pm d _ZGVZNSt3__1L11init_wweeksEvE5weeks d _ZGVZNSt3__1L12init_wmonthsEvE6months - d _ZL19__terminate_handler - d _ZL20__unexpected_handler - T _ZN12_GLOBAL__N_114__libcpp_nmstrC1EPKc - T _ZN12_GLOBAL__N_114__libcpp_nmstrC1ERKS0_ + t _ZN12_GLOBAL__N_114__libcpp_nmstrC1EPKc + t _ZN12_GLOBAL__N_114__libcpp_nmstrC1ERKS0_ t _ZN12_GLOBAL__N_114__libcpp_nmstrC2EPKc t _ZN12_GLOBAL__N_114__libcpp_nmstrC2ERKS0_ - T _ZN12_GLOBAL__N_114__libcpp_nmstrD1Ev - t _ZN12_GLOBAL__N_114__libcpp_nmstrD2Ev t _ZN12_GLOBAL__N_114__libcpp_nmstraSERKS0_ t _ZNK12_GLOBAL__N_114__libcpp_nmstr5c_strEv t _ZNK12_GLOBAL__N_114__libcpp_nmstr5countEv - T _ZNKSt10bad_typeid4whatEv - T _ZNKSt11logic_error4whatEv - T _ZNKSt13bad_exception4whatEv - T _ZNKSt13runtime_error4whatEv T _ZNKSt16nested_exception14rethrow_nestedEv T _ZNKSt3__110__time_put8__do_putEPcRS1_PK2tmcc T _ZNKSt3__110__time_put8__do_putEPwRS1_PK2tmcc @@ -148,6 +123,7 @@ T _ZNKSt3__111__libcpp_db17__dereferenceableEPKv T _ZNKSt3__111__libcpp_db17__find_c_and_lockEPv T _ZNKSt3__111__libcpp_db6unlockEv + T _ZNKSt3__111__libcpp_db8__find_cEPv T _ZNKSt3__111__libcpp_db9__addableEPKvi t _ZNKSt3__112_GLOBAL__N_111__fake_bindclEv T _ZNKSt3__112__do_message7messageEi @@ -278,14 +254,14 @@ T _ZNKSt3__112ctype_bynameIcE10do_tolowerEc T _ZNKSt3__112ctype_bynameIcE10do_toupperEPcPKc T _ZNKSt3__112ctype_bynameIcE10do_toupperEc - T _ZNKSt3__112ctype_bynameIwE10do_scan_isEjPKwS3_ + T _ZNKSt3__112ctype_bynameIwE10do_scan_isEtPKwS3_ T _ZNKSt3__112ctype_bynameIwE10do_tolowerEPwPKw T _ZNKSt3__112ctype_bynameIwE10do_tolowerEw T _ZNKSt3__112ctype_bynameIwE10do_toupperEPwPKw T _ZNKSt3__112ctype_bynameIwE10do_toupperEw - T _ZNKSt3__112ctype_bynameIwE11do_scan_notEjPKwS3_ - T _ZNKSt3__112ctype_bynameIwE5do_isEPKwS3_Pj - T _ZNKSt3__112ctype_bynameIwE5do_isEjw + T _ZNKSt3__112ctype_bynameIwE11do_scan_notEtPKwS3_ + T _ZNKSt3__112ctype_bynameIwE5do_isEPKwS3_Pt + T _ZNKSt3__112ctype_bynameIwE5do_isEtw T _ZNKSt3__112ctype_bynameIwE8do_widenEPKcS3_Pw T _ZNKSt3__112ctype_bynameIwE8do_widenEc T _ZNKSt3__112ctype_bynameIwE9do_narrowEPKwS3_cPc @@ -298,20 +274,20 @@ W _ZNKSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentrycvbEv W _ZNKSt3__113basic_ostreamIwNS_11char_traitsIwEEE6sentrycvbEv T _ZNKSt3__113random_device7entropyEv - T _ZNKSt3__114__codecvt_utf8IjE10do_unshiftER10_mbstate_tPcS4_RS4_ - T _ZNKSt3__114__codecvt_utf8IjE11do_encodingEv - T _ZNKSt3__114__codecvt_utf8IjE13do_max_lengthEv - T _ZNKSt3__114__codecvt_utf8IjE16do_always_noconvEv - T _ZNKSt3__114__codecvt_utf8IjE5do_inER10_mbstate_tPKcS5_RS5_PjS7_RS7_ - T _ZNKSt3__114__codecvt_utf8IjE6do_outER10_mbstate_tPKjS5_RS5_PcS7_RS7_ - T _ZNKSt3__114__codecvt_utf8IjE9do_lengthER10_mbstate_tPKcS5_j - T _ZNKSt3__114__codecvt_utf8ItE10do_unshiftER10_mbstate_tPcS4_RS4_ - T _ZNKSt3__114__codecvt_utf8ItE11do_encodingEv - T _ZNKSt3__114__codecvt_utf8ItE13do_max_lengthEv - T _ZNKSt3__114__codecvt_utf8ItE16do_always_noconvEv - T _ZNKSt3__114__codecvt_utf8ItE5do_inER10_mbstate_tPKcS5_RS5_PtS7_RS7_ - T _ZNKSt3__114__codecvt_utf8ItE6do_outER10_mbstate_tPKtS5_RS5_PcS7_RS7_ - T _ZNKSt3__114__codecvt_utf8ItE9do_lengthER10_mbstate_tPKcS5_j + T _ZNKSt3__114__codecvt_utf8IDiE10do_unshiftER10_mbstate_tPcS4_RS4_ + T _ZNKSt3__114__codecvt_utf8IDiE11do_encodingEv + T _ZNKSt3__114__codecvt_utf8IDiE13do_max_lengthEv + T _ZNKSt3__114__codecvt_utf8IDiE16do_always_noconvEv + T _ZNKSt3__114__codecvt_utf8IDiE5do_inER10_mbstate_tPKcS5_RS5_PDiS7_RS7_ + T _ZNKSt3__114__codecvt_utf8IDiE6do_outER10_mbstate_tPKDiS5_RS5_PcS7_RS7_ + T _ZNKSt3__114__codecvt_utf8IDiE9do_lengthER10_mbstate_tPKcS5_j + T _ZNKSt3__114__codecvt_utf8IDsE10do_unshiftER10_mbstate_tPcS4_RS4_ + T _ZNKSt3__114__codecvt_utf8IDsE11do_encodingEv + T _ZNKSt3__114__codecvt_utf8IDsE13do_max_lengthEv + T _ZNKSt3__114__codecvt_utf8IDsE16do_always_noconvEv + T _ZNKSt3__114__codecvt_utf8IDsE5do_inER10_mbstate_tPKcS5_RS5_PDsS7_RS7_ + T _ZNKSt3__114__codecvt_utf8IDsE6do_outER10_mbstate_tPKDsS5_RS5_PcS7_RS7_ + T _ZNKSt3__114__codecvt_utf8IDsE9do_lengthER10_mbstate_tPKcS5_j T _ZNKSt3__114__codecvt_utf8IwE10do_unshiftER10_mbstate_tPcS4_RS4_ T _ZNKSt3__114__codecvt_utf8IwE11do_encodingEv T _ZNKSt3__114__codecvt_utf8IwE13do_max_lengthEv @@ -326,34 +302,34 @@ T _ZNKSt3__114error_category10equivalentERKNS_10error_codeEi T _ZNKSt3__114error_category10equivalentEiRKNS_15error_conditionE T _ZNKSt3__114error_category23default_error_conditionEi - T _ZNKSt3__115__codecvt_utf16IjLb0EE10do_unshiftER10_mbstate_tPcS4_RS4_ - T _ZNKSt3__115__codecvt_utf16IjLb0EE11do_encodingEv - T _ZNKSt3__115__codecvt_utf16IjLb0EE13do_max_lengthEv - T _ZNKSt3__115__codecvt_utf16IjLb0EE16do_always_noconvEv - T _ZNKSt3__115__codecvt_utf16IjLb0EE5do_inER10_mbstate_tPKcS5_RS5_PjS7_RS7_ - T _ZNKSt3__115__codecvt_utf16IjLb0EE6do_outER10_mbstate_tPKjS5_RS5_PcS7_RS7_ - T _ZNKSt3__115__codecvt_utf16IjLb0EE9do_lengthER10_mbstate_tPKcS5_j - T _ZNKSt3__115__codecvt_utf16IjLb1EE10do_unshiftER10_mbstate_tPcS4_RS4_ - T _ZNKSt3__115__codecvt_utf16IjLb1EE11do_encodingEv - T _ZNKSt3__115__codecvt_utf16IjLb1EE13do_max_lengthEv - T _ZNKSt3__115__codecvt_utf16IjLb1EE16do_always_noconvEv - T _ZNKSt3__115__codecvt_utf16IjLb1EE5do_inER10_mbstate_tPKcS5_RS5_PjS7_RS7_ - T _ZNKSt3__115__codecvt_utf16IjLb1EE6do_outER10_mbstate_tPKjS5_RS5_PcS7_RS7_ - T _ZNKSt3__115__codecvt_utf16IjLb1EE9do_lengthER10_mbstate_tPKcS5_j - T _ZNKSt3__115__codecvt_utf16ItLb0EE10do_unshiftER10_mbstate_tPcS4_RS4_ - T _ZNKSt3__115__codecvt_utf16ItLb0EE11do_encodingEv - T _ZNKSt3__115__codecvt_utf16ItLb0EE13do_max_lengthEv - T _ZNKSt3__115__codecvt_utf16ItLb0EE16do_always_noconvEv - T _ZNKSt3__115__codecvt_utf16ItLb0EE5do_inER10_mbstate_tPKcS5_RS5_PtS7_RS7_ - T _ZNKSt3__115__codecvt_utf16ItLb0EE6do_outER10_mbstate_tPKtS5_RS5_PcS7_RS7_ - T _ZNKSt3__115__codecvt_utf16ItLb0EE9do_lengthER10_mbstate_tPKcS5_j - T _ZNKSt3__115__codecvt_utf16ItLb1EE10do_unshiftER10_mbstate_tPcS4_RS4_ - T _ZNKSt3__115__codecvt_utf16ItLb1EE11do_encodingEv - T _ZNKSt3__115__codecvt_utf16ItLb1EE13do_max_lengthEv - T _ZNKSt3__115__codecvt_utf16ItLb1EE16do_always_noconvEv - T _ZNKSt3__115__codecvt_utf16ItLb1EE5do_inER10_mbstate_tPKcS5_RS5_PtS7_RS7_ - T _ZNKSt3__115__codecvt_utf16ItLb1EE6do_outER10_mbstate_tPKtS5_RS5_PcS7_RS7_ - T _ZNKSt3__115__codecvt_utf16ItLb1EE9do_lengthER10_mbstate_tPKcS5_j + T _ZNKSt3__115__codecvt_utf16IDiLb0EE10do_unshiftER10_mbstate_tPcS4_RS4_ + T _ZNKSt3__115__codecvt_utf16IDiLb0EE11do_encodingEv + T _ZNKSt3__115__codecvt_utf16IDiLb0EE13do_max_lengthEv + T _ZNKSt3__115__codecvt_utf16IDiLb0EE16do_always_noconvEv + T _ZNKSt3__115__codecvt_utf16IDiLb0EE5do_inER10_mbstate_tPKcS5_RS5_PDiS7_RS7_ + T _ZNKSt3__115__codecvt_utf16IDiLb0EE6do_outER10_mbstate_tPKDiS5_RS5_PcS7_RS7_ + T _ZNKSt3__115__codecvt_utf16IDiLb0EE9do_lengthER10_mbstate_tPKcS5_j + T _ZNKSt3__115__codecvt_utf16IDiLb1EE10do_unshiftER10_mbstate_tPcS4_RS4_ + T _ZNKSt3__115__codecvt_utf16IDiLb1EE11do_encodingEv + T _ZNKSt3__115__codecvt_utf16IDiLb1EE13do_max_lengthEv + T _ZNKSt3__115__codecvt_utf16IDiLb1EE16do_always_noconvEv + T _ZNKSt3__115__codecvt_utf16IDiLb1EE5do_inER10_mbstate_tPKcS5_RS5_PDiS7_RS7_ + T _ZNKSt3__115__codecvt_utf16IDiLb1EE6do_outER10_mbstate_tPKDiS5_RS5_PcS7_RS7_ + T _ZNKSt3__115__codecvt_utf16IDiLb1EE9do_lengthER10_mbstate_tPKcS5_j + T _ZNKSt3__115__codecvt_utf16IDsLb0EE10do_unshiftER10_mbstate_tPcS4_RS4_ + T _ZNKSt3__115__codecvt_utf16IDsLb0EE11do_encodingEv + T _ZNKSt3__115__codecvt_utf16IDsLb0EE13do_max_lengthEv + T _ZNKSt3__115__codecvt_utf16IDsLb0EE16do_always_noconvEv + T _ZNKSt3__115__codecvt_utf16IDsLb0EE5do_inER10_mbstate_tPKcS5_RS5_PDsS7_RS7_ + T _ZNKSt3__115__codecvt_utf16IDsLb0EE6do_outER10_mbstate_tPKDsS5_RS5_PcS7_RS7_ + T _ZNKSt3__115__codecvt_utf16IDsLb0EE9do_lengthER10_mbstate_tPKcS5_j + T _ZNKSt3__115__codecvt_utf16IDsLb1EE10do_unshiftER10_mbstate_tPcS4_RS4_ + T _ZNKSt3__115__codecvt_utf16IDsLb1EE11do_encodingEv + T _ZNKSt3__115__codecvt_utf16IDsLb1EE13do_max_lengthEv + T _ZNKSt3__115__codecvt_utf16IDsLb1EE16do_always_noconvEv + T _ZNKSt3__115__codecvt_utf16IDsLb1EE5do_inER10_mbstate_tPKcS5_RS5_PDsS7_RS7_ + T _ZNKSt3__115__codecvt_utf16IDsLb1EE6do_outER10_mbstate_tPKDsS5_RS5_PcS7_RS7_ + T _ZNKSt3__115__codecvt_utf16IDsLb1EE9do_lengthER10_mbstate_tPKcS5_j T _ZNKSt3__115__codecvt_utf16IwLb0EE10do_unshiftER10_mbstate_tPcS4_RS4_ T _ZNKSt3__115__codecvt_utf16IwLb0EE11do_encodingEv T _ZNKSt3__115__codecvt_utf16IwLb0EE13do_max_lengthEv @@ -442,20 +418,20 @@ T _ZNKSt3__119__iostream_category4nameEv T _ZNKSt3__119__iostream_category7messageEi T _ZNKSt3__119__shared_weak_count13__get_deleterERKSt9type_info - T _ZNKSt3__120__codecvt_utf8_utf16IjE10do_unshiftER10_mbstate_tPcS4_RS4_ - T _ZNKSt3__120__codecvt_utf8_utf16IjE11do_encodingEv - T _ZNKSt3__120__codecvt_utf8_utf16IjE13do_max_lengthEv - T _ZNKSt3__120__codecvt_utf8_utf16IjE16do_always_noconvEv - T _ZNKSt3__120__codecvt_utf8_utf16IjE5do_inER10_mbstate_tPKcS5_RS5_PjS7_RS7_ - T _ZNKSt3__120__codecvt_utf8_utf16IjE6do_outER10_mbstate_tPKjS5_RS5_PcS7_RS7_ - T _ZNKSt3__120__codecvt_utf8_utf16IjE9do_lengthER10_mbstate_tPKcS5_j - T _ZNKSt3__120__codecvt_utf8_utf16ItE10do_unshiftER10_mbstate_tPcS4_RS4_ - T _ZNKSt3__120__codecvt_utf8_utf16ItE11do_encodingEv - T _ZNKSt3__120__codecvt_utf8_utf16ItE13do_max_lengthEv - T _ZNKSt3__120__codecvt_utf8_utf16ItE16do_always_noconvEv - T _ZNKSt3__120__codecvt_utf8_utf16ItE5do_inER10_mbstate_tPKcS5_RS5_PtS7_RS7_ - T _ZNKSt3__120__codecvt_utf8_utf16ItE6do_outER10_mbstate_tPKtS5_RS5_PcS7_RS7_ - T _ZNKSt3__120__codecvt_utf8_utf16ItE9do_lengthER10_mbstate_tPKcS5_j + T _ZNKSt3__120__codecvt_utf8_utf16IDiE10do_unshiftER10_mbstate_tPcS4_RS4_ + T _ZNKSt3__120__codecvt_utf8_utf16IDiE11do_encodingEv + T _ZNKSt3__120__codecvt_utf8_utf16IDiE13do_max_lengthEv + T _ZNKSt3__120__codecvt_utf8_utf16IDiE16do_always_noconvEv + T _ZNKSt3__120__codecvt_utf8_utf16IDiE5do_inER10_mbstate_tPKcS5_RS5_PDiS7_RS7_ + T _ZNKSt3__120__codecvt_utf8_utf16IDiE6do_outER10_mbstate_tPKDiS5_RS5_PcS7_RS7_ + T _ZNKSt3__120__codecvt_utf8_utf16IDiE9do_lengthER10_mbstate_tPKcS5_j + T _ZNKSt3__120__codecvt_utf8_utf16IDsE10do_unshiftER10_mbstate_tPcS4_RS4_ + T _ZNKSt3__120__codecvt_utf8_utf16IDsE11do_encodingEv + T _ZNKSt3__120__codecvt_utf8_utf16IDsE13do_max_lengthEv + T _ZNKSt3__120__codecvt_utf8_utf16IDsE16do_always_noconvEv + T _ZNKSt3__120__codecvt_utf8_utf16IDsE5do_inER10_mbstate_tPKcS5_RS5_PDsS7_RS7_ + T _ZNKSt3__120__codecvt_utf8_utf16IDsE6do_outER10_mbstate_tPKDsS5_RS5_PcS7_RS7_ + T _ZNKSt3__120__codecvt_utf8_utf16IDsE9do_lengthER10_mbstate_tPKcS5_j T _ZNKSt3__120__codecvt_utf8_utf16IwE10do_unshiftER10_mbstate_tPcS4_RS4_ T _ZNKSt3__120__codecvt_utf8_utf16IwE11do_encodingEv T _ZNKSt3__120__codecvt_utf8_utf16IwE13do_max_lengthEv @@ -498,14 +474,14 @@ T _ZNKSt3__15ctypeIcE8do_widenEc T _ZNKSt3__15ctypeIcE9do_narrowEPKcS3_cPc T _ZNKSt3__15ctypeIcE9do_narrowEcc - T _ZNKSt3__15ctypeIwE10do_scan_isEjPKwS3_ + T _ZNKSt3__15ctypeIwE10do_scan_isEtPKwS3_ T _ZNKSt3__15ctypeIwE10do_tolowerEPwPKw T _ZNKSt3__15ctypeIwE10do_tolowerEw T _ZNKSt3__15ctypeIwE10do_toupperEPwPKw T _ZNKSt3__15ctypeIwE10do_toupperEw - T _ZNKSt3__15ctypeIwE11do_scan_notEjPKwS3_ - T _ZNKSt3__15ctypeIwE5do_isEPKwS3_Pj - T _ZNKSt3__15ctypeIwE5do_isEjw + T _ZNKSt3__15ctypeIwE11do_scan_notEtPKwS3_ + T _ZNKSt3__15ctypeIwE5do_isEPKwS3_Pt + T _ZNKSt3__15ctypeIwE5do_isEtw T _ZNKSt3__15ctypeIwE8do_widenEPKcS3_Pw T _ZNKSt3__15ctypeIwE8do_widenEc T _ZNKSt3__15ctypeIwE9do_narrowEPKwS3_cPc @@ -520,6 +496,20 @@ C _ZNKSt3__16vectorINS_4pairIPNS_18condition_variableEPNS_5mutexEEENS_18__hidden_allocatorIS6_EEE8max_sizeEv C _ZNKSt3__16vectorIPNS_17__assoc_sub_stateENS_18__hidden_allocatorIS2_EEE8max_sizeEv C _ZNKSt3__16vectorIPNS_6locale5facetENS_15__sso_allocatorIS3_Lj28EEEE8max_sizeEv + T _ZNKSt3__17codecvtIDic10_mbstate_tE10do_unshiftERS1_PcS4_RS4_ + T _ZNKSt3__17codecvtIDic10_mbstate_tE11do_encodingEv + T _ZNKSt3__17codecvtIDic10_mbstate_tE13do_max_lengthEv + T _ZNKSt3__17codecvtIDic10_mbstate_tE16do_always_noconvEv + T _ZNKSt3__17codecvtIDic10_mbstate_tE5do_inERS1_PKcS5_RS5_PDiS7_RS7_ + T _ZNKSt3__17codecvtIDic10_mbstate_tE6do_outERS1_PKDiS5_RS5_PcS7_RS7_ + T _ZNKSt3__17codecvtIDic10_mbstate_tE9do_lengthERS1_PKcS5_j + T _ZNKSt3__17codecvtIDsc10_mbstate_tE10do_unshiftERS1_PcS4_RS4_ + T _ZNKSt3__17codecvtIDsc10_mbstate_tE11do_encodingEv + T _ZNKSt3__17codecvtIDsc10_mbstate_tE13do_max_lengthEv + T _ZNKSt3__17codecvtIDsc10_mbstate_tE16do_always_noconvEv + T _ZNKSt3__17codecvtIDsc10_mbstate_tE5do_inERS1_PKcS5_RS5_PDsS7_RS7_ + T _ZNKSt3__17codecvtIDsc10_mbstate_tE6do_outERS1_PKDsS5_RS5_PcS7_RS7_ + T _ZNKSt3__17codecvtIDsc10_mbstate_tE9do_lengthERS1_PKcS5_j T _ZNKSt3__17codecvtIcc10_mbstate_tE10do_unshiftERS1_PcS4_RS4_ T _ZNKSt3__17codecvtIcc10_mbstate_tE11do_encodingEv T _ZNKSt3__17codecvtIcc10_mbstate_tE13do_max_lengthEv @@ -527,20 +517,6 @@ T _ZNKSt3__17codecvtIcc10_mbstate_tE5do_inERS1_PKcS5_RS5_PcS7_RS7_ T _ZNKSt3__17codecvtIcc10_mbstate_tE6do_outERS1_PKcS5_RS5_PcS7_RS7_ T _ZNKSt3__17codecvtIcc10_mbstate_tE9do_lengthERS1_PKcS5_j - T _ZNKSt3__17codecvtIjc10_mbstate_tE10do_unshiftERS1_PcS4_RS4_ - T _ZNKSt3__17codecvtIjc10_mbstate_tE11do_encodingEv - T _ZNKSt3__17codecvtIjc10_mbstate_tE13do_max_lengthEv - T _ZNKSt3__17codecvtIjc10_mbstate_tE16do_always_noconvEv - T _ZNKSt3__17codecvtIjc10_mbstate_tE5do_inERS1_PKcS5_RS5_PjS7_RS7_ - T _ZNKSt3__17codecvtIjc10_mbstate_tE6do_outERS1_PKjS5_RS5_PcS7_RS7_ - T _ZNKSt3__17codecvtIjc10_mbstate_tE9do_lengthERS1_PKcS5_j - T _ZNKSt3__17codecvtItc10_mbstate_tE10do_unshiftERS1_PcS4_RS4_ - T _ZNKSt3__17codecvtItc10_mbstate_tE11do_encodingEv - T _ZNKSt3__17codecvtItc10_mbstate_tE13do_max_lengthEv - T _ZNKSt3__17codecvtItc10_mbstate_tE16do_always_noconvEv - T _ZNKSt3__17codecvtItc10_mbstate_tE5do_inERS1_PKcS5_RS5_PtS7_RS7_ - T _ZNKSt3__17codecvtItc10_mbstate_tE6do_outERS1_PKtS5_RS5_PcS7_RS7_ - T _ZNKSt3__17codecvtItc10_mbstate_tE9do_lengthERS1_PKcS5_j T _ZNKSt3__17codecvtIwc10_mbstate_tE10do_unshiftERS1_PcS4_RS4_ T _ZNKSt3__17codecvtIwc10_mbstate_tE11do_encodingEv T _ZNKSt3__17codecvtIwc10_mbstate_tE13do_max_lengthEv @@ -767,37 +743,13 @@ W _ZNKSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE3putES4_bRNS_8ios_baseEwe W _ZNKSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_putES4_bRNS_8ios_baseEwRKNS_12basic_stringIwS3_NS_9allocatorIwEEEE W _ZNKSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_putES4_bRNS_8ios_baseEwe - T _ZNKSt9exception4whatEv - T _ZNSt10bad_typeidC1Ev - T _ZNSt10bad_typeidC2Ev - T _ZNSt10bad_typeidD0Ev - T _ZNSt10bad_typeidD1Ev - T _ZNSt10bad_typeidD2Ev T _ZNSt11logic_errorC1EPKc T _ZNSt11logic_errorC1ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE T _ZNSt11logic_errorC1ERKS_ T _ZNSt11logic_errorC2EPKc T _ZNSt11logic_errorC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE T _ZNSt11logic_errorC2ERKS_ - T _ZNSt11logic_errorD0Ev - T _ZNSt11logic_errorD1Ev - T _ZNSt11logic_errorD2Ev T _ZNSt11logic_erroraSERKS_ - T _ZNSt11range_errorD0Ev - ? _ZNSt11range_errorD1Ev - T _ZNSt11range_errorD2Ev - T _ZNSt12domain_errorD0Ev - ? _ZNSt12domain_errorD1Ev - T _ZNSt12domain_errorD2Ev - T _ZNSt12length_errorD0Ev - ? _ZNSt12length_errorD1Ev - T _ZNSt12length_errorD2Ev - T _ZNSt12out_of_rangeD0Ev - ? _ZNSt12out_of_rangeD1Ev - T _ZNSt12out_of_rangeD2Ev - T _ZNSt13bad_exceptionD0Ev - ? _ZNSt13bad_exceptionD1Ev - T _ZNSt13bad_exceptionD2Ev T _ZNSt13exception_ptrC1ERKS_ T _ZNSt13exception_ptrC2ERKS_ T _ZNSt13exception_ptrD1Ev @@ -809,19 +761,7 @@ T _ZNSt13runtime_errorC2EPKc T _ZNSt13runtime_errorC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE T _ZNSt13runtime_errorC2ERKS_ - T _ZNSt13runtime_errorD0Ev - T _ZNSt13runtime_errorD1Ev - T _ZNSt13runtime_errorD2Ev T _ZNSt13runtime_erroraSERKS_ - T _ZNSt14overflow_errorD0Ev - ? _ZNSt14overflow_errorD1Ev - T _ZNSt14overflow_errorD2Ev - T _ZNSt15underflow_errorD0Ev - ? _ZNSt15underflow_errorD1Ev - T _ZNSt15underflow_errorD2Ev - T _ZNSt16invalid_argumentD0Ev - ? _ZNSt16invalid_argumentD1Ev - T _ZNSt16invalid_argumentD2Ev T _ZNSt16nested_exceptionC1Ev T _ZNSt16nested_exceptionC2Ev T _ZNSt16nested_exceptionD0Ev @@ -863,29 +803,45 @@ T _ZNSt3__110__time_putD1Ev T _ZNSt3__110__time_putD2Ev D _ZNSt3__110adopt_lockE + D _ZNSt3__110ctype_base5alnumE + D _ZNSt3__110ctype_base5alphaE + D _ZNSt3__110ctype_base5blankE + D _ZNSt3__110ctype_base5cntrlE + D _ZNSt3__110ctype_base5digitE + D _ZNSt3__110ctype_base5graphE + D _ZNSt3__110ctype_base5lowerE + D _ZNSt3__110ctype_base5printE + D _ZNSt3__110ctype_base5punctE + D _ZNSt3__110ctype_base5spaceE + D _ZNSt3__110ctype_base5upperE + D _ZNSt3__110ctype_base6xdigitE D _ZNSt3__110defer_lockE T _ZNSt3__110istrstreamD0Ev T _ZNSt3__110istrstreamD1Ev T _ZNSt3__110istrstreamD2Ev W _ZNSt3__110moneypunctIcLb0EE2idE + W _ZNSt3__110moneypunctIcLb0EE4intlE W _ZNSt3__110moneypunctIcLb0EEC1Ej W _ZNSt3__110moneypunctIcLb0EEC2Ej W _ZNSt3__110moneypunctIcLb0EED0Ev W _ZNSt3__110moneypunctIcLb0EED1Ev W _ZNSt3__110moneypunctIcLb0EED2Ev W _ZNSt3__110moneypunctIcLb1EE2idE + W _ZNSt3__110moneypunctIcLb1EE4intlE W _ZNSt3__110moneypunctIcLb1EEC1Ej W _ZNSt3__110moneypunctIcLb1EEC2Ej W _ZNSt3__110moneypunctIcLb1EED0Ev W _ZNSt3__110moneypunctIcLb1EED1Ev W _ZNSt3__110moneypunctIcLb1EED2Ev W _ZNSt3__110moneypunctIwLb0EE2idE + W _ZNSt3__110moneypunctIwLb0EE4intlE W _ZNSt3__110moneypunctIwLb0EEC1Ej W _ZNSt3__110moneypunctIwLb0EEC2Ej W _ZNSt3__110moneypunctIwLb0EED0Ev W _ZNSt3__110moneypunctIwLb0EED1Ev W _ZNSt3__110moneypunctIwLb0EED2Ev W _ZNSt3__110moneypunctIwLb1EE2idE + W _ZNSt3__110moneypunctIwLb1EE4intlE W _ZNSt3__110moneypunctIwLb1EEC1Ej W _ZNSt3__110moneypunctIwLb1EEC2Ej W _ZNSt3__110moneypunctIwLb1EED0Ev @@ -903,10 +859,6 @@ T _ZNSt3__110to_wstringEm T _ZNSt3__110to_wstringEx T _ZNSt3__110to_wstringEy - T _ZNSt3__110unique_ptrINS_6locale5facetENS_12_GLOBAL__N_17releaseEEC1EPS2_ - t _ZNSt3__110unique_ptrINS_6locale5facetENS_12_GLOBAL__N_17releaseEEC2EPS2_ - T _ZNSt3__110unique_ptrINS_6locale5facetENS_12_GLOBAL__N_17releaseEED1Ev - t _ZNSt3__110unique_ptrINS_6locale5facetENS_12_GLOBAL__N_17releaseEED2Ev T _ZNSt3__111__call_onceERVmPvPFvS2_E T _ZNSt3__111__libcpp_db10__insert_cEPv T _ZNSt3__111__libcpp_db10__insert_iEPv @@ -969,38 +921,42 @@ C _ZNSt3__111unique_lockINS_5mutexEE6unlockEv t _ZNSt3__112_GLOBAL__N_110use_strcmpclERKNS0_10classnamesEPKc t _ZNSt3__112_GLOBAL__N_110use_strcmpclERKNS0_14collationnamesEPKc - T _ZNSt3__112_GLOBAL__N_111__fake_bindC1EMNS_6locale2idEFvvEPS3_ + t _ZNSt3__112_GLOBAL__N_111__fake_bindC1EMNS_6locale2idEFvvEPS3_ t _ZNSt3__112_GLOBAL__N_111__fake_bindC2EMNS_6locale2idEFvvEPS3_ t _ZNSt3__112_GLOBAL__N_13mutEv - t _ZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIcLb0EEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIcLb1EEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIwLb0EEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIwLb1EEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_5ctypeIcEEPjbiEERT_T0_T1_T2_ - t _ZNSt3__112_GLOBAL__N_14makeINS_5ctypeIwEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_6locale5__impEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_7codecvtIcc10_mbstate_tEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_7codecvtIjc10_mbstate_tEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_7codecvtItc10_mbstate_tEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_7codecvtIwc10_mbstate_tEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_7collateIcEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_7collateIwEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_7num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_7num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_7num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_7num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_8messagesIcEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_8messagesIwEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_8numpunctIcEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_8numpunctIwEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_8time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_8time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_8time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_8time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_9money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_9money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_9money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_ - t _ZNSt3__112_GLOBAL__N_14makeINS_9money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIcLb0EEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIcLb1EEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIwLb0EEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIwLb1EEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_5ctypeIcEEPtbjEERT_T0_T1_T2_ + t _ZNSt3__112_GLOBAL__N_14makeINS_5ctypeIwEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_6locale5__impEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_7codecvtIDic10_mbstate_tEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_7codecvtIDsc10_mbstate_tEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_7codecvtIcc10_mbstate_tEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_7codecvtIwc10_mbstate_tEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_7collateIcEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_7collateIwEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_7num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_7num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_7num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_7num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_8messagesIcEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_8messagesIwEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_8numpunctIcEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_8numpunctIwEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_8time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_8time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_8time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_8time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_9money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_9money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_9money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_14makeINS_9money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEjEERT_T0_ + t _ZNSt3__112_GLOBAL__N_17countofIcEEjPKT_S4_ + t _ZNSt3__112_GLOBAL__N_17countofIcLj100EEEjRAT0__KT_ + t _ZNSt3__112_GLOBAL__N_17countofIwEEjPKT_S4_ + t _ZNSt3__112_GLOBAL__N_17countofIwLj100EEEjRAT0__KT_ t _ZNSt3__112_GLOBAL__N_17releaseclEPNS_6locale5facetE t _ZNSt3__112_GLOBAL__N_19decrementIlEET_RS2_ t _ZNSt3__112_GLOBAL__N_19incrementIlEET_RS2_ @@ -1014,7 +970,10 @@ C _ZNSt3__112__do_messageD1Ev C _ZNSt3__112__do_messageD2Ev T _ZNSt3__112__do_nothingEPv + T _ZNSt3__112__get_sp_mutEPKv T _ZNSt3__112__next_primeEj + C _ZNSt3__112__rotate_gcdINS_11__wrap_iterIPcEEEET_S4_S4_S4_ + C _ZNSt3__112__rotate_gcdINS_11__wrap_iterIPwEEEET_S4_S4_S4_ D _ZNSt3__112__rs_default4__c_E T _ZNSt3__112__rs_defaultC1ERKS0_ T _ZNSt3__112__rs_defaultC1Ev @@ -1033,6 +992,8 @@ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE12__swap_allocERS4_S6_NS_17integral_constantIbLb0EEE W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE12__swap_allocERS4_S6_NS_17integral_constantIbLb1EEE W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE13__get_pointerEv + W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE13__move_assignERS5_NS_17integral_constantIbLb0EEE + W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE13__move_assignERS5_NS_17integral_constantIbLb1EEE W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE13shrink_to_fitEv W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE14__erase_to_endEj W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE14__set_long_capEj @@ -1071,13 +1032,17 @@ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEPKcj W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendERKS5_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendERKS5_jj + W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendESt16initializer_listIcE W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEjc C _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendIPcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueERS5_E4typeES9_S9_ + W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEOS5_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEPKc W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEPKcj W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignERKS5_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignERKS5_jj + W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignESt16initializer_listIcE W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEjc + W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertENS_11__wrap_iterIPKcEESt16initializer_listIcE W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertENS_11__wrap_iterIPKcEEc W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertENS_11__wrap_iterIPKcEEjc W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertEjPKc @@ -1085,6 +1050,7 @@ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertEjRKS5_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertEjRKS5_jj W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertEjjc + C _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertIPKcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueENS_11__wrap_iterIPcEEE4typeENSB_IS8_EESA_SA_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6rbeginEv W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6resizeEj W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6resizeEjc @@ -1092,16 +1058,20 @@ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceENS_11__wrap_iterIPKcEES9_RKS5_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceENS_11__wrap_iterIPKcEES9_S8_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceENS_11__wrap_iterIPKcEES9_S8_j + W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceENS_11__wrap_iterIPKcEES9_St16initializer_listIcE W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceENS_11__wrap_iterIPKcEES9_jc W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceEjjPKc W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceEjjPKcj W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceEjjRKS5_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceEjjRKS5_jj W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceEjjjc + C _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceIPKcEENS_9enable_ifIXsr19__is_input_iteratorIT_EE5valueERS5_E4typeENS_11__wrap_iterIS8_EESF_SA_SA_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEj W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE8pop_backEv W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEjjjjjj W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9push_backEc + W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1EOS5_ + W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1EOS5_RKS4_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1EPKc W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1EPKcRKS4_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1EPKcj @@ -1110,9 +1080,13 @@ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_RKS4_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_jjRKS4_ + W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ESt16initializer_listIcE + W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ESt16initializer_listIcERKS4_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1Ejc W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1EjcRKS4_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1Ev + W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2EOS5_ + W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2EOS5_RKS4_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2EPKc W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2EPKcRKS4_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2EPKcj @@ -1121,17 +1095,22 @@ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2ERKS5_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2ERKS5_RKS4_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2ERKS5_jjRKS4_ + W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2ESt16initializer_listIcE + W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2ESt16initializer_listIcERKS4_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2Ejc W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2EjcRKS4_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC2Ev W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED1Ev W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev + W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEaSEOS5_ W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEaSEPKc W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEaSERKS5_ + W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEaSESt16initializer_listIcE W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEaSEc W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEixEj W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEpLEPKc W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEpLERKS5_ + W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEpLESt16initializer_listIcE W _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEpLEc W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE10__set_sizeEj W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE11__recommendEj @@ -1139,6 +1118,8 @@ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE12__swap_allocERS4_S6_NS_17integral_constantIbLb0EEE W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE12__swap_allocERS4_S6_NS_17integral_constantIbLb1EEE W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE13__get_pointerEv + W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE13__move_assignERS5_NS_17integral_constantIbLb0EEE + W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE13__move_assignERS5_NS_17integral_constantIbLb1EEE W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE13shrink_to_fitEv W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE14__erase_to_endEj W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE14__set_long_capEj @@ -1177,14 +1158,18 @@ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6appendEPKwj W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6appendERKS5_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6appendERKS5_jj + W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6appendESt16initializer_listIwE W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6appendEjw C _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6appendIPwEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueERS5_E4typeES9_S9_ + W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6assignEOS5_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6assignEPKw W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6assignEPKwj W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6assignERKS5_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6assignERKS5_jj + W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6assignESt16initializer_listIwE W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6assignEjw C _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6assignIPwEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueERS5_E4typeES9_S9_ + W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6insertENS_11__wrap_iterIPKwEESt16initializer_listIwE W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6insertENS_11__wrap_iterIPKwEEjw W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6insertENS_11__wrap_iterIPKwEEw W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6insertEjPKw @@ -1192,6 +1177,7 @@ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6insertEjRKS5_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6insertEjRKS5_jj W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6insertEjjw + C _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6insertIPKwEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueENS_11__wrap_iterIPwEEE4typeENSB_IS8_EESA_SA_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6rbeginEv W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6resizeEj W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6resizeEjw @@ -1199,16 +1185,20 @@ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceENS_11__wrap_iterIPKwEES9_RKS5_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceENS_11__wrap_iterIPKwEES9_S8_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceENS_11__wrap_iterIPKwEES9_S8_j + W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceENS_11__wrap_iterIPKwEES9_St16initializer_listIwE W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceENS_11__wrap_iterIPKwEES9_jw W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceEjjPKw W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceEjjPKwj W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceEjjRKS5_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceEjjRKS5_jj W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceEjjjw + C _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceIPKwEENS_9enable_ifIXsr19__is_input_iteratorIT_EE5valueERS5_E4typeENS_11__wrap_iterIS8_EESF_SA_SA_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7reserveEj W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE8pop_backEv W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE9__grow_byEjjjjjj W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE9push_backEw + W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1EOS5_ + W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1EOS5_RKS4_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1EPKw W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1EPKwRKS4_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1EPKwj @@ -1217,9 +1207,13 @@ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1ERKS5_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1ERKS5_RKS4_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1ERKS5_jjRKS4_ + W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1ESt16initializer_listIwE + W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1ESt16initializer_listIwERKS4_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1Ejw W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1EjwRKS4_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC1Ev + W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2EOS5_ + W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2EOS5_RKS4_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2EPKw W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2EPKwRKS4_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2EPKwj @@ -1228,17 +1222,22 @@ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2ERKS5_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2ERKS5_RKS4_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2ERKS5_jjRKS4_ + W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2ESt16initializer_listIwE + W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2ESt16initializer_listIwERKS4_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2Ejw W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2EjwRKS4_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2Ev W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEED1Ev W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEED2Ev + W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEaSEOS5_ W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEaSEPKw W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEaSERKS5_ + W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEaSESt16initializer_listIwE W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEaSEw W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEixEj W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEpLEPKw W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEpLERKS5_ + W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEpLESt16initializer_listIwE W _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEpLEw T _ZNSt3__112ctype_bynameIcEC1EPKcj T _ZNSt3__112ctype_bynameIcEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj @@ -1318,6 +1317,8 @@ t _ZNSt3__113__lower_boundIRNS_12_GLOBAL__N_110use_strcmpEPKNS1_10classnamesEPKcEET0_S9_S9_RKT1_T_ t _ZNSt3__113__lower_boundIRNS_12_GLOBAL__N_110use_strcmpEPKNS1_14collationnamesEPKcEET0_S9_S9_RKT1_T_ C _ZNSt3__113__lower_boundIRNS_6__lessIjjEEPKjjEET0_S6_S6_RKT1_T_ + C _ZNSt3__113__rotate_leftINS_11__wrap_iterIPcEEEET_S4_S4_ + C _ZNSt3__113__rotate_leftINS_11__wrap_iterIPwEEEET_S4_S4_ C _ZNSt3__113__vector_baseINS_4pairIPNS_18condition_variableEPNS_5mutexEEENS_18__hidden_allocatorIS6_EEED2Ev C _ZNSt3__113__vector_baseIPNS_17__assoc_sub_stateENS_18__hidden_allocatorIS2_EEED2Ev C _ZNSt3__113__vector_baseIPNS_6locale5facetENS_15__sso_allocatorIS3_Lj28EEEED2Ev @@ -1343,11 +1344,14 @@ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE7getlineEPcic W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE7putbackEc W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE8readsomeEPci + W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEEC1EOS3_ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEEC1EPNS_15basic_streambufIcS2_EE + W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEEC2EOS3_ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEEC2EPNS_15basic_streambufIcS2_EE W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEED0Ev W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEED1Ev W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEED2Ev + W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEEaSEOS3_ W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRNS_8ios_baseES5_E W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRNS_9basic_iosIcS2_EES6_E W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRS3_S4_E @@ -1386,11 +1390,14 @@ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE7getlineEPwiw W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE7putbackEw W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE8readsomeEPwi + W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEEC1EOS3_ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEEC1EPNS_15basic_streambufIwS2_EE + W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEEC2EOS3_ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEEC2EPNS_15basic_streambufIwS2_EE W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEED0Ev W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEED1Ev W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEED2Ev + W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEEaSEOS3_ W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsEPFRNS_8ios_baseES5_E W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsEPFRNS_9basic_iosIwS2_EES6_E W _ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsEPFRS3_S4_E @@ -1419,13 +1426,16 @@ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryC2ERS3_ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryD1Ev W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryD2Ev + W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEEC1EOS3_ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEEC1EPNS_15basic_streambufIcS2_EE W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEEC1Ev + W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEEC2EOS3_ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEEC2EPNS_15basic_streambufIcS2_EE W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEEC2Ev W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEED0Ev W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEED1Ev W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEED2Ev + W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEEaSEOS3_ W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPFRNS_8ios_baseES5_E W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPFRNS_9basic_iosIcS2_EES6_E W _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPFRS3_S4_E @@ -1454,13 +1464,16 @@ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE6sentryC2ERS3_ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE6sentryD1Ev W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE6sentryD2Ev + W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEEC1EOS3_ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEEC1EPNS_15basic_streambufIwS2_EE W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEEC1Ev + W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEEC2EOS3_ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEEC2EPNS_15basic_streambufIwS2_EE W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEEC2Ev W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEED0Ev W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEED1Ev W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEED2Ev + W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEEaSEOS3_ W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEPFRNS_8ios_baseES5_E W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEPFRNS_9basic_iosIwS2_EES6_E W _ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEPFRS3_S4_E @@ -1488,12 +1501,12 @@ T _ZNSt3__113shared_futureIvED1Ev T _ZNSt3__113shared_futureIvED2Ev T _ZNSt3__113shared_futureIvEaSERKS1_ - C _ZNSt3__114__codecvt_utf8IjED0Ev - C _ZNSt3__114__codecvt_utf8IjED1Ev - C _ZNSt3__114__codecvt_utf8IjED2Ev - C _ZNSt3__114__codecvt_utf8ItED0Ev - C _ZNSt3__114__codecvt_utf8ItED1Ev - C _ZNSt3__114__codecvt_utf8ItED2Ev + C _ZNSt3__114__codecvt_utf8IDiED0Ev + C _ZNSt3__114__codecvt_utf8IDiED1Ev + C _ZNSt3__114__codecvt_utf8IDiED2Ev + C _ZNSt3__114__codecvt_utf8IDsED0Ev + C _ZNSt3__114__codecvt_utf8IDsED1Ev + C _ZNSt3__114__codecvt_utf8IDsED2Ev C _ZNSt3__114__codecvt_utf8IwED0Ev C _ZNSt3__114__codecvt_utf8IwED1Ev C _ZNSt3__114__codecvt_utf8IwED2Ev @@ -1503,10 +1516,10 @@ T _ZNSt3__114__num_put_base12__format_intEPcPKcbj T _ZNSt3__114__num_put_base14__format_floatEPcPKcj T _ZNSt3__114__num_put_base18__identify_paddingEPcS1_RKNS_8ios_baseE + C _ZNSt3__114__rotate_rightINS_11__wrap_iterIPcEEEET_S4_S4_ + C _ZNSt3__114__rotate_rightINS_11__wrap_iterIPwEEEET_S4_S4_ C _ZNSt3__114__scan_keywordINS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEPKNS_12basic_stringIcS3_NS_9allocatorIcEEEENS_5ctypeIcEEEET0_RT_SE_SD_SD_RKT1_Rjb - C _ZNSt3__114__scan_keywordINS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEPNS_12basic_stringIcS3_NS_9allocatorIcEEEENS_5ctypeIcEEEET0_RT_SD_SC_SC_RKT1_Rjb C _ZNSt3__114__scan_keywordINS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEPKNS_12basic_stringIwS3_NS_9allocatorIwEEEENS_5ctypeIwEEEET0_RT_SE_SD_SD_RKT1_Rjb - C _ZNSt3__114__scan_keywordINS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEPNS_12basic_stringIwS3_NS_9allocatorIwEEEENS_5ctypeIwEEEET0_RT_SD_SC_SC_RKT1_Rjb C _ZNSt3__114__scan_keywordIPcPNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_5ctypeIcEEEET0_RT_SC_SB_SB_RKT1_Rjb C _ZNSt3__114__scan_keywordIPwPNS_12basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEENS_5ctypeIwEEEET0_RT_SC_SB_SB_RKT1_Rjb T _ZNSt3__114__shared_count12__add_sharedEv @@ -1514,31 +1527,42 @@ T _ZNSt3__114__shared_countD0Ev T _ZNSt3__114__shared_countD1Ev T _ZNSt3__114__shared_countD2Ev - C _ZNSt3__114__split_bufferINS_4pairIPNS_18condition_variableEPNS_5mutexEEERNS_18__hidden_allocatorIS6_EEE10push_frontERKS6_ - C _ZNSt3__114__split_bufferINS_4pairIPNS_18condition_variableEPNS_5mutexEEERNS_18__hidden_allocatorIS6_EEE18__construct_at_endINS_13move_iteratorIPS6_EEEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeESG_SG_ C _ZNSt3__114__split_bufferINS_4pairIPNS_18condition_variableEPNS_5mutexEEERNS_18__hidden_allocatorIS6_EEEC1EjjS9_ C _ZNSt3__114__split_bufferINS_4pairIPNS_18condition_variableEPNS_5mutexEEERNS_18__hidden_allocatorIS6_EEEC2EjjS9_ C _ZNSt3__114__split_bufferINS_4pairIPNS_18condition_variableEPNS_5mutexEEERNS_18__hidden_allocatorIS6_EEED1Ev C _ZNSt3__114__split_bufferINS_4pairIPNS_18condition_variableEPNS_5mutexEEERNS_18__hidden_allocatorIS6_EEED2Ev - C _ZNSt3__114__split_bufferIPNS_17__assoc_sub_stateERNS_18__hidden_allocatorIS2_EEE10push_frontERKS2_ - C _ZNSt3__114__split_bufferIPNS_17__assoc_sub_stateERNS_18__hidden_allocatorIS2_EEE18__construct_at_endINS_13move_iteratorIPS2_EEEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeESC_SC_ C _ZNSt3__114__split_bufferIPNS_17__assoc_sub_stateERNS_18__hidden_allocatorIS2_EEEC1EjjS5_ C _ZNSt3__114__split_bufferIPNS_17__assoc_sub_stateERNS_18__hidden_allocatorIS2_EEEC2EjjS5_ C _ZNSt3__114__split_bufferIPNS_17__assoc_sub_stateERNS_18__hidden_allocatorIS2_EEED1Ev C _ZNSt3__114__split_bufferIPNS_17__assoc_sub_stateERNS_18__hidden_allocatorIS2_EEED2Ev - C _ZNSt3__114__split_bufferIPNS_6locale5facetERNS_15__sso_allocatorIS3_Lj28EEEE10push_frontERKS3_ C _ZNSt3__114__split_bufferIPNS_6locale5facetERNS_15__sso_allocatorIS3_Lj28EEEE18__construct_at_endEj - C _ZNSt3__114__split_bufferIPNS_6locale5facetERNS_15__sso_allocatorIS3_Lj28EEEE18__construct_at_endINS_13move_iteratorIPS3_EEEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeESD_SD_ C _ZNSt3__114__split_bufferIPNS_6locale5facetERNS_15__sso_allocatorIS3_Lj28EEEEC1EjjS6_ C _ZNSt3__114__split_bufferIPNS_6locale5facetERNS_15__sso_allocatorIS3_Lj28EEEEC2EjjS6_ C _ZNSt3__114__split_bufferIPNS_6locale5facetERNS_15__sso_allocatorIS3_Lj28EEEED1Ev C _ZNSt3__114__split_bufferIPNS_6locale5facetERNS_15__sso_allocatorIS3_Lj28EEEED2Ev W _ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEE4swapERS3_ + W _ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEEC1EOS3_ W _ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEEC1EPNS_15basic_streambufIcS2_EE + W _ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEEC2EOS3_ W _ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEEC2EPNS_15basic_streambufIcS2_EE W _ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEED0Ev W _ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEED1Ev W _ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEED2Ev + W _ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEEaSEOS3_ + W _ZNSt3__114codecvt_bynameIDic10_mbstate_tEC1EPKcj + W _ZNSt3__114codecvt_bynameIDic10_mbstate_tEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj + W _ZNSt3__114codecvt_bynameIDic10_mbstate_tEC2EPKcj + W _ZNSt3__114codecvt_bynameIDic10_mbstate_tEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj + W _ZNSt3__114codecvt_bynameIDic10_mbstate_tED0Ev + W _ZNSt3__114codecvt_bynameIDic10_mbstate_tED1Ev + W _ZNSt3__114codecvt_bynameIDic10_mbstate_tED2Ev + W _ZNSt3__114codecvt_bynameIDsc10_mbstate_tEC1EPKcj + W _ZNSt3__114codecvt_bynameIDsc10_mbstate_tEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj + W _ZNSt3__114codecvt_bynameIDsc10_mbstate_tEC2EPKcj + W _ZNSt3__114codecvt_bynameIDsc10_mbstate_tEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj + W _ZNSt3__114codecvt_bynameIDsc10_mbstate_tED0Ev + W _ZNSt3__114codecvt_bynameIDsc10_mbstate_tED1Ev + W _ZNSt3__114codecvt_bynameIDsc10_mbstate_tED2Ev W _ZNSt3__114codecvt_bynameIcc10_mbstate_tEC1EPKcj W _ZNSt3__114codecvt_bynameIcc10_mbstate_tEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj W _ZNSt3__114codecvt_bynameIcc10_mbstate_tEC2EPKcj @@ -1546,20 +1570,6 @@ W _ZNSt3__114codecvt_bynameIcc10_mbstate_tED0Ev W _ZNSt3__114codecvt_bynameIcc10_mbstate_tED1Ev W _ZNSt3__114codecvt_bynameIcc10_mbstate_tED2Ev - W _ZNSt3__114codecvt_bynameIjc10_mbstate_tEC1EPKcj - W _ZNSt3__114codecvt_bynameIjc10_mbstate_tEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj - W _ZNSt3__114codecvt_bynameIjc10_mbstate_tEC2EPKcj - W _ZNSt3__114codecvt_bynameIjc10_mbstate_tEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj - W _ZNSt3__114codecvt_bynameIjc10_mbstate_tED0Ev - W _ZNSt3__114codecvt_bynameIjc10_mbstate_tED1Ev - W _ZNSt3__114codecvt_bynameIjc10_mbstate_tED2Ev - W _ZNSt3__114codecvt_bynameItc10_mbstate_tEC1EPKcj - W _ZNSt3__114codecvt_bynameItc10_mbstate_tEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj - W _ZNSt3__114codecvt_bynameItc10_mbstate_tEC2EPKcj - W _ZNSt3__114codecvt_bynameItc10_mbstate_tEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj - W _ZNSt3__114codecvt_bynameItc10_mbstate_tED0Ev - W _ZNSt3__114codecvt_bynameItc10_mbstate_tED1Ev - W _ZNSt3__114codecvt_bynameItc10_mbstate_tED2Ev W _ZNSt3__114codecvt_bynameIwc10_mbstate_tEC1EPKcj W _ZNSt3__114codecvt_bynameIwc10_mbstate_tEC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj W _ZNSt3__114codecvt_bynameIwc10_mbstate_tEC2EPKcj @@ -1585,18 +1595,18 @@ T _ZNSt3__114error_categoryD0Ev T _ZNSt3__114error_categoryD1Ev T _ZNSt3__114error_categoryD2Ev - C _ZNSt3__115__codecvt_utf16IjLb0EED0Ev - C _ZNSt3__115__codecvt_utf16IjLb0EED1Ev - C _ZNSt3__115__codecvt_utf16IjLb0EED2Ev - C _ZNSt3__115__codecvt_utf16IjLb1EED0Ev - C _ZNSt3__115__codecvt_utf16IjLb1EED1Ev - C _ZNSt3__115__codecvt_utf16IjLb1EED2Ev - C _ZNSt3__115__codecvt_utf16ItLb0EED0Ev - C _ZNSt3__115__codecvt_utf16ItLb0EED1Ev - C _ZNSt3__115__codecvt_utf16ItLb0EED2Ev - C _ZNSt3__115__codecvt_utf16ItLb1EED0Ev - C _ZNSt3__115__codecvt_utf16ItLb1EED1Ev - C _ZNSt3__115__codecvt_utf16ItLb1EED2Ev + C _ZNSt3__115__codecvt_utf16IDiLb0EED0Ev + C _ZNSt3__115__codecvt_utf16IDiLb0EED1Ev + C _ZNSt3__115__codecvt_utf16IDiLb0EED2Ev + C _ZNSt3__115__codecvt_utf16IDiLb1EED0Ev + C _ZNSt3__115__codecvt_utf16IDiLb1EED1Ev + C _ZNSt3__115__codecvt_utf16IDiLb1EED2Ev + C _ZNSt3__115__codecvt_utf16IDsLb0EED0Ev + C _ZNSt3__115__codecvt_utf16IDsLb0EED1Ev + C _ZNSt3__115__codecvt_utf16IDsLb0EED2Ev + C _ZNSt3__115__codecvt_utf16IDsLb1EED0Ev + C _ZNSt3__115__codecvt_utf16IDsLb1EED1Ev + C _ZNSt3__115__codecvt_utf16IDsLb1EED2Ev C _ZNSt3__115__codecvt_utf16IwLb0EED0Ev C _ZNSt3__115__codecvt_utf16IwLb0EED1Ev C _ZNSt3__115__codecvt_utf16IwLb0EED2Ev @@ -1726,7 +1736,7 @@ T _ZNSt3__115numpunct_bynameIcEC2EPKcj T _ZNSt3__115numpunct_bynameIcEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj T _ZNSt3__115numpunct_bynameIcED0Ev - ? _ZNSt3__115numpunct_bynameIcED1Ev + T _ZNSt3__115numpunct_bynameIcED1Ev T _ZNSt3__115numpunct_bynameIcED2Ev T _ZNSt3__115numpunct_bynameIwE6__initEPKc T _ZNSt3__115numpunct_bynameIwEC1EPKcj @@ -1734,7 +1744,7 @@ T _ZNSt3__115numpunct_bynameIwEC2EPKcj T _ZNSt3__115numpunct_bynameIwEC2ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEj T _ZNSt3__115numpunct_bynameIwED0Ev - ? _ZNSt3__115numpunct_bynameIwED1Ev + T _ZNSt3__115numpunct_bynameIwED1Ev T _ZNSt3__115numpunct_bynameIwED2Ev T _ZNSt3__115recursive_mutex4lockEv T _ZNSt3__115recursive_mutex6unlockEv @@ -1774,13 +1784,13 @@ W _ZNSt3__115time_put_bynameIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEED2Ev T _ZNSt3__116__check_groupingERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPjS8_Rj T _ZNSt3__116__narrow_to_utf8ILj16EED0Ev - ? _ZNSt3__116__narrow_to_utf8ILj16EED1Ev - ? _ZNSt3__116__narrow_to_utf8ILj16EED2Ev + T _ZNSt3__116__narrow_to_utf8ILj16EED1Ev + T _ZNSt3__116__narrow_to_utf8ILj16EED2Ev T _ZNSt3__116__narrow_to_utf8ILj32EED0Ev - ? _ZNSt3__116__narrow_to_utf8ILj32EED1Ev - ? _ZNSt3__116__narrow_to_utf8ILj32EED2Ev - C _ZNSt3__116__pad_and_outputIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEET0_S5_PKT_S8_S8_RNS_8ios_baseES6_ - C _ZNSt3__116__pad_and_outputIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEET0_S5_PKT_S8_S8_RNS_8ios_baseES6_ + T _ZNSt3__116__narrow_to_utf8ILj32EED1Ev + T _ZNSt3__116__narrow_to_utf8ILj32EED2Ev + C _ZNSt3__116__pad_and_outputIcNS_11char_traitsIcEEEENS_19ostreambuf_iteratorIT_T0_EES6_PKS4_S8_S8_RNS_8ios_baseES4_ + C _ZNSt3__116__pad_and_outputIwNS_11char_traitsIwEEEENS_19ostreambuf_iteratorIT_T0_EES6_PKS4_S8_S8_RNS_8ios_baseES4_ T _ZNSt3__116generic_categoryEv T _ZNSt3__117__assoc_sub_state10__sub_waitERNS_11unique_lockINS_5mutexEEE T _ZNSt3__117__assoc_sub_state12__make_readyEv @@ -1795,17 +1805,13 @@ C _ZNSt3__117__assoc_sub_stateD0Ev C _ZNSt3__117__assoc_sub_stateD1Ev C _ZNSt3__117__assoc_sub_stateD2Ev - T _ZNSt3__117__call_once_paramINS_12_GLOBAL__N_111__fake_bindEEC1ERKS2_ - t _ZNSt3__117__call_once_paramINS_12_GLOBAL__N_111__fake_bindEEC2ERKS2_ - t _ZNSt3__117__call_once_proxyINS_12_GLOBAL__N_111__fake_bindEEEvPv - T _ZNSt3__117__compressed_pairIPNS_6locale5facetENS_12_GLOBAL__N_17releaseEEC1ES3_i - t _ZNSt3__117__compressed_pairIPNS_6locale5facetENS_12_GLOBAL__N_17releaseEEC2ES3_i + t _ZNSt3__117__call_once_proxyINS_5tupleIJNS_12_GLOBAL__N_111__fake_bindEEEEEEvPv T _ZNSt3__117__widen_from_utf8ILj16EED0Ev - ? _ZNSt3__117__widen_from_utf8ILj16EED1Ev - ? _ZNSt3__117__widen_from_utf8ILj16EED2Ev + T _ZNSt3__117__widen_from_utf8ILj16EED1Ev + T _ZNSt3__117__widen_from_utf8ILj16EED2Ev T _ZNSt3__117__widen_from_utf8ILj32EED0Ev - ? _ZNSt3__117__widen_from_utf8ILj32EED1Ev - ? _ZNSt3__117__widen_from_utf8ILj32EED2Ev + T _ZNSt3__117__widen_from_utf8ILj32EED1Ev + T _ZNSt3__117__widen_from_utf8ILj32EED2Ev T _ZNSt3__117declare_reachableEPv T _ZNSt3__117iostream_categoryEv T _ZNSt3__117moneypunct_bynameIcLb0EE4initEPKc @@ -1892,7 +1898,7 @@ T _ZNSt3__119__shared_weak_count16__release_sharedEv T _ZNSt3__119__shared_weak_count4lockEv T _ZNSt3__119__shared_weak_countD0Ev - ? _ZNSt3__119__shared_weak_countD1Ev + T _ZNSt3__119__shared_weak_countD1Ev T _ZNSt3__119__shared_weak_countD2Ev D _ZNSt3__119__start_std_streamsE T _ZNSt3__119__thread_local_dataEv @@ -1904,12 +1910,12 @@ T _ZNSt3__119__thread_struct_impD2Ev T _ZNSt3__119declare_no_pointersEPcj D _ZNSt3__119piecewise_constructE - C _ZNSt3__120__codecvt_utf8_utf16IjED0Ev - C _ZNSt3__120__codecvt_utf8_utf16IjED1Ev - C _ZNSt3__120__codecvt_utf8_utf16IjED2Ev - C _ZNSt3__120__codecvt_utf8_utf16ItED0Ev - C _ZNSt3__120__codecvt_utf8_utf16ItED1Ev - C _ZNSt3__120__codecvt_utf8_utf16ItED2Ev + C _ZNSt3__120__codecvt_utf8_utf16IDiED0Ev + C _ZNSt3__120__codecvt_utf8_utf16IDiED1Ev + C _ZNSt3__120__codecvt_utf8_utf16IDiED2Ev + C _ZNSt3__120__codecvt_utf8_utf16IDsED0Ev + C _ZNSt3__120__codecvt_utf8_utf16IDsED1Ev + C _ZNSt3__120__codecvt_utf8_utf16IDsED2Ev C _ZNSt3__120__codecvt_utf8_utf16IwED0Ev C _ZNSt3__120__codecvt_utf8_utf16IwED1Ev C _ZNSt3__120__codecvt_utf8_utf16IwED2Ev @@ -1923,6 +1929,7 @@ C _ZNSt3__120__time_get_c_storageIwEC2Ev W _ZNSt3__120__vector_base_commonILb1EEC1Ev W _ZNSt3__120__vector_base_commonILb1EEC2Ev + C _ZNSt3__121__murmur2_or_cityhashIjLj32EEclEPKvj C _ZNSt3__121__thread_specific_ptrINS_15__thread_structEE16__at_thread_exitEPv C _ZNSt3__121__thread_specific_ptrINS_15__thread_structEEC1Ev C _ZNSt3__121__thread_specific_ptrINS_15__thread_structEEC2Ev @@ -1996,14 +2003,14 @@ T _ZNSt3__15ctypeIcE21__classic_lower_tableEv T _ZNSt3__15ctypeIcE21__classic_upper_tableEv D _ZNSt3__15ctypeIcE2idE - T _ZNSt3__15ctypeIcEC1EPKjbj - T _ZNSt3__15ctypeIcEC2EPKjbj + T _ZNSt3__15ctypeIcEC1EPKtbj + T _ZNSt3__15ctypeIcEC2EPKtbj T _ZNSt3__15ctypeIcED0Ev T _ZNSt3__15ctypeIcED1Ev T _ZNSt3__15ctypeIcED2Ev D _ZNSt3__15ctypeIwE2idE T _ZNSt3__15ctypeIwED0Ev - ? _ZNSt3__15ctypeIwED1Ev + T _ZNSt3__15ctypeIwED1Ev T _ZNSt3__15ctypeIwED2Ev T _ZNSt3__15mutex4lockEv T _ZNSt3__15mutex6unlockEv @@ -2036,8 +2043,10 @@ W _ZNSt3__16__sortIRNS_6__lessIxxEEPxEEvT0_S5_T_ W _ZNSt3__16__sortIRNS_6__lessIyyEEPyEEvT0_S5_T_ T _ZNSt3__16chrono12steady_clock3nowEv + D _ZNSt3__16chrono12steady_clock9is_steadyE T _ZNSt3__16chrono12system_clock11from_time_tEl T _ZNSt3__16chrono12system_clock3nowEv + D _ZNSt3__16chrono12system_clock9is_steadyE T _ZNSt3__16chrono12system_clock9to_time_tERKNS0_10time_pointIS1_NS0_8durationIxNS_5ratioILx1ELx1000000EEEEEEE T _ZNSt3__16futureIvE3getEv T _ZNSt3__16futureIvEC1EPNS_17__assoc_sub_stateE @@ -2049,6 +2058,9 @@ T _ZNSt3__16locale2id5__getEv T _ZNSt3__16locale2id6__initEv D _ZNSt3__16locale2id9__next_idE + D _ZNSt3__16locale3allE + D _ZNSt3__16locale4noneE + D _ZNSt3__16locale4timeE T _ZNSt3__16locale5__imp11make_globalEv C _ZNSt3__16locale5__imp12install_fromINS_10moneypunctIcLb0EEEEEvRKS1_ C _ZNSt3__16locale5__imp12install_fromINS_10moneypunctIcLb1EEEEEvRKS1_ @@ -2056,9 +2068,9 @@ C _ZNSt3__16locale5__imp12install_fromINS_10moneypunctIwLb1EEEEEvRKS1_ C _ZNSt3__16locale5__imp12install_fromINS_5ctypeIcEEEEvRKS1_ C _ZNSt3__16locale5__imp12install_fromINS_5ctypeIwEEEEvRKS1_ + C _ZNSt3__16locale5__imp12install_fromINS_7codecvtIDic10_mbstate_tEEEEvRKS1_ + C _ZNSt3__16locale5__imp12install_fromINS_7codecvtIDsc10_mbstate_tEEEEvRKS1_ C _ZNSt3__16locale5__imp12install_fromINS_7codecvtIcc10_mbstate_tEEEEvRKS1_ - C _ZNSt3__16locale5__imp12install_fromINS_7codecvtIjc10_mbstate_tEEEEvRKS1_ - C _ZNSt3__16locale5__imp12install_fromINS_7codecvtItc10_mbstate_tEEEEvRKS1_ C _ZNSt3__16locale5__imp12install_fromINS_7codecvtIwc10_mbstate_tEEEEvRKS1_ C _ZNSt3__16locale5__imp12install_fromINS_7collateIcEEEEvRKS1_ C _ZNSt3__16locale5__imp12install_fromINS_7collateIwEEEEvRKS1_ @@ -2086,9 +2098,9 @@ C _ZNSt3__16locale5__imp7installINS_10moneypunctIwLb1EEEEEvPT_ C _ZNSt3__16locale5__imp7installINS_12ctype_bynameIcEEEEvPT_ C _ZNSt3__16locale5__imp7installINS_12ctype_bynameIwEEEEvPT_ + C _ZNSt3__16locale5__imp7installINS_14codecvt_bynameIDic10_mbstate_tEEEEvPT_ + C _ZNSt3__16locale5__imp7installINS_14codecvt_bynameIDsc10_mbstate_tEEEEvPT_ C _ZNSt3__16locale5__imp7installINS_14codecvt_bynameIcc10_mbstate_tEEEEvPT_ - C _ZNSt3__16locale5__imp7installINS_14codecvt_bynameIjc10_mbstate_tEEEEvPT_ - C _ZNSt3__16locale5__imp7installINS_14codecvt_bynameItc10_mbstate_tEEEEvPT_ C _ZNSt3__16locale5__imp7installINS_14codecvt_bynameIwc10_mbstate_tEEEEvPT_ C _ZNSt3__16locale5__imp7installINS_14collate_bynameIcEEEEvPT_ C _ZNSt3__16locale5__imp7installINS_14collate_bynameIwEEEEvPT_ @@ -2106,9 +2118,9 @@ C _ZNSt3__16locale5__imp7installINS_17moneypunct_bynameIwLb1EEEEEvPT_ C _ZNSt3__16locale5__imp7installINS_5ctypeIcEEEEvPT_ C _ZNSt3__16locale5__imp7installINS_5ctypeIwEEEEvPT_ + C _ZNSt3__16locale5__imp7installINS_7codecvtIDic10_mbstate_tEEEEvPT_ + C _ZNSt3__16locale5__imp7installINS_7codecvtIDsc10_mbstate_tEEEEvPT_ C _ZNSt3__16locale5__imp7installINS_7codecvtIcc10_mbstate_tEEEEvPT_ - C _ZNSt3__16locale5__imp7installINS_7codecvtIjc10_mbstate_tEEEEvPT_ - C _ZNSt3__16locale5__imp7installINS_7codecvtItc10_mbstate_tEEEEvPT_ C _ZNSt3__16locale5__imp7installINS_7codecvtIwc10_mbstate_tEEEEvPT_ C _ZNSt3__16locale5__imp7installINS_7collateIcEEEEvPT_ C _ZNSt3__16locale5__imp7installINS_7collateIwEEEEvPT_ @@ -2143,13 +2155,18 @@ T _ZNSt3__16locale5__impD0Ev T _ZNSt3__16locale5__impD1Ev T _ZNSt3__16locale5__impD2Ev + D _ZNSt3__16locale5ctypeE T _ZNSt3__16locale5facet16__on_zero_sharedEv T _ZNSt3__16locale5facetD0Ev T _ZNSt3__16locale5facetD1Ev T _ZNSt3__16locale5facetD2Ev T _ZNSt3__16locale6globalERKS0_ T _ZNSt3__16locale7classicEv + D _ZNSt3__16locale7collateE + D _ZNSt3__16locale7numericE T _ZNSt3__16locale8__globalEv + D _ZNSt3__16locale8messagesE + D _ZNSt3__16locale8monetaryE T _ZNSt3__16localeC1EPKc T _ZNSt3__16localeC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE T _ZNSt3__16localeC1ERKS0_ @@ -2174,9 +2191,11 @@ T _ZNSt3__16thread6detachEv T _ZNSt3__16threadD1Ev T _ZNSt3__16threadD2Ev + C _ZNSt3__16vectorINS_4pairIPNS_18condition_variableEPNS_5mutexEEENS_18__hidden_allocatorIS6_EEE21__push_back_slow_pathIS6_EEvOT_ C _ZNSt3__16vectorINS_4pairIPNS_18condition_variableEPNS_5mutexEEENS_18__hidden_allocatorIS6_EEE26__swap_out_circular_bufferERNS_14__split_bufferIS6_RS8_EE C _ZNSt3__16vectorINS_4pairIPNS_18condition_variableEPNS_5mutexEEENS_18__hidden_allocatorIS6_EEED1Ev C _ZNSt3__16vectorINS_4pairIPNS_18condition_variableEPNS_5mutexEEENS_18__hidden_allocatorIS6_EEED2Ev + C _ZNSt3__16vectorIPNS_17__assoc_sub_stateENS_18__hidden_allocatorIS2_EEE21__push_back_slow_pathIRKS2_EEvOT_ C _ZNSt3__16vectorIPNS_17__assoc_sub_stateENS_18__hidden_allocatorIS2_EEE26__swap_out_circular_bufferERNS_14__split_bufferIS2_RS4_EE C _ZNSt3__16vectorIPNS_17__assoc_sub_stateENS_18__hidden_allocatorIS2_EEED1Ev C _ZNSt3__16vectorIPNS_17__assoc_sub_stateENS_18__hidden_allocatorIS2_EEED2Ev @@ -2237,18 +2256,18 @@ C _ZNSt3__17__sort5IRNS_6__lessIwwEEPwEEjT0_S5_S5_S5_S5_T_ C _ZNSt3__17__sort5IRNS_6__lessIxxEEPxEEjT0_S5_S5_S5_S5_T_ C _ZNSt3__17__sort5IRNS_6__lessIyyEEPyEEjT0_S5_S5_S5_S5_T_ + D _ZNSt3__17codecvtIDic10_mbstate_tE2idE + T _ZNSt3__17codecvtIDic10_mbstate_tED0Ev + T _ZNSt3__17codecvtIDic10_mbstate_tED1Ev + T _ZNSt3__17codecvtIDic10_mbstate_tED2Ev + D _ZNSt3__17codecvtIDsc10_mbstate_tE2idE + T _ZNSt3__17codecvtIDsc10_mbstate_tED0Ev + T _ZNSt3__17codecvtIDsc10_mbstate_tED1Ev + T _ZNSt3__17codecvtIDsc10_mbstate_tED2Ev D _ZNSt3__17codecvtIcc10_mbstate_tE2idE T _ZNSt3__17codecvtIcc10_mbstate_tED0Ev - ? _ZNSt3__17codecvtIcc10_mbstate_tED1Ev + T _ZNSt3__17codecvtIcc10_mbstate_tED1Ev T _ZNSt3__17codecvtIcc10_mbstate_tED2Ev - D _ZNSt3__17codecvtIjc10_mbstate_tE2idE - T _ZNSt3__17codecvtIjc10_mbstate_tED0Ev - ? _ZNSt3__17codecvtIjc10_mbstate_tED1Ev - T _ZNSt3__17codecvtIjc10_mbstate_tED2Ev - D _ZNSt3__17codecvtItc10_mbstate_tE2idE - T _ZNSt3__17codecvtItc10_mbstate_tED0Ev - ? _ZNSt3__17codecvtItc10_mbstate_tED1Ev - T _ZNSt3__17codecvtItc10_mbstate_tED2Ev D _ZNSt3__17codecvtIwc10_mbstate_tE2idE T _ZNSt3__17codecvtIwc10_mbstate_tEC1EPKcj T _ZNSt3__17codecvtIwc10_mbstate_tEC1Ej @@ -2313,6 +2332,10 @@ T _ZNSt3__18__rs_getEv C _ZNSt3__18__searchIRNS_11__traits_eqINS_11char_traitsIcEEEEPKcS7_EET0_S8_S8_T1_S9_T_NS_26random_access_iterator_tagESB_ C _ZNSt3__18__searchIRNS_11__traits_eqINS_11char_traitsIwEEEEPKwS7_EET0_S8_S8_T1_S9_T_NS_26random_access_iterator_tagESB_ + T _ZNSt3__18__sp_mut4lockEv + T _ZNSt3__18__sp_mut6unlockEv + C _ZNSt3__18__sp_mutC1EPv + C _ZNSt3__18__sp_mutC2EPv D _ZNSt3__18ios_base10floatfieldE D _ZNSt3__18ios_base10scientificE D _ZNSt3__18ios_base11adjustfieldE @@ -2447,6 +2470,7 @@ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEE3tieEPNS_13basic_ostreamIcS2_EE W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEE4fillEc W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEE4initEPNS_15basic_streambufIcS2_EE + W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEE4moveEOS3_ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEE4moveERS3_ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEE4swapERS3_ W _ZNSt3__19basic_iosIcNS_11char_traitsIcEEE5clearEj @@ -2466,6 +2490,7 @@ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEE3tieEPNS_13basic_ostreamIwS2_EE W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEE4fillEw W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEE4initEPNS_15basic_streambufIwS2_EE + W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEE4moveEOS3_ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEE4moveERS3_ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEE4swapERS3_ W _ZNSt3__19basic_iosIwNS_11char_traitsIwEEE5clearEj @@ -2519,7 +2544,8 @@ T _ZNSt3__19to_stringEm T _ZNSt3__19to_stringEx T _ZNSt3__19to_stringEy - t _ZNSt3__1L10__init_patERNS_10money_base7patternEccc + t _ZNSt3__1L10__init_patIcEEvRNS_10money_base7patternERNS_12basic_stringIT_NS_11char_traitsIS5_EENS_9allocatorIS5_EEEEbcccS5_ + t _ZNSt3__1L10__init_patIwEEvRNS_10money_base7patternERNS_12basic_stringIT_NS_11char_traitsIS5_EENS_9allocatorIS5_EEEEbcccS5_ t _ZNSt3__1L10init_am_pmEv t _ZNSt3__1L10init_weeksEv t _ZNSt3__1L11init_monthsEv @@ -2559,19 +2585,12 @@ d _ZNSt3__1L7__wcerrE d _ZNSt3__1L7__wcoutE d _ZNSt3__1L8__rs_mutE + d _ZNSt3__1L8mut_backE W _ZNSt3__1plIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_12basic_stringIT_T0_T1_EEPKS6_RKS9_ - T _ZNSt9exceptionD0Ev - T _ZNSt9exceptionD1Ev - T _ZNSt9exceptionD2Ev - T _ZSt10unexpectedv - T _ZSt13get_terminatev - T _ZSt13set_terminatePFvvE - T _ZSt14get_unexpectedv - T _ZSt14set_unexpectedPFvvE T _ZSt17current_exceptionv T _ZSt17rethrow_exceptionSt13exception_ptr C _ZSt18make_exception_ptrINSt3__112future_errorEESt13exception_ptrT_ - D _ZSt7nothrow + T _ZSt18uncaught_exceptionv D _ZTCNSt3__110istrstreamE0_NS_13basic_istreamIcNS_11char_traitsIcEEEE D _ZTCNSt3__110ostrstreamE0_NS_13basic_ostreamIcNS_11char_traitsIcEEEE W _ZTCNSt3__114basic_iostreamIcNS_11char_traitsIcEEEE0_NS_13basic_istreamIcS2_EE @@ -2611,24 +2630,24 @@ W _ZTINSt3__113basic_ostreamIcNS_11char_traitsIcEEEE W _ZTINSt3__113basic_ostreamIwNS_11char_traitsIwEEEE C _ZTINSt3__113messages_baseE - D _ZTINSt3__114__codecvt_utf8IjEE - D _ZTINSt3__114__codecvt_utf8ItEE + D _ZTINSt3__114__codecvt_utf8IDiEE + D _ZTINSt3__114__codecvt_utf8IDsEE D _ZTINSt3__114__codecvt_utf8IwEE C _ZTINSt3__114__num_get_baseE C _ZTINSt3__114__num_put_baseE D _ZTINSt3__114__shared_countE W _ZTINSt3__114basic_iostreamIcNS_11char_traitsIcEEEE + W _ZTINSt3__114codecvt_bynameIDic10_mbstate_tEE + W _ZTINSt3__114codecvt_bynameIDsc10_mbstate_tEE W _ZTINSt3__114codecvt_bynameIcc10_mbstate_tEE - W _ZTINSt3__114codecvt_bynameIjc10_mbstate_tEE - W _ZTINSt3__114codecvt_bynameItc10_mbstate_tEE W _ZTINSt3__114codecvt_bynameIwc10_mbstate_tEE D _ZTINSt3__114collate_bynameIcEE D _ZTINSt3__114collate_bynameIwEE D _ZTINSt3__114error_categoryE - D _ZTINSt3__115__codecvt_utf16IjLb0EEE - D _ZTINSt3__115__codecvt_utf16IjLb1EEE - D _ZTINSt3__115__codecvt_utf16ItLb0EEE - D _ZTINSt3__115__codecvt_utf16ItLb1EEE + D _ZTINSt3__115__codecvt_utf16IDiLb0EEE + D _ZTINSt3__115__codecvt_utf16IDiLb1EEE + D _ZTINSt3__115__codecvt_utf16IDsLb0EEE + D _ZTINSt3__115__codecvt_utf16IDsLb1EEE D _ZTINSt3__115__codecvt_utf16IwLb0EEE D _ZTINSt3__115__codecvt_utf16IwLb1EEE C _ZTINSt3__115__time_get_tempIcEE @@ -2656,8 +2675,8 @@ C _ZTINSt3__118__time_get_storageIwEE D _ZTINSt3__119__iostream_categoryE D _ZTINSt3__119__shared_weak_countE - D _ZTINSt3__120__codecvt_utf8_utf16IjEE - D _ZTINSt3__120__codecvt_utf8_utf16ItEE + D _ZTINSt3__120__codecvt_utf8_utf16IDiEE + D _ZTINSt3__120__codecvt_utf8_utf16IDsEE D _ZTINSt3__120__codecvt_utf8_utf16IwEE C _ZTINSt3__120__time_get_c_storageIcEE C _ZTINSt3__120__time_get_c_storageIwEE @@ -2668,9 +2687,9 @@ D _ZTINSt3__15ctypeIwEE D _ZTINSt3__16locale5__impE D _ZTINSt3__16locale5facetE + D _ZTINSt3__17codecvtIDic10_mbstate_tEE + D _ZTINSt3__17codecvtIDsc10_mbstate_tEE D _ZTINSt3__17codecvtIcc10_mbstate_tEE - D _ZTINSt3__17codecvtIjc10_mbstate_tEE - D _ZTINSt3__17codecvtItc10_mbstate_tEE D _ZTINSt3__17codecvtIwc10_mbstate_tEE W _ZTINSt3__17collateIcEE W _ZTINSt3__17collateIwEE @@ -2701,19 +2720,7 @@ W _ZTINSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEE D _ZTINSt3__19strstreamE C _ZTINSt3__19time_baseE - D _ZTISt10bad_typeid - D _ZTISt11logic_error - D _ZTISt11range_error - D _ZTISt12domain_error - D _ZTISt12length_error - D _ZTISt12out_of_range - D _ZTISt13bad_exception - D _ZTISt13runtime_error - D _ZTISt14overflow_error - D _ZTISt15underflow_error - D _ZTISt16invalid_argument D _ZTISt16nested_exception - D _ZTISt9exception C _ZTSNSt3__110__stdinbufIcEE C _ZTSNSt3__110__stdinbufIwEE C _ZTSNSt3__110__time_getE @@ -2746,24 +2753,24 @@ W _ZTSNSt3__113basic_ostreamIcNS_11char_traitsIcEEEE W _ZTSNSt3__113basic_ostreamIwNS_11char_traitsIwEEEE C _ZTSNSt3__113messages_baseE - D _ZTSNSt3__114__codecvt_utf8IjEE - D _ZTSNSt3__114__codecvt_utf8ItEE + D _ZTSNSt3__114__codecvt_utf8IDiEE + D _ZTSNSt3__114__codecvt_utf8IDsEE D _ZTSNSt3__114__codecvt_utf8IwEE C _ZTSNSt3__114__num_get_baseE C _ZTSNSt3__114__num_put_baseE D _ZTSNSt3__114__shared_countE W _ZTSNSt3__114basic_iostreamIcNS_11char_traitsIcEEEE + W _ZTSNSt3__114codecvt_bynameIDic10_mbstate_tEE + W _ZTSNSt3__114codecvt_bynameIDsc10_mbstate_tEE W _ZTSNSt3__114codecvt_bynameIcc10_mbstate_tEE - W _ZTSNSt3__114codecvt_bynameIjc10_mbstate_tEE - W _ZTSNSt3__114codecvt_bynameItc10_mbstate_tEE W _ZTSNSt3__114codecvt_bynameIwc10_mbstate_tEE D _ZTSNSt3__114collate_bynameIcEE D _ZTSNSt3__114collate_bynameIwEE D _ZTSNSt3__114error_categoryE - D _ZTSNSt3__115__codecvt_utf16IjLb0EEE - D _ZTSNSt3__115__codecvt_utf16IjLb1EEE - D _ZTSNSt3__115__codecvt_utf16ItLb0EEE - D _ZTSNSt3__115__codecvt_utf16ItLb1EEE + D _ZTSNSt3__115__codecvt_utf16IDiLb0EEE + D _ZTSNSt3__115__codecvt_utf16IDiLb1EEE + D _ZTSNSt3__115__codecvt_utf16IDsLb0EEE + D _ZTSNSt3__115__codecvt_utf16IDsLb1EEE D _ZTSNSt3__115__codecvt_utf16IwLb0EEE D _ZTSNSt3__115__codecvt_utf16IwLb1EEE C _ZTSNSt3__115__time_get_tempIcEE @@ -2791,8 +2798,8 @@ C _ZTSNSt3__118__time_get_storageIwEE D _ZTSNSt3__119__iostream_categoryE D _ZTSNSt3__119__shared_weak_countE - D _ZTSNSt3__120__codecvt_utf8_utf16IjEE - D _ZTSNSt3__120__codecvt_utf8_utf16ItEE + D _ZTSNSt3__120__codecvt_utf8_utf16IDiEE + D _ZTSNSt3__120__codecvt_utf8_utf16IDsEE D _ZTSNSt3__120__codecvt_utf8_utf16IwEE C _ZTSNSt3__120__time_get_c_storageIcEE C _ZTSNSt3__120__time_get_c_storageIwEE @@ -2803,9 +2810,9 @@ D _ZTSNSt3__15ctypeIwEE D _ZTSNSt3__16locale5__impE D _ZTSNSt3__16locale5facetE + D _ZTSNSt3__17codecvtIDic10_mbstate_tEE + D _ZTSNSt3__17codecvtIDsc10_mbstate_tEE D _ZTSNSt3__17codecvtIcc10_mbstate_tEE - D _ZTSNSt3__17codecvtIjc10_mbstate_tEE - D _ZTSNSt3__17codecvtItc10_mbstate_tEE D _ZTSNSt3__17codecvtIwc10_mbstate_tEE W _ZTSNSt3__17collateIcEE W _ZTSNSt3__17collateIwEE @@ -2836,19 +2843,7 @@ W _ZTSNSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEE D _ZTSNSt3__19strstreamE C _ZTSNSt3__19time_baseE - D _ZTSSt10bad_typeid - D _ZTSSt11logic_error - D _ZTSSt11range_error - D _ZTSSt12domain_error - D _ZTSSt12length_error - D _ZTSSt12out_of_range - D _ZTSSt13bad_exception - D _ZTSSt13runtime_error - D _ZTSSt14overflow_error - D _ZTSSt15underflow_error - D _ZTSSt16invalid_argument D _ZTSSt16nested_exception - D _ZTSSt9exception D _ZTTNSt3__110istrstreamE D _ZTTNSt3__110ostrstreamE W _ZTTNSt3__113basic_istreamIcNS_11char_traitsIcEEEE @@ -2879,22 +2874,22 @@ W _ZTVNSt3__113basic_istreamIwNS_11char_traitsIwEEEE W _ZTVNSt3__113basic_ostreamIcNS_11char_traitsIcEEEE W _ZTVNSt3__113basic_ostreamIwNS_11char_traitsIwEEEE - D _ZTVNSt3__114__codecvt_utf8IjEE - D _ZTVNSt3__114__codecvt_utf8ItEE + D _ZTVNSt3__114__codecvt_utf8IDiEE + D _ZTVNSt3__114__codecvt_utf8IDsEE D _ZTVNSt3__114__codecvt_utf8IwEE D _ZTVNSt3__114__shared_countE W _ZTVNSt3__114basic_iostreamIcNS_11char_traitsIcEEEE + W _ZTVNSt3__114codecvt_bynameIDic10_mbstate_tEE + W _ZTVNSt3__114codecvt_bynameIDsc10_mbstate_tEE W _ZTVNSt3__114codecvt_bynameIcc10_mbstate_tEE - W _ZTVNSt3__114codecvt_bynameIjc10_mbstate_tEE - W _ZTVNSt3__114codecvt_bynameItc10_mbstate_tEE W _ZTVNSt3__114codecvt_bynameIwc10_mbstate_tEE D _ZTVNSt3__114collate_bynameIcEE D _ZTVNSt3__114collate_bynameIwEE D _ZTVNSt3__114error_categoryE - D _ZTVNSt3__115__codecvt_utf16IjLb0EEE - D _ZTVNSt3__115__codecvt_utf16IjLb1EEE - D _ZTVNSt3__115__codecvt_utf16ItLb0EEE - D _ZTVNSt3__115__codecvt_utf16ItLb1EEE + D _ZTVNSt3__115__codecvt_utf16IDiLb0EEE + D _ZTVNSt3__115__codecvt_utf16IDiLb1EEE + D _ZTVNSt3__115__codecvt_utf16IDsLb0EEE + D _ZTVNSt3__115__codecvt_utf16IDsLb1EEE D _ZTVNSt3__115__codecvt_utf16IwLb0EEE D _ZTVNSt3__115__codecvt_utf16IwLb1EEE C _ZTVNSt3__115__time_get_tempIcEE @@ -2920,8 +2915,8 @@ W _ZTVNSt3__117moneypunct_bynameIwLb1EEE D _ZTVNSt3__119__iostream_categoryE D _ZTVNSt3__119__shared_weak_countE - D _ZTVNSt3__120__codecvt_utf8_utf16IjEE - D _ZTVNSt3__120__codecvt_utf8_utf16ItEE + D _ZTVNSt3__120__codecvt_utf8_utf16IDiEE + D _ZTVNSt3__120__codecvt_utf8_utf16IDsEE D _ZTVNSt3__120__codecvt_utf8_utf16IwEE C _ZTVNSt3__120__time_get_c_storageIcEE C _ZTVNSt3__120__time_get_c_storageIwEE @@ -2932,9 +2927,9 @@ D _ZTVNSt3__15ctypeIwEE D _ZTVNSt3__16locale5__impE D _ZTVNSt3__16locale5facetE + D _ZTVNSt3__17codecvtIDic10_mbstate_tEE + D _ZTVNSt3__17codecvtIDsc10_mbstate_tEE D _ZTVNSt3__17codecvtIcc10_mbstate_tEE - D _ZTVNSt3__17codecvtIjc10_mbstate_tEE - D _ZTVNSt3__17codecvtItc10_mbstate_tEE D _ZTVNSt3__17codecvtIwc10_mbstate_tEE W _ZTVNSt3__17collateIcEE W _ZTVNSt3__17collateIwEE @@ -2960,19 +2955,7 @@ W _ZTVNSt3__19money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEE W _ZTVNSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEE D _ZTVNSt3__19strstreamE - D _ZTVSt10bad_typeid - D _ZTVSt11logic_error - D _ZTVSt11range_error - D _ZTVSt12domain_error - D _ZTVSt12length_error - D _ZTVSt12out_of_range - D _ZTVSt13bad_exception - D _ZTVSt13runtime_error - D _ZTVSt14overflow_error - D _ZTVSt15underflow_error - D _ZTVSt16invalid_argument D _ZTVSt16nested_exception - D _ZTVSt9exception W _ZThn8_NKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3__XEv W _ZThn8_NKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3__cEv W _ZThn8_NKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3__rEv @@ -3022,49 +3005,50 @@ d _ZZNKSt3__120__time_get_c_storageIwE7__weeksEvE5weeks d _ZZNKSt3__120__time_get_c_storageIwE8__monthsEvE6months d _ZZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE11do_get_timeES4_S4_RNS_8ios_baseERjP2tmE5__fmt - d _ZZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt - d _ZZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt11 - d _ZZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt12 - d _ZZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt13 - d _ZZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt14 + d _ZZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE4__fm + d _ZZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE4__fm5 + d _ZZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE4__fm6 + d _ZZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE4__fm7 + d _ZZNKSt3__18time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE4__fm8 d _ZZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE11do_get_timeES4_S4_RNS_8ios_baseERjP2tmE5__fmt - d _ZZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt - d _ZZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt16 - d _ZZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt17 - d _ZZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt18 - d _ZZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE5__fmt19 + d _ZZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE4__fm + d _ZZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE4__fm10 + d _ZZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE4__fm11 + d _ZZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE4__fm12 + d _ZZNKSt3__18time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_RNS_8ios_baseERjP2tmccE4__fm9 d _ZZNKSt3__19money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_getES4_S4_bRNS_8ios_baseERjReE5__src d _ZZNKSt3__19money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_getES4_S4_bRNS_8ios_baseERjReE5__src d _ZZNSt3__112_GLOBAL__N_13mutEvE1m - d _ZZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIcLb0EEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIcLb1EEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIwLb0EEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIwLb1EEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_5ctypeIcEEPjbiEERT_T0_T1_T2_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_5ctypeIwEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_6locale5__impEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_7codecvtIcc10_mbstate_tEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_7codecvtIjc10_mbstate_tEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_7codecvtItc10_mbstate_tEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_7codecvtIwc10_mbstate_tEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_7collateIcEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_7collateIwEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_7num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_7num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_7num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_7num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_8messagesIcEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_8messagesIwEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_8numpunctIcEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_8numpunctIwEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_8time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_8time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_8time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_8time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_9money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_9money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_9money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEiEERT_T0_E3buf - d _ZZNSt3__112_GLOBAL__N_14makeINS_9money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEiEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIcLb0EEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIcLb1EEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIwLb0EEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_10moneypunctIwLb1EEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_5ctypeIcEEPtbjEERT_T0_T1_T2_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_5ctypeIwEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_6locale5__impEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_7codecvtIDic10_mbstate_tEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_7codecvtIDsc10_mbstate_tEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_7codecvtIcc10_mbstate_tEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_7codecvtIwc10_mbstate_tEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_7collateIcEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_7collateIwEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_7num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_7num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_7num_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_7num_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_8messagesIcEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_8messagesIwEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_8numpunctIcEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_8numpunctIwEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_8time_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_8time_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_8time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_8time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_9money_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_9money_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_9money_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEEEjEERT_T0_E3buf + d _ZZNSt3__112_GLOBAL__N_14makeINS_9money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEEEjEERT_T0_E3buf + d _ZZNSt3__112__get_sp_mutEPKvE4muts d _ZZNSt3__112__rs_defaultclEvE6__rs_g d _ZZNSt3__115future_categoryEvE3__f d _ZZNSt3__115system_categoryEvE1s @@ -3086,3 +3070,13 @@ d _ZZNSt3__1L11init_wam_pmEvE5am_pm d _ZZNSt3__1L11init_wweeksEvE5weeks d _ZZNSt3__1L12init_wmonthsEvE6months + t __cxx_global_array_dtor + t __cxx_global_array_dtor105 + t __cxx_global_array_dtor120 + t __cxx_global_array_dtor281 + t __cxx_global_array_dtor53 + t __cxx_global_array_dtor56 + t __cxx_global_array_dtor81 + t __cxx_global_var_init + t __cxx_global_var_init22 + D llvm.global_ctors diff --git a/system/lib/libcxx/thread.cpp b/system/lib/libcxx/thread.cpp index b07f8f8510721..a2d95bb295368 100644 --- a/system/lib/libcxx/thread.cpp +++ b/system/lib/libcxx/thread.cpp @@ -11,10 +11,15 @@ #include "exception" #include "vector" #include "future" +#include "limits" #include #if !_WIN32 +#if !__sun__ && !__linux__ #include -#endif // _WIN32 +#else +#include +#endif // !__sun__ && !__linux__ +#endif // !_WIN32 _LIBCPP_BEGIN_NAMESPACE_STD @@ -52,14 +57,23 @@ thread::detach() } unsigned -thread::hardware_concurrency() +thread::hardware_concurrency() _NOEXCEPT { #if defined(CTL_HW) && defined(HW_NCPU) - int n; + unsigned n; int mib[2] = {CTL_HW, HW_NCPU}; 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)) || defined(EMSCRIPTEN) + long result = sysconf(_SC_NPROCESSORS_ONLN); + // sysconf returns -1 if the name is invalid, the option does not exist or + // does not have a definite limit. + // if sysconf returns some other negative number, we have no idea + // what is going on. Default to something safe. + if (result < 0) + return 0; + return static_cast(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 +88,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/system/lib/libcxx/typeinfo.cpp b/system/lib/libcxx/typeinfo.cpp index 9ca03a183e9c6..6bab0771f4273 100644 --- a/system/lib/libcxx/typeinfo.cpp +++ b/system/lib/libcxx/typeinfo.cpp @@ -7,12 +7,21 @@ // //===----------------------------------------------------------------------===// #include + +#ifndef __has_include +#define __has_include(inc) 0 +#endif + #if __APPLE__ #include +#elif defined(LIBCXXRT) || __has_include() +#include #endif #include "typeinfo" +#if !(defined(_LIBCPPABI_VERSION) || defined(LIBCXXRT)) + std::bad_cast::bad_cast() _NOEXCEPT { } @@ -48,3 +57,4 @@ std::bad_typeid::what() const _NOEXCEPT void __cxxabiv1::__cxa_bad_cast() { throw std::bad_cast(); } #endif +#endif // _LIBCPPABI_VERSION diff --git a/system/lib/libcxx/utility.cpp b/system/lib/libcxx/utility.cpp index 7dccffb73e5a3..e9830e7c24f01 100644 --- a/system/lib/libcxx/utility.cpp +++ b/system/lib/libcxx/utility.cpp @@ -7,6 +7,7 @@ // //===----------------------------------------------------------------------===// +#define _LIBCPP_BUILDING_UTILITY #include "utility" _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/system/lib/libcxxabi/CREDITS.TXT b/system/lib/libcxxabi/CREDITS.TXT index 231dfd334593e..5446562a71522 100644 --- a/system/lib/libcxxabi/CREDITS.TXT +++ b/system/lib/libcxxabi/CREDITS.TXT @@ -32,3 +32,7 @@ D: Minor patches and fixes N: Nowar Gu E: wenhan.gu@gmail.com D: Minor patches and fixes + +N: Bruce Mitchener, Jr. +E: bruce.mitchener@gmail.com +D: Minor typo fixes diff --git a/system/lib/libcxxabi/LICENSE.TXT b/system/lib/libcxxabi/LICENSE.TXT index 40ce7c7dc19fb..b04ba2c96daad 100644 --- a/system/lib/libcxxabi/LICENSE.TXT +++ b/system/lib/libcxxabi/LICENSE.TXT @@ -14,7 +14,7 @@ Full text of the relevant licenses is included below. University of Illinois/NCSA Open Source License -Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT +Copyright (c) 2009-2013 by the contributors listed in CREDITS.TXT All rights reserved. @@ -55,7 +55,7 @@ SOFTWARE. ============================================================================== -Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT +Copyright (c) 2009-2013 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 diff --git a/system/lib/libcxxabi/Makefile b/system/lib/libcxxabi/Makefile deleted file mode 100644 index 62654ef283978..0000000000000 --- a/system/lib/libcxxabi/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -OBJECTS = \ - src/private_typeinfo.bc \ - $(NULL) - #src/cxa_vector.bc \ - #src/cxa_virtual.bc \ - #src/temporary.bc \ - #src/cxa_guard.bc \ - #src/cxa_unexpected.bc \ - #src/cxa_exception.bc \ - #src/cxa_aux_runtime.bc \ - #src/exception.bc \ - #src/stdexcept.bc \ - #src/abort_message.bc \ - #src/cxa_personality.bc \ - #src/cxa_new_delete.bc \ - #src/cxa_handlers.bc \ - #src/cxa_exception_storage.bc \ - #src/typeinfo.bc \ - #src/cxa_demangle.bc - -all: libcxxabi.bc - -%.bc: %.cpp - $(CXX) -I./include $< -o $@ - -libcxxabi.bc: $(OBJECTS) - $(CXX) $(OBJECTS) -o libcxxabi.bc - diff --git a/system/lib/libcxxabi/readme.txt b/system/lib/libcxxabi/readme.txt index fde423c0935f2..f55da87c4b310 100644 --- a/system/lib/libcxxabi/readme.txt +++ b/system/lib/libcxxabi/readme.txt @@ -1 +1 @@ -These files are from libcxxabi, svn revision 169402, Dec 10 2012 +These files are from libcxxabi, svn revision 175275, Feb 15, 2013. diff --git a/system/lib/libcxxabi/src/cxa_exception.cpp b/system/lib/libcxxabi/src/cxa_exception.cpp index 1c36299395b3e..f8c38c07565d7 100644 --- a/system/lib/libcxxabi/src/cxa_exception.cpp +++ b/system/lib/libcxxabi/src/cxa_exception.cpp @@ -524,7 +524,7 @@ __cxa_decrement_exception_refcount(void* thrown_object) throw() /* Returns a pointer to the thrown object (if any) at the top of the - caughtExceptions stack. Atommically increment the exception's referenceCount. + caughtExceptions stack. Atomically increment the exception's referenceCount. If there is no such thrown object or if the thrown object is foreign, returns null. @@ -573,7 +573,7 @@ dependent_exception_cleanup(_Unwind_Reason_Code reason, _Unwind_Exception* unwin } /* - If thrown_object is not null, allocate, initialize and thow a dependent + If thrown_object is not null, allocate, initialize and throw a dependent exception. */ void diff --git a/system/lib/libcxxabi/src/cxa_exception_storage.cpp b/system/lib/libcxxabi/src/cxa_exception_storage.cpp index 2c269c7fbd35d..b0b5524045ee0 100644 --- a/system/lib/libcxxabi/src/cxa_exception_storage.cpp +++ b/system/lib/libcxxabi/src/cxa_exception_storage.cpp @@ -75,7 +75,7 @@ extern "C" { } // Note that this implementation will reliably return NULL if not - // preceeded by a call to __cxa_get_globals(). This is an extension + // preceded by a call to __cxa_get_globals(). This is an extension // to the Itanium ABI and is taken advantage of in several places in // libc++abi. __cxa_eh_globals * __cxa_get_globals_fast () { diff --git a/system/lib/libcxxabi/src/cxa_handlers.hpp b/system/lib/libcxxabi/src/cxa_handlers.hpp index 64994ac7b614c..ce567ec147107 100644 --- a/system/lib/libcxxabi/src/cxa_handlers.hpp +++ b/system/lib/libcxxabi/src/cxa_handlers.hpp @@ -45,7 +45,7 @@ extern void (*__cxa_new_handler)(); extern std::atomic __cxa_new_handler; This change will not impact their ABI. But it will allow for a - portible performance optimization. + portable performance optimization. */ diff --git a/system/lib/libcxxabi/src/cxa_new_delete.cpp b/system/lib/libcxxabi/src/cxa_new_delete.cpp index 6352001b66fe7..e6fee5f29fbb6 100644 --- a/system/lib/libcxxabi/src/cxa_new_delete.cpp +++ b/system/lib/libcxxabi/src/cxa_new_delete.cpp @@ -228,4 +228,15 @@ bad_array_new_length::what() const _NOEXCEPT return "bad_array_new_length"; } +#ifdef EMSCRIPTEN +// We don't build the new.cpp from libcxx, so we need to define this. +void +__throw_bad_alloc() +{ +#ifndef _LIBCPP_NO_EXCEPTIONS + throw bad_alloc(); +#endif +} +#endif + } // std diff --git a/system/lib/libcxxabi/src/cxa_personality.cpp b/system/lib/libcxxabi/src/cxa_personality.cpp index b2efe2aafab6b..97e58001faf33 100644 --- a/system/lib/libcxxabi/src/cxa_personality.cpp +++ b/system/lib/libcxxabi/src/cxa_personality.cpp @@ -39,7 +39,7 @@ +-----------------+--------+ | lpStartEncoding | (char) | +---------+-------+--------+---------------+-----------------------+ -| lpStart | (encoded wtih lpStartEncoding) | defaults to funcStart | +| lpStart | (encoded with lpStartEncoding) | defaults to funcStart | +---------+-----+--------+-----------------+---------------+-------+ | ttypeEncoding | (char) | Encoding of the type_info table | +---------------+-+------+----+----------------------------+----------------+ @@ -187,7 +187,7 @@ readULEB128(const uint8_t** data) } /// Read a sleb128 encoded value and advance pointer -/// See Variable Length Data Applendix C in: +/// See Variable Length Data Appendix C in: /// @link http://dwarfstd.org/Dwarf4.pdf @unlink /// @param data reference variable holding memory pointer to decode from /// @returns decoded value @@ -344,7 +344,7 @@ get_shim_type_info(uint64_t ttypeIndex, const uint8_t* classInfo, } /* - This is checking a thrown exception type, excpType, against a posibly empty + This is checking a thrown exception type, excpType, against a possibly empty list of catchType's which make up an exception spec. An exception spec acts like a catch handler, but in reverse. This "catch @@ -489,7 +489,7 @@ scan_eh_tab(scan_results& results, _Unwind_Action actions, bool native_exception return; } } - else // Niether _UA_SEARCH_PHASE nor _UA_CLEANUP_PHASE is set + else // Neither _UA_SEARCH_PHASE nor _UA_CLEANUP_PHASE is set { // One of these should be set. // Client error @@ -1038,7 +1038,7 @@ __cxa_call_unexpected(void* arg) { // We need to __cxa_end_catch for both the old exception and the // new exception. Technically we should do it in that order. - // But it is expedent to do it in the opposite order: + // But it is expedient to do it in the opposite order: // Call __cxa_end_catch for new_exception_header __cxa_end_catch(); // Throw std::bad_exception will __cxa_end_catch for diff --git a/system/lib/libcxxabi/src/cxa_vector.cpp b/system/lib/libcxxabi/src/cxa_vector.cpp index 926c01dd34967..c2292ef2fcc71 100644 --- a/system/lib/libcxxabi/src/cxa_vector.cpp +++ b/system/lib/libcxxabi/src/cxa_vector.cpp @@ -32,7 +32,7 @@ namespace { // A pair of classes to simplify exception handling and control flow. // They get passed a block of memory in the constructor, and unless the // 'release' method is called, they deallocate the memory in the destructor. -// Prefered usage is to allocate some memory, attach it to one of these objects, +// Preferred usage is to allocate some memory, attach it to one of these objects, // and then, when all the operations to set up the memory block have succeeded, // call 'release'. If any of the setup operations fail, or an exception is // thrown, then the block is automatically deallocated. diff --git a/system/lib/libcxxabi/src/private_typeinfo.cpp b/system/lib/libcxxabi/src/private_typeinfo.cpp index 44b084aeaa03c..216f796dacfa7 100644 --- a/system/lib/libcxxabi/src/private_typeinfo.cpp +++ b/system/lib/libcxxabi/src/private_typeinfo.cpp @@ -16,13 +16,13 @@ // When _LIBCXX_DYNAMIC_FALLBACK is defined, and only in the case where // there is a detected inconsistency in the type_info hierarchy during a // dynamic_cast, then the equality operation will fall back to using strcmp -// on type_info names to determin type_info equality. +// on type_info names to determine type_info equality. // // This change happens *only* under dynamic_cast, and only when // dynamic_cast is faced with the choice: abort, or possibly give back the // wrong answer. If when the dynamic_cast is done with this fallback // algorithm and an inconsistency is still detected, dynamic_cast will call -// abort with an approriate message. +// abort with an appropriate message. // // The current implementation of _LIBCXX_DYNAMIC_FALLBACK requires a // printf-like function called syslog: diff --git a/system/lib/libcxxabi/symbols b/system/lib/libcxxabi/symbols index b63f2f82ac755..80867b8ba4d58 100644 --- a/system/lib/libcxxabi/symbols +++ b/system/lib/libcxxabi/symbols @@ -1,4 +1,313 @@ - T __dynamic_cast + T _ZN10__cxxabiv116__enum_type_infoD0Ev + T _ZN10__cxxabiv116__enum_type_infoD1Ev + T _ZN10__cxxabiv116__enum_type_infoD2Ev + T _ZN10__cxxabiv116__shim_type_infoD0Ev + T _ZN10__cxxabiv116__shim_type_infoD1Ev + T _ZN10__cxxabiv116__shim_type_infoD2Ev + T _ZN10__cxxabiv117__array_type_infoD0Ev + T _ZN10__cxxabiv117__array_type_infoD1Ev + T _ZN10__cxxabiv117__array_type_infoD2Ev + T _ZN10__cxxabiv117__class_type_infoD0Ev + T _ZN10__cxxabiv117__class_type_infoD1Ev + T _ZN10__cxxabiv117__class_type_infoD2Ev + T _ZN10__cxxabiv117__pbase_type_infoD0Ev + T _ZN10__cxxabiv117__pbase_type_infoD1Ev + T _ZN10__cxxabiv117__pbase_type_infoD2Ev + T _ZN10__cxxabiv119__pointer_type_infoD0Ev + T _ZN10__cxxabiv119__pointer_type_infoD1Ev + T _ZN10__cxxabiv119__pointer_type_infoD2Ev + T _ZN10__cxxabiv120__function_type_infoD0Ev + T _ZN10__cxxabiv120__function_type_infoD1Ev + T _ZN10__cxxabiv120__function_type_infoD2Ev + T _ZN10__cxxabiv120__si_class_type_infoD0Ev + T _ZN10__cxxabiv120__si_class_type_infoD1Ev + T _ZN10__cxxabiv120__si_class_type_infoD2Ev + T _ZN10__cxxabiv121__vmi_class_type_infoD0Ev + T _ZN10__cxxabiv121__vmi_class_type_infoD1Ev + T _ZN10__cxxabiv121__vmi_class_type_infoD2Ev + T _ZN10__cxxabiv123__fundamental_type_infoD0Ev + T _ZN10__cxxabiv123__fundamental_type_infoD1Ev + T _ZN10__cxxabiv123__fundamental_type_infoD2Ev + T _ZN10__cxxabiv129__pointer_to_member_type_infoD0Ev + T _ZN10__cxxabiv129__pointer_to_member_type_infoD1Ev + T _ZN10__cxxabiv129__pointer_to_member_type_infoD2Ev + C _ZN10__cxxabiv18is_equalEPKSt9type_infoS2_b + t _ZN12_GLOBAL__N_114__libcpp_nmstrD1Ev + t _ZN12_GLOBAL__N_114__libcpp_nmstrD2Ev + T _ZNK10__cxxabiv116__enum_type_info9can_catchEPKNS_16__shim_type_infoERPv + T _ZNK10__cxxabiv116__shim_type_info5noop1Ev + T _ZNK10__cxxabiv116__shim_type_info5noop2Ev + T _ZNK10__cxxabiv117__array_type_info9can_catchEPKNS_16__shim_type_infoERPv + T _ZNK10__cxxabiv117__class_type_info16search_above_dstEPNS_19__dynamic_cast_infoEPKvS4_ib + T _ZNK10__cxxabiv117__class_type_info16search_below_dstEPNS_19__dynamic_cast_infoEPKvib + T _ZNK10__cxxabiv117__class_type_info24process_found_base_classEPNS_19__dynamic_cast_infoEPvi + T _ZNK10__cxxabiv117__class_type_info27has_unambiguous_public_baseEPNS_19__dynamic_cast_infoEPvi + T _ZNK10__cxxabiv117__class_type_info29process_static_type_above_dstEPNS_19__dynamic_cast_infoEPKvS4_i + T _ZNK10__cxxabiv117__class_type_info29process_static_type_below_dstEPNS_19__dynamic_cast_infoEPKvi + T _ZNK10__cxxabiv117__class_type_info9can_catchEPKNS_16__shim_type_infoERPv + T _ZNK10__cxxabiv117__pbase_type_info9can_catchEPKNS_16__shim_type_infoERPv + T _ZNK10__cxxabiv119__pointer_type_info9can_catchEPKNS_16__shim_type_infoERPv + T _ZNK10__cxxabiv120__function_type_info9can_catchEPKNS_16__shim_type_infoERPv + T _ZNK10__cxxabiv120__si_class_type_info16search_above_dstEPNS_19__dynamic_cast_infoEPKvS4_ib + T _ZNK10__cxxabiv120__si_class_type_info16search_below_dstEPNS_19__dynamic_cast_infoEPKvib + T _ZNK10__cxxabiv120__si_class_type_info27has_unambiguous_public_baseEPNS_19__dynamic_cast_infoEPvi + T _ZNK10__cxxabiv121__vmi_class_type_info16search_above_dstEPNS_19__dynamic_cast_infoEPKvS4_ib + T _ZNK10__cxxabiv121__vmi_class_type_info16search_below_dstEPNS_19__dynamic_cast_infoEPKvib + T _ZNK10__cxxabiv121__vmi_class_type_info27has_unambiguous_public_baseEPNS_19__dynamic_cast_infoEPvi + T _ZNK10__cxxabiv122__base_class_type_info16search_above_dstEPNS_19__dynamic_cast_infoEPKvS4_ib + T _ZNK10__cxxabiv122__base_class_type_info16search_below_dstEPNS_19__dynamic_cast_infoEPKvib + T _ZNK10__cxxabiv122__base_class_type_info27has_unambiguous_public_baseEPNS_19__dynamic_cast_infoEPvi + T _ZNK10__cxxabiv123__fundamental_type_info9can_catchEPKNS_16__shim_type_infoERPv + t _ZNK12_GLOBAL__N_114__libcpp_nmstr5c_strEv + t _ZNK12_GLOBAL__N_114__libcpp_nmstr5countEv + T _ZNKSt10bad_typeid4whatEv + T _ZNKSt11logic_error4whatEv + T _ZNKSt13bad_exception4whatEv + T _ZNKSt13runtime_error4whatEv + T _ZNKSt20bad_array_new_length4whatEv + T _ZNKSt8bad_cast4whatEv + T _ZNKSt9bad_alloc4whatEv + T _ZNKSt9exception4whatEv + T _ZNSt10bad_typeidC1Ev + T _ZNSt10bad_typeidC2Ev + T _ZNSt10bad_typeidD0Ev + T _ZNSt10bad_typeidD1Ev + T _ZNSt10bad_typeidD2Ev + T _ZNSt11logic_errorD0Ev + T _ZNSt11logic_errorD1Ev + T _ZNSt11logic_errorD2Ev + T _ZNSt11range_errorD0Ev + T _ZNSt11range_errorD1Ev + T _ZNSt11range_errorD2Ev + T _ZNSt12domain_errorD0Ev + T _ZNSt12domain_errorD1Ev + T _ZNSt12domain_errorD2Ev + T _ZNSt12length_errorD0Ev + T _ZNSt12length_errorD1Ev + T _ZNSt12length_errorD2Ev + T _ZNSt12out_of_rangeD0Ev + T _ZNSt12out_of_rangeD1Ev + T _ZNSt12out_of_rangeD2Ev + T _ZNSt13bad_exceptionD0Ev + T _ZNSt13bad_exceptionD1Ev + T _ZNSt13bad_exceptionD2Ev + T _ZNSt13runtime_errorD0Ev + T _ZNSt13runtime_errorD1Ev + T _ZNSt13runtime_errorD2Ev + T _ZNSt14overflow_errorD0Ev + T _ZNSt14overflow_errorD1Ev + T _ZNSt14overflow_errorD2Ev + T _ZNSt15underflow_errorD0Ev + T _ZNSt15underflow_errorD1Ev + T _ZNSt15underflow_errorD2Ev + T _ZNSt16invalid_argumentD0Ev + T _ZNSt16invalid_argumentD1Ev + T _ZNSt16invalid_argumentD2Ev + T _ZNSt20bad_array_new_lengthC1Ev + T _ZNSt20bad_array_new_lengthC2Ev + T _ZNSt20bad_array_new_lengthD0Ev + T _ZNSt20bad_array_new_lengthD1Ev + T _ZNSt20bad_array_new_lengthD2Ev + T _ZNSt8bad_castC1Ev + T _ZNSt8bad_castC2Ev + T _ZNSt8bad_castD0Ev + T _ZNSt8bad_castD1Ev + T _ZNSt8bad_castD2Ev + T _ZNSt9bad_allocC1Ev + T _ZNSt9bad_allocC2Ev + T _ZNSt9bad_allocD0Ev + T _ZNSt9bad_allocD1Ev + T _ZNSt9bad_allocD2Ev + T _ZNSt9exceptionD0Ev + T _ZNSt9exceptionD1Ev + T _ZNSt9exceptionD2Ev + T _ZNSt9type_infoD0Ev + T _ZNSt9type_infoD1Ev + T _ZNSt9type_infoD2Ev + T _ZSt10unexpectedv + T _ZSt11__terminatePFvvE + T _ZSt12__unexpectedPFvvE + T _ZSt13get_terminatev + T _ZSt14get_unexpectedv + T _ZSt15get_new_handlerv + T _ZSt15set_new_handlerPFvvE + T _ZSt9terminatev + D _ZTIDi + D _ZTIDn + D _ZTIDs + D _ZTIN10__cxxabiv116__enum_type_infoE + D _ZTIN10__cxxabiv116__shim_type_infoE + D _ZTIN10__cxxabiv117__array_type_infoE + D _ZTIN10__cxxabiv117__class_type_infoE + D _ZTIN10__cxxabiv117__pbase_type_infoE + D _ZTIN10__cxxabiv119__pointer_type_infoE + D _ZTIN10__cxxabiv120__function_type_infoE + D _ZTIN10__cxxabiv120__si_class_type_infoE + D _ZTIN10__cxxabiv121__vmi_class_type_infoE + D _ZTIN10__cxxabiv123__fundamental_type_infoE + D _ZTIN10__cxxabiv129__pointer_to_member_type_infoE + C _ZTINSt3__19nullptr_tE + D _ZTIPDi + D _ZTIPDn + D _ZTIPDs + D _ZTIPKDi + D _ZTIPKDn + D _ZTIPKDs + D _ZTIPKa + D _ZTIPKb + D _ZTIPKc + D _ZTIPKd + D _ZTIPKe + D _ZTIPKf + D _ZTIPKh + D _ZTIPKi + D _ZTIPKj + D _ZTIPKl + D _ZTIPKm + D _ZTIPKs + D _ZTIPKt + D _ZTIPKv + D _ZTIPKw + D _ZTIPKx + D _ZTIPKy + D _ZTIPa + D _ZTIPb + D _ZTIPc + D _ZTIPd + D _ZTIPe + D _ZTIPf + D _ZTIPh + D _ZTIPi + D _ZTIPj + D _ZTIPl + D _ZTIPm + D _ZTIPs + D _ZTIPt + D _ZTIPv + D _ZTIPw + D _ZTIPx + D _ZTIPy + D _ZTISt10bad_typeid + D _ZTISt11logic_error + D _ZTISt11range_error + D _ZTISt12domain_error + D _ZTISt12length_error + D _ZTISt12out_of_range + D _ZTISt13bad_exception + D _ZTISt13runtime_error + D _ZTISt14overflow_error + D _ZTISt15underflow_error + D _ZTISt16invalid_argument + D _ZTISt20bad_array_new_length + D _ZTISt8bad_cast + D _ZTISt9bad_alloc + D _ZTISt9exception + D _ZTISt9type_info + D _ZTIa + D _ZTIb + D _ZTIc + D _ZTId + D _ZTIe + D _ZTIf + D _ZTIh + D _ZTIi + D _ZTIj + D _ZTIl + D _ZTIm + D _ZTIs + D _ZTIt + D _ZTIv + D _ZTIw + D _ZTIx + D _ZTIy + D _ZTSDi + D _ZTSDn + D _ZTSDs + D _ZTSN10__cxxabiv116__enum_type_infoE + D _ZTSN10__cxxabiv116__shim_type_infoE + D _ZTSN10__cxxabiv117__array_type_infoE + D _ZTSN10__cxxabiv117__class_type_infoE + D _ZTSN10__cxxabiv117__pbase_type_infoE + D _ZTSN10__cxxabiv119__pointer_type_infoE + D _ZTSN10__cxxabiv120__function_type_infoE + D _ZTSN10__cxxabiv120__si_class_type_infoE + D _ZTSN10__cxxabiv121__vmi_class_type_infoE + D _ZTSN10__cxxabiv123__fundamental_type_infoE + D _ZTSN10__cxxabiv129__pointer_to_member_type_infoE + C _ZTSNSt3__19nullptr_tE + D _ZTSPDi + D _ZTSPDn + D _ZTSPDs + D _ZTSPKDi + D _ZTSPKDn + D _ZTSPKDs + D _ZTSPKa + D _ZTSPKb + D _ZTSPKc + D _ZTSPKd + D _ZTSPKe + D _ZTSPKf + D _ZTSPKh + D _ZTSPKi + D _ZTSPKj + D _ZTSPKl + D _ZTSPKm + D _ZTSPKs + D _ZTSPKt + D _ZTSPKv + D _ZTSPKw + D _ZTSPKx + D _ZTSPKy + D _ZTSPa + D _ZTSPb + D _ZTSPc + D _ZTSPd + D _ZTSPe + D _ZTSPf + D _ZTSPh + D _ZTSPi + D _ZTSPj + D _ZTSPl + D _ZTSPm + D _ZTSPs + D _ZTSPt + D _ZTSPv + D _ZTSPw + D _ZTSPx + D _ZTSPy + D _ZTSSt10bad_typeid + D _ZTSSt11logic_error + D _ZTSSt11range_error + D _ZTSSt12domain_error + D _ZTSSt12length_error + D _ZTSSt12out_of_range + D _ZTSSt13bad_exception + D _ZTSSt13runtime_error + D _ZTSSt14overflow_error + D _ZTSSt15underflow_error + D _ZTSSt16invalid_argument + D _ZTSSt20bad_array_new_length + D _ZTSSt8bad_cast + D _ZTSSt9bad_alloc + D _ZTSSt9exception + D _ZTSSt9type_info + D _ZTSa + D _ZTSb + D _ZTSc + D _ZTSd + D _ZTSe + D _ZTSf + D _ZTSh + D _ZTSi + D _ZTSj + D _ZTSl + D _ZTSm + D _ZTSs + D _ZTSt + D _ZTSv + D _ZTSw + D _ZTSx + D _ZTSy D _ZTVN10__cxxabiv116__enum_type_infoE D _ZTVN10__cxxabiv116__shim_type_infoE D _ZTVN10__cxxabiv117__array_type_infoE @@ -10,10 +319,29 @@ D _ZTVN10__cxxabiv121__vmi_class_type_infoE D _ZTVN10__cxxabiv123__fundamental_type_infoE D _ZTVN10__cxxabiv129__pointer_to_member_type_infoE - D _ZTSSt9type_info - T _ZNKSt8bad_cast4whatEv - T _ZNSt8bad_castC1Ev - T _ZNSt8bad_castC2Ev - D _ZTISt8bad_cast - D _ZTSSt8bad_cast + D _ZTVSt10bad_typeid + D _ZTVSt11logic_error + D _ZTVSt11range_error + D _ZTVSt12domain_error + D _ZTVSt12length_error + D _ZTVSt12out_of_range + D _ZTVSt13bad_exception + D _ZTVSt13runtime_error + D _ZTVSt14overflow_error + D _ZTVSt15underflow_error + D _ZTVSt16invalid_argument + D _ZTVSt20bad_array_new_length D _ZTVSt8bad_cast + D _ZTVSt9bad_alloc + D _ZTVSt9exception + D _ZTVSt9type_info + W _ZdaPv + W _ZdaPvRKSt9nothrow_t + W _ZdlPv + W _ZdlPvRKSt9nothrow_t + W _Znaj + W _ZnajRKSt9nothrow_t + W _Znwj + W _ZnwjRKSt9nothrow_t + D __cxa_new_handler + T __dynamic_cast diff --git a/tools/shared.py b/tools/shared.py index 33e37b1ce64e1..7b6677821c9f1 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -181,7 +181,7 @@ def check_node_version(): # we re-check sanity when the settings are changed) # We also re-check sanity and clear the cache when the version changes -EMSCRIPTEN_VERSION = '1.3.3' +EMSCRIPTEN_VERSION = '1.3.4' def check_sanity(force=False): try: @@ -398,8 +398,7 @@ def clean_temp(): '-Xclang', '-isystem' + path_from_root('system', 'include', 'net'), '-Xclang', '-isystem' + path_from_root('system', 'include', 'SDL'), ] + [ - '-U__APPLE__', '-U__linux__', - '-D_LIBCPP_HAS_NO_DELETED_FUNCTIONS' # otherwise libc++ has errors with --std=c++11 + '-U__APPLE__', '-U__linux__' ] COMPILER_OPTS += EMSDK_OPTS else: