From owner-svn-src-vendor@freebsd.org Fri Jun 16 21:04:08 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89D0ED89294; Fri, 16 Jun 2017 21:04:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1BF006F7B6; Fri, 16 Jun 2017 21:04:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5GL47Rj063716; Fri, 16 Jun 2017 21:04:07 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5GL44xh063692; Fri, 16 Jun 2017 21:04:04 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201706162104.v5GL44xh063692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 16 Jun 2017 21:04:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r320019 - in vendor/libc++/dist: benchmarks include include/experimental include/support/newlib lib src src/experimental/filesystem test/libcxx test/libcxx/algorithms/alg.modifying.oper... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2017 21:04:08 -0000 Author: dim Date: Fri Jun 16 21:04:04 2017 New Revision: 320019 URL: https://svnweb.freebsd.org/changeset/base/320019 Log: Vendor import of libc++ trunk r305575: https://llvm.org/svn/llvm-project/libcxx/trunk@305575 Added: vendor/libc++/dist/benchmarks/stringstream.bench.cpp (contents, props changed) vendor/libc++/dist/src/vector.cpp (contents, props changed) vendor/libc++/dist/test/libcxx/include_as_c.sh.cpp (contents, props changed) vendor/libc++/dist/test/libcxx/utilities/utility/__is_inplace_index.pass.cpp (contents, props changed) vendor/libc++/dist/test/libcxx/utilities/utility/__is_inplace_type.pass.cpp (contents, props changed) vendor/libc++/dist/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp (contents, props changed) vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.helper/ vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/sequences/array/array.tuple/tuple_element.fail.cpp (contents, props changed) vendor/libc++/dist/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/numerics/numeric.ops/reduce/ vendor/libc++/dist/test/std/numerics/numeric.ops/reduce/reduce.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/numerics/numeric.ops/reduce/reduce_init.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/numerics/numeric.ops/reduce/reduce_init_op.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/numerics/numeric.ops/transform.reduce/ vendor/libc++/dist/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init_op_op.pass.cpp (contents, props changed) Deleted: vendor/libc++/dist/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter.pass.cpp vendor/libc++/dist/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter_init_op.pass.cpp vendor/libc++/dist/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_iter_iter_iter_init_bop_uop.pass.cpp Modified: vendor/libc++/dist/include/__bsd_locale_fallbacks.h vendor/libc++/dist/include/__config vendor/libc++/dist/include/__functional_03 vendor/libc++/dist/include/__functional_base vendor/libc++/dist/include/array vendor/libc++/dist/include/experimental/coroutine vendor/libc++/dist/include/fstream vendor/libc++/dist/include/functional vendor/libc++/dist/include/locale vendor/libc++/dist/include/memory vendor/libc++/dist/include/numeric vendor/libc++/dist/include/support/newlib/xlocale.h vendor/libc++/dist/include/utility vendor/libc++/dist/include/variant vendor/libc++/dist/lib/CMakeLists.txt vendor/libc++/dist/src/experimental/filesystem/operations.cpp vendor/libc++/dist/src/locale.cpp vendor/libc++/dist/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp vendor/libc++/dist/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp vendor/libc++/dist/test/std/containers/associative/map/map.ops/count0.pass.cpp vendor/libc++/dist/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp vendor/libc++/dist/test/std/containers/associative/map/map.ops/find0.pass.cpp vendor/libc++/dist/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp vendor/libc++/dist/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp vendor/libc++/dist/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp vendor/libc++/dist/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp vendor/libc++/dist/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp vendor/libc++/dist/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp vendor/libc++/dist/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.pass.cpp vendor/libc++/dist/test/support/allocators.h vendor/libc++/dist/test/support/is_transparent.h vendor/libc++/dist/utils/libcxx/test/config.py Added: vendor/libc++/dist/benchmarks/stringstream.bench.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libc++/dist/benchmarks/stringstream.bench.cpp Fri Jun 16 21:04:04 2017 (r320019) @@ -0,0 +1,38 @@ +#include "benchmark/benchmark_api.h" + +#include +double __attribute__((noinline)) istream_numbers(); + +double istream_numbers() { + const char *a[] = { + "-6 69 -71 2.4882e-02 -100 101 -2.00005 5000000 -50000000", + "-25 71 7 -9.3262e+01 -100 101 -2.00005 5000000 -50000000", + "-14 53 46 -6.7026e-02 -100 101 -2.00005 5000000 -50000000" + }; + + int a1, a2, a3, a4, a5, a6, a7; + double f1 = 0.0, f2 = 0.0, q = 0.0; + for (int i=0; i < 3; i++) { + std::istringstream s(a[i]); + s >> a1 + >> a2 + >> a3 + >> f1 + >> a4 + >> a5 + >> f2 + >> a6 + >> a7; + q += (a1 + a2 + a3 + a4 + a5 + a6 + a7 + f1 + f2)/1000000; + } + return q; +} + +static void BM_Istream_numbers(benchmark::State &state) { + double i = 0; + while (state.KeepRunning()) + benchmark::DoNotOptimize(i += istream_numbers()); +} + +BENCHMARK(BM_Istream_numbers)->RangeMultiplier(2)->Range(1024, 4096); +BENCHMARK_MAIN() Modified: vendor/libc++/dist/include/__bsd_locale_fallbacks.h ============================================================================== --- vendor/libc++/dist/include/__bsd_locale_fallbacks.h Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/__bsd_locale_fallbacks.h Fri Jun 16 21:04:04 2017 (r320019) @@ -15,6 +15,7 @@ #define _LIBCPP_BSD_LOCALE_FALLBACKS_DEFAULTS_H #include +#include #include _LIBCPP_BEGIN_NAMESPACE_STD Modified: vendor/libc++/dist/include/__config ============================================================================== --- vendor/libc++/dist/include/__config Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/__config Fri Jun 16 21:04:04 2017 (r320019) @@ -76,6 +76,9 @@ // its vtable and typeinfo to libc++ rather than having all other libraries // using that class define their own copies. #define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION + +// Enable optimized version of __do_get_(un)signed which avoids redundant copies. +#define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET #elif _LIBCPP_ABI_VERSION == 1 #if !defined(_LIBCPP_OBJECT_FORMAT_COFF) // Enable compiling copies of now inline methods into the dylib to support @@ -289,7 +292,7 @@ # endif #endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) -#if __has_attribute(__no_sanitize__) +#if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC) #define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi"))) #else #define _LIBCPP_NO_CFI @@ -1132,8 +1135,6 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_ # define _LIBCPP_HAS_NO_COROUTINES #endif -#endif // __cplusplus - // Decide whether to use availability macros. #if !defined(_LIBCPP_BUILDING_LIBRARY) && \ !defined(_LIBCPP_DISABLE_AVAILABILITY) && \ @@ -1236,5 +1237,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_ _Pragma("pop_macro(\"max\")") # endif #endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) + + +#endif // __cplusplus #endif // _LIBCPP_CONFIG Modified: vendor/libc++/dist/include/__functional_03 ============================================================================== --- vendor/libc++/dist/include/__functional_03 Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/__functional_03 Fri Jun 16 21:04:04 2017 (r320019) @@ -704,7 +704,7 @@ function<_Rp()>::target() { if (__f_ == 0) return (_Tp*)0; - return (_Tp*)__f_->target(typeid(_Tp)); + return (_Tp*) const_cast(__f_->target(typeid(_Tp))); } template @@ -980,7 +980,7 @@ function<_Rp(_A0)>::target() { if (__f_ == 0) return (_Tp*)0; - return (_Tp*)__f_->target(typeid(_Tp)); + return (_Tp*) const_cast(__f_->target(typeid(_Tp))); } template @@ -1256,7 +1256,7 @@ function<_Rp(_A0, _A1)>::target() { if (__f_ == 0) return (_Tp*)0; - return (_Tp*)__f_->target(typeid(_Tp)); + return (_Tp*) const_cast(__f_->target(typeid(_Tp))); } template @@ -1532,7 +1532,7 @@ function<_Rp(_A0, _A1, _A2)>::target() { if (__f_ == 0) return (_Tp*)0; - return (_Tp*)__f_->target(typeid(_Tp)); + return (_Tp*) const_cast(__f_->target(typeid(_Tp))); } template Modified: vendor/libc++/dist/include/__functional_base ============================================================================== --- vendor/libc++/dist/include/__functional_base Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/__functional_base Fri Jun 16 21:04:04 2017 (r320019) @@ -548,16 +548,13 @@ template void cref(const _Tp&&) = delete; #endif #if _LIBCPP_STD_VER > 11 -template -struct __is_transparent -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::is_transparent* = 0); -public: - static const bool value = sizeof(__test<_Tp1>(0)) == 1; -}; +template +struct __is_transparent : false_type {}; + +template +struct __is_transparent<_Tp, _Up, + typename __void_t::type> + : true_type {}; #endif // allocator_arg_t Modified: vendor/libc++/dist/include/array ============================================================================== --- vendor/libc++/dist/include/array Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/array Fri Jun 16 21:04:04 2017 (r320019) @@ -296,6 +296,7 @@ class _LIBCPP_TEMPLATE_VIS tuple_size class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, array<_Tp, _Size> > { + static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> (std::array)"); public: typedef _Tp type; }; Modified: vendor/libc++/dist/include/experimental/coroutine ============================================================================== --- vendor/libc++/dist/include/experimental/coroutine Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/experimental/coroutine Fri Jun 16 21:04:04 2017 (r320019) @@ -250,9 +250,11 @@ class _LIBCPP_TEMPLATE_VIS coroutine_handle : public c _LIBCPP_ALWAYS_INLINE static coroutine_handle from_promise(_Promise& __promise) _NOEXCEPT { + typedef typename remove_cv<_Promise>::type _RawPromise; coroutine_handle __tmp; - __tmp.__handle_ = __builtin_coro_promise(_VSTD::addressof(__promise), - __alignof(_Promise), true); + __tmp.__handle_ = __builtin_coro_promise( + _VSTD::addressof(const_cast<_RawPromise&>(__promise)), + __alignof(_Promise), true); return __tmp; } }; Modified: vendor/libc++/dist/include/fstream ============================================================================== --- vendor/libc++/dist/include/fstream Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/fstream Fri Jun 16 21:04:04 2017 (r320019) @@ -617,7 +617,7 @@ basic_filebuf<_CharT, _Traits>::underflow() static_cast(__extbufend_ - __extbufnext_)); codecvt_base::result __r; __st_last_ = __st_; - size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_); + size_t __nr = fread((void*) const_cast(__extbufnext_), 1, __nmemb, __file_); if (__nr != 0) { if (!__cv_) @@ -630,7 +630,8 @@ basic_filebuf<_CharT, _Traits>::underflow() this->eback() + __ibs_, __inext); if (__r == codecvt_base::noconv) { - this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_); + this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, + (char_type*)const_cast(__extbufend_)); __c = traits_type::to_int_type(*this->gptr()); } else if (__inext != this->eback() + __unget_sz) @@ -722,7 +723,7 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c) return traits_type::eof(); if (__r == codecvt_base::partial) { - this->setp((char_type*)__e, this->pptr()); + this->setp(const_cast(__e), this->pptr()); this->pbump(this->epptr() - this->pbase()); } } Modified: vendor/libc++/dist/include/functional ============================================================================== --- vendor/libc++/dist/include/functional Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/functional Fri Jun 16 21:04:04 2017 (r320019) @@ -1941,8 +1941,8 @@ _Tp* function<_Rp(_ArgTypes...)>::target() _NOEXCEPT { if (__f_ == 0) - return (_Tp*)0; - return (_Tp*)__f_->target(typeid(_Tp)); + return nullptr; + return (_Tp*) const_cast(__f_->target(typeid(_Tp))); } template @@ -1951,7 +1951,7 @@ const _Tp* function<_Rp(_ArgTypes...)>::target() const _NOEXCEPT { if (__f_ == 0) - return (const _Tp*)0; + return nullptr; return (const _Tp*)__f_->target(typeid(_Tp)); } Modified: vendor/libc++/dist/include/locale ============================================================================== --- vendor/libc++/dist/include/locale Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/locale Fri Jun 16 21:04:04 2017 (r320019) @@ -372,19 +372,57 @@ template struct __num_get : protected __num_get_base { - static string __stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep); static string __stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT& __decimal_point, _CharT& __thousands_sep); - static int __stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, - unsigned& __dc, _CharT __thousands_sep, const string& __grouping, - unsigned* __g, unsigned*& __g_end, _CharT* __atoms); + static int __stage2_float_loop(_CharT __ct, bool& __in_units, char& __exp, char* __a, char*& __a_end, _CharT __decimal_point, _CharT __thousands_sep, const string& __grouping, unsigned* __g, unsigned*& __g_end, unsigned& __dc, _CharT* __atoms); +#ifndef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET + static string __stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep); + static int __stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, + unsigned& __dc, _CharT __thousands_sep, const string& __grouping, + unsigned* __g, unsigned*& __g_end, _CharT* __atoms); + +#else + static string __stage2_int_prep(ios_base& __iob, _CharT& __thousands_sep) + { + locale __loc = __iob.getloc(); + const numpunct<_CharT>& __np = use_facet >(__loc); + __thousands_sep = __np.thousands_sep(); + return __np.grouping(); + } + + const _CharT* __do_widen(ios_base& __iob, _CharT* __atoms) const + { + return __do_widen_p(__iob, __atoms); + } + + + static int __stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, + unsigned& __dc, _CharT __thousands_sep, const string& __grouping, + unsigned* __g, unsigned*& __g_end, const _CharT* __atoms); +private: + template + const T* __do_widen_p(ios_base& __iob, T* __atoms) const + { + locale __loc = __iob.getloc(); + use_facet >(__loc).widen(__src, __src + 26, __atoms); + return __atoms; + } + + const char* __do_widen_p(ios_base& __iob, char* __atoms) const + { + (void)__iob; + (void)__atoms; + return __src; + } +#endif }; +#ifndef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET template string __num_get<_CharT>::__stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep) @@ -395,6 +433,7 @@ __num_get<_CharT>::__stage2_int_prep(ios_base& __iob, __thousands_sep = __np.thousands_sep(); return __np.grouping(); } +#endif template string @@ -411,9 +450,16 @@ __num_get<_CharT>::__stage2_float_prep(ios_base& __iob template int +#ifndef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, unsigned& __dc, _CharT __thousands_sep, const string& __grouping, unsigned* __g, unsigned*& __g_end, _CharT* __atoms) +#else +__num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, + unsigned& __dc, _CharT __thousands_sep, const string& __grouping, + unsigned* __g, unsigned*& __g_end, const _CharT* __atoms) + +#endif { if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25])) { @@ -849,9 +895,16 @@ num_get<_CharT, _InputIterator>::__do_get_signed(iter_ // Stage 1 int __base = this->__get_base(__iob); // Stage 2 - char_type __atoms[26]; char_type __thousands_sep; + const int __atoms_size = 26; +#ifdef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET + char_type __atoms1[__atoms_size]; + const char_type *__atoms = this->__do_widen(__iob, __atoms1); + string __grouping = this->__stage2_int_prep(__iob, __thousands_sep); +#else + char_type __atoms[__atoms_size]; string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep); +#endif string __buf; __buf.resize(__buf.capacity()); char* __a = &__buf[0]; @@ -899,9 +952,16 @@ num_get<_CharT, _InputIterator>::__do_get_unsigned(ite // Stage 1 int __base = this->__get_base(__iob); // Stage 2 - char_type __atoms[26]; char_type __thousands_sep; + const int __atoms_size = 26; +#ifdef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET + char_type __atoms1[__atoms_size]; + const char_type *__atoms = this->__do_widen(__iob, __atoms1); + string __grouping = this->__stage2_int_prep(__iob, __thousands_sep); +#else + char_type __atoms[__atoms_size]; string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep); +#endif string __buf; __buf.resize(__buf.capacity()); char* __a = &__buf[0]; @@ -3960,7 +4020,8 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow() this->egptr(), __inext); if (__r == codecvt_base::noconv) { - this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_); + this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, + (char_type*) const_cast(__extbufend_)); __c = *this->gptr(); } else if (__inext != this->eback() + __unget_sz) @@ -4048,7 +4109,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::overflow(int_ty return traits_type::eof(); if (__r == codecvt_base::partial) { - this->setp((char_type*)__e, this->pptr()); + this->setp(const_cast(__e), this->pptr()); this->pbump(this->epptr() - this->pbase()); } } Modified: vendor/libc++/dist/include/memory ============================================================================== --- vendor/libc++/dist/include/memory Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/memory Fri Jun 16 21:04:04 2017 (r320019) @@ -720,16 +720,12 @@ class _LIBCPP_TEMPLATE_VIS allocator (publ // pointer_traits +template +struct __has_element_type : false_type {}; + template -struct __has_element_type -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::element_type* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_element_type<_Tp, + typename __void_t::type> : true_type {}; template ::value> struct __pointer_traits_element_type; @@ -808,16 +804,12 @@ struct __pointer_traits_element_type<_Sp<_Tp, _A0, _A1 #endif // _LIBCPP_HAS_NO_VARIADICS +template +struct __has_difference_type : false_type {}; + template -struct __has_difference_type -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::difference_type* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_difference_type<_Tp, + typename __void_t::type> : true_type {}; template ::value> struct __pointer_traits_difference_type @@ -998,17 +990,12 @@ struct __rebind_pointer { // allocator_traits -struct __has_pointer_type_imp -{ - template static __two __test(...); - template static char __test(typename _Up::pointer* = 0); -}; +template +struct __has_pointer_type : false_type {}; template -struct __has_pointer_type - : public integral_constant(0)) == 1> -{ -}; +struct __has_pointer_type<_Tp, + typename __void_t::type> : true_type {}; namespace __pointer_type_imp { @@ -1033,16 +1020,12 @@ struct __pointer_type typedef typename __pointer_type_imp::__pointer_type<_Tp, typename remove_reference<_Dp>::type>::type type; }; +template +struct __has_const_pointer : false_type {}; + template -struct __has_const_pointer -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::const_pointer* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_const_pointer<_Tp, + typename __void_t::type> : true_type {}; template ::value> struct __const_pointer @@ -1060,16 +1043,12 @@ struct __const_pointer<_Tp, _Ptr, _Alloc, false> #endif }; +template +struct __has_void_pointer : false_type {}; + template -struct __has_void_pointer -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::void_pointer* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_void_pointer<_Tp, + typename __void_t::type> : true_type {}; template ::value> struct __void_pointer @@ -1087,16 +1066,12 @@ struct __void_pointer<_Ptr, _Alloc, false> #endif }; +template +struct __has_const_void_pointer : false_type {}; + template -struct __has_const_void_pointer -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::const_void_pointer* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_const_void_pointer<_Tp, + typename __void_t::type> : true_type {}; template ::value> struct __const_void_pointer @@ -1130,16 +1105,12 @@ __to_raw_pointer(_Pointer __p) _NOEXCEPT return _VSTD::__to_raw_pointer(__p.operator->()); } +template +struct __has_size_type : false_type {}; + template -struct __has_size_type -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::size_type* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_size_type<_Tp, + typename __void_t::type> : true_type {}; template ::value> struct __size_type @@ -1153,16 +1124,13 @@ struct __size_type<_Alloc, _DiffType, true> typedef typename _Alloc::size_type type; }; +template +struct __has_propagate_on_container_copy_assignment : false_type {}; + template -struct __has_propagate_on_container_copy_assignment -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::propagate_on_container_copy_assignment* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_propagate_on_container_copy_assignment<_Tp, + typename __void_t::type> + : true_type {}; template ::value> struct __propagate_on_container_copy_assignment @@ -1176,16 +1144,13 @@ struct __propagate_on_container_copy_assignment<_Alloc typedef typename _Alloc::propagate_on_container_copy_assignment type; }; +template +struct __has_propagate_on_container_move_assignment : false_type {}; + template -struct __has_propagate_on_container_move_assignment -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::propagate_on_container_move_assignment* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_propagate_on_container_move_assignment<_Tp, + typename __void_t::type> + : true_type {}; template ::value> struct __propagate_on_container_move_assignment @@ -1199,16 +1164,13 @@ struct __propagate_on_container_move_assignment<_Alloc typedef typename _Alloc::propagate_on_container_move_assignment type; }; +template +struct __has_propagate_on_container_swap : false_type {}; + template -struct __has_propagate_on_container_swap -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::propagate_on_container_swap* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_propagate_on_container_swap<_Tp, + typename __void_t::type> + : true_type {}; template ::value> struct __propagate_on_container_swap @@ -1222,16 +1184,13 @@ struct __propagate_on_container_swap<_Alloc, true> typedef typename _Alloc::propagate_on_container_swap type; }; +template +struct __has_is_always_equal : false_type {}; + template -struct __has_is_always_equal -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::is_always_equal* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_is_always_equal<_Tp, + typename __void_t::type> + : true_type {}; template ::value> struct __is_always_equal @@ -1884,7 +1843,7 @@ class _LIBCPP_TEMPLATE_VIS allocator (publi return static_cast(_VSTD::__allocate(__n * sizeof(_Tp))); } _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT - {_VSTD::__libcpp_deallocate((void*)__p);} + {_VSTD::__libcpp_deallocate((void*) const_cast<_Tp *>(__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) @@ -1900,7 +1859,7 @@ class _LIBCPP_TEMPLATE_VIS allocator (publi void construct(pointer __p) { - ::new((void*)__p) _Tp(); + ::new((void*) const_cast<_Tp *>(__p)) _Tp(); } # if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) @@ -1909,14 +1868,14 @@ class _LIBCPP_TEMPLATE_VIS allocator (publi void construct(pointer __p, _A0& __a0) { - ::new((void*)__p) _Tp(__a0); + ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0); } template _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, const _A0& __a0) { - ::new((void*)__p) _Tp(__a0); + ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0); } # endif // defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) template @@ -1924,28 +1883,28 @@ class _LIBCPP_TEMPLATE_VIS allocator (publi void construct(pointer __p, _A0& __a0, _A1& __a1) { - ::new((void*)__p) _Tp(__a0, __a1); + ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1); } template _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, const _A0& __a0, _A1& __a1) { - ::new((void*)__p) _Tp(__a0, __a1); + ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1); } template _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, _A0& __a0, const _A1& __a1) { - ::new((void*)__p) _Tp(__a0, __a1); + ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1); } template _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, const _A0& __a0, const _A1& __a1) { - ::new((void*)__p) _Tp(__a0, __a1); + ::new((void*) const_cast<_Tp *>(__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();} @@ -3890,7 +3849,9 @@ class _LIBCPP_TEMPLATE_VIS shared_ptr (public) template _LIBCPP_INLINE_VISIBILITY _Dp* __get_deleter() const _NOEXCEPT - {return (_Dp*)(__cntrl_ ? __cntrl_->__get_deleter(typeid(_Dp)) : 0);} + {return static_cast<_Dp*>(__cntrl_ + ? const_cast(__cntrl_->__get_deleter(typeid(_Dp))) + : nullptr);} #endif // _LIBCPP_NO_RTTI #ifndef _LIBCPP_HAS_NO_VARIADICS Modified: vendor/libc++/dist/include/numeric ============================================================================== --- vendor/libc++/dist/include/numeric Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/numeric Fri Jun 16 21:04:04 2017 (r320019) @@ -25,6 +25,18 @@ template + typename iterator_traits::value_type + reduce(InputIterator first, InputIterator last); // C++17 + +template + T + reduce(InputIterator first, InputIterator last, T init); // C++17 + +template + T + reduce(InputIterator first, InputIterator last, T init, BinaryOperation binary_op); // C++17 + template T inner_product(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T init); @@ -34,6 +46,23 @@ template + T + transform_reduce(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, T init); // C++17 + +template + T + transform_reduce(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, T init, + BinaryOperation1 binary_op1, BinaryOperation2 binary_op2); // C++17 + +template + T + transform_reduce(InputIterator first, InputIterator last, T init, + BinaryOperation binary_op, UnaryOperation unary_op); // C++17 + template OutputIterator partial_sum(InputIterator first, InputIterator last, OutputIterator result); @@ -114,6 +143,35 @@ accumulate(_InputIterator __first, _InputIterator __la return __init; } +#if _LIBCPP_STD_VER > 14 +template +inline _LIBCPP_INLINE_VISIBILITY +_Tp +reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b) +{ + for (; __first != __last; ++__first) + __init = __b(__init, *__first); + return __init; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +_Tp +reduce(_InputIterator __first, _InputIterator __last, _Tp __init) +{ + return _VSTD::reduce(__first, __last, __init, _VSTD::plus<>()); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +typename iterator_traits<_InputIterator>::value_type +reduce(_InputIterator __first, _InputIterator __last) +{ + return _VSTD::reduce(__first, __last, + typename iterator_traits<_InputIterator>::value_type{}); +} +#endif + template inline _LIBCPP_INLINE_VISIBILITY _Tp @@ -134,6 +192,41 @@ inner_product(_InputIterator1 __first1, _InputIterator __init = __binary_op1(__init, __binary_op2(*__first1, *__first2)); return __init; } + +#if _LIBCPP_STD_VER > 14 +template +inline _LIBCPP_INLINE_VISIBILITY +_Tp +transform_reduce(_InputIterator __first, _InputIterator __last, + _Tp __init, _BinaryOp __b, _UnaryOp __u) +{ + for (; __first != __last; ++__first) + __init = __b(__init, __u(*__first)); + return __init; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +_Tp +transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _Tp __init, _BinaryOp1 __b1, _BinaryOp2 __b2) +{ + for (; __first1 != __last1; ++__first1, (void) ++__first2) + __init = __b1(__init, __b2(*__first1, *__first2)); + return __init; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +_Tp +transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _Tp __init) +{ + return _VSTD::transform_reduce(__first1, __last1, __first2, __init, + _VSTD::plus<>(), _VSTD::multiplies<>()); +} +#endif template inline _LIBCPP_INLINE_VISIBILITY Modified: vendor/libc++/dist/include/support/newlib/xlocale.h ============================================================================== --- vendor/libc++/dist/include/support/newlib/xlocale.h Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/support/newlib/xlocale.h Fri Jun 16 21:04:04 2017 (r320019) @@ -16,7 +16,10 @@ #include #include #include +#if !defined(__NEWLIB__) || __NEWLIB__ < 2 || \ + __NEWLIB__ == 2 && __NEWLIB_MINOR__ < 5 #include +#endif #include #include Modified: vendor/libc++/dist/include/utility ============================================================================== --- vendor/libc++/dist/include/utility Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/utility Fri Jun 16 21:04:04 2017 (r320019) @@ -653,6 +653,12 @@ template class _LIBCPP_TEMPLATE_VIS tuple_size > : public integral_constant {}; +template +class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, pair<_T1, _T2> > +{ + static_assert(_Ip < 2, "Index out of bounds in std::tuple_element>"); +}; + template class _LIBCPP_TEMPLATE_VIS tuple_element<0, pair<_T1, _T2> > { @@ -923,6 +929,12 @@ template struct __is_inplace_type_imp using __is_inplace_type = __is_inplace_type_imp<__uncvref_t<_Tp>>; + +template struct __is_inplace_index_imp : false_type {}; +template struct __is_inplace_index_imp> : true_type {}; + +template +using __is_inplace_index = __is_inplace_index_imp<__uncvref_t<_Tp>>; #endif // _LIBCPP_STD_VER > 14 Modified: vendor/libc++/dist/include/variant ============================================================================== --- vendor/libc++/dist/include/variant Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/variant Fri Jun 16 21:04:04 2017 (r320019) @@ -278,7 +278,7 @@ struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, c template struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, variant<_Types...>> { - static_assert(_Ip < sizeof...(_Types)); + static_assert(_Ip < sizeof...(_Types), "Index out of bounds in std::variant_alternative<>"); using type = __type_pack_element<_Ip, _Types...>; }; Modified: vendor/libc++/dist/lib/CMakeLists.txt ============================================================================== --- vendor/libc++/dist/lib/CMakeLists.txt Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/lib/CMakeLists.txt Fri Jun 16 21:04:04 2017 (r320019) @@ -1,6 +1,7 @@ set(LIBCXX_LIB_CMAKEFILES_DIR "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}" PARENT_SCOPE) # Get sources +# FIXME: Don't use glob here file(GLOB LIBCXX_SOURCES ../src/*.cpp) if(WIN32) file(GLOB LIBCXX_WIN32_SOURCES ../src/support/win32/*.cpp) Modified: vendor/libc++/dist/src/experimental/filesystem/operations.cpp ============================================================================== --- vendor/libc++/dist/src/experimental/filesystem/operations.cpp Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/src/experimental/filesystem/operations.cpp Fri Jun 16 21:04:04 2017 (r320019) @@ -842,7 +842,7 @@ void __rename(const path& from, const path& to, std::e } void __resize_file(const path& p, std::uintmax_t size, std::error_code *ec) { - if (::truncate(p.c_str(), static_cast(size)) == -1) + if (::truncate(p.c_str(), static_cast<::off_t>(size)) == -1) set_or_throw(ec, "resize_file", p); else if (ec) ec->clear(); Modified: vendor/libc++/dist/src/locale.cpp ============================================================================== --- vendor/libc++/dist/src/locale.cpp Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/src/locale.cpp Fri Jun 16 21:04:04 2017 (r320019) @@ -6158,6 +6158,4 @@ template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VI template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname; -template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __vector_base_common; - _LIBCPP_END_NAMESPACE_STD Added: vendor/libc++/dist/src/vector.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libc++/dist/src/vector.cpp Fri Jun 16 21:04:04 2017 (r320019) @@ -0,0 +1,16 @@ +//===------------------------- vector.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 "vector" + +_LIBCPP_BEGIN_NAMESPACE_STD + +template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __vector_base_common; + +_LIBCPP_END_NAMESPACE_STD Modified: vendor/libc++/dist/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp Fri Jun 16 21:04:04 2017 (r320019) @@ -23,6 +23,7 @@ // However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE // is defined before including , then random_shuffle will be restored. +// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE #define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE #include Modified: vendor/libc++/dist/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp Fri Jun 16 21:04:04 2017 (r320019) @@ -14,6 +14,7 @@ // However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS // is defined before including , then they will be restored. +// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS #define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS #include Added: vendor/libc++/dist/test/libcxx/include_as_c.sh.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libc++/dist/test/libcxx/include_as_c.sh.cpp Fri Jun 16 21:04:04 2017 (r320019) @@ -0,0 +1,37 @@ +// -*- 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. +// +//===----------------------------------------------------------------------===// + +// Test that the C wrapper headers can be included when compiling them as C. + +// NOTE: It's not common or recommended to have libc++ in the header search +// path when compiling C files, but it does happen often enough. + +// RUN: %cxx -c -xc %s -fsyntax-only %flags %compile_flags -std=c99 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int main() {} Added: vendor/libc++/dist/test/libcxx/utilities/utility/__is_inplace_index.pass.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libc++/dist/test/libcxx/utilities/utility/__is_inplace_index.pass.cpp Fri Jun 16 21:04:04 2017 (r320019) @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***