Author: dim Date: Mon Jan 9 21:23:41 2017 New Revision: 311824 URL: https://svnweb.freebsd.org/changeset/base/311824
Log: Vendor import of libc++ trunk r291476: https://llvm.org/svn/llvm-project/libcxx/trunk@291476 Added: vendor/libc++/dist/docs/DesignDocs/ThreadingSupportAPI.rst vendor/libc++/dist/test/std/input.output/iostream.format/input.streams/istream/istream.cons/copy.fail.cpp (contents, props changed) vendor/libc++/dist/test/std/strings/string.view/string_view.literals/ vendor/libc++/dist/test/std/strings/string.view/string_view.literals/literal.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/strings/string.view/string_view.literals/literal1.fail.cpp (contents, props changed) vendor/libc++/dist/test/std/strings/string.view/string_view.literals/literal1.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/strings/string.view/string_view.literals/literal2.fail.cpp (contents, props changed) vendor/libc++/dist/test/std/strings/string.view/string_view.literals/literal2.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/strings/string.view/string_view.literals/literal3.pass.cpp (contents, props changed) Deleted: vendor/libc++/dist/include/__undef___deallocate Modified: vendor/libc++/dist/CMakeLists.txt vendor/libc++/dist/CREDITS.TXT vendor/libc++/dist/docs/DesignDocs/VisibilityMacros.rst vendor/libc++/dist/docs/index.rst vendor/libc++/dist/include/__bit_reference vendor/libc++/dist/include/__config vendor/libc++/dist/include/__config_site.in vendor/libc++/dist/include/__debug vendor/libc++/dist/include/__functional_base vendor/libc++/dist/include/__hash_table vendor/libc++/dist/include/__sso_allocator vendor/libc++/dist/include/__threading_support vendor/libc++/dist/include/algorithm vendor/libc++/dist/include/atomic vendor/libc++/dist/include/experimental/algorithm vendor/libc++/dist/include/experimental/dynarray vendor/libc++/dist/include/experimental/iterator vendor/libc++/dist/include/istream vendor/libc++/dist/include/memory vendor/libc++/dist/include/module.modulemap vendor/libc++/dist/include/new vendor/libc++/dist/include/ostream vendor/libc++/dist/include/regex vendor/libc++/dist/include/string_view vendor/libc++/dist/include/support/win32/support.h vendor/libc++/dist/include/thread vendor/libc++/dist/include/type_traits vendor/libc++/dist/include/valarray vendor/libc++/dist/lib/CMakeLists.txt vendor/libc++/dist/src/chrono.cpp vendor/libc++/dist/src/exception.cpp vendor/libc++/dist/src/experimental/memory_resource.cpp vendor/libc++/dist/src/include/config_elast.h vendor/libc++/dist/src/iostream.cpp vendor/libc++/dist/src/locale.cpp vendor/libc++/dist/src/thread.cpp vendor/libc++/dist/test/CMakeLists.txt vendor/libc++/dist/test/libcxx/iterators/trivial_iterators.pass.cpp vendor/libc++/dist/test/libcxx/test/config.py vendor/libc++/dist/test/libcxx/test/executor.py vendor/libc++/dist/test/libcxx/test/format.py vendor/libc++/dist/test/lit.site.cfg.in vendor/libc++/dist/test/std/containers/sequences/array/iterators.pass.cpp vendor/libc++/dist/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp vendor/libc++/dist/test/std/iterators/iterator.range/begin-end.pass.cpp vendor/libc++/dist/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h vendor/libc++/dist/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=duration.pass.cpp vendor/libc++/dist/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp vendor/libc++/dist/test/std/utilities/time/time.duration/time.duration.arithmetic/op_times=.pass.cpp vendor/libc++/dist/test/support/disable_missing_braces_warning.h vendor/libc++/dist/test/support/external_threads.cpp vendor/libc++/dist/test/support/nasty_macros.hpp vendor/libc++/dist/test/support/test_iterators.h vendor/libc++/dist/www/cxx1z_status.html Modified: vendor/libc++/dist/CMakeLists.txt ============================================================================== --- vendor/libc++/dist/CMakeLists.txt Mon Jan 9 21:23:37 2017 (r311823) +++ vendor/libc++/dist/CMakeLists.txt Mon Jan 9 21:23:41 2017 (r311824) @@ -116,7 +116,12 @@ if (LIBCXX_CXX_ABI STREQUAL "default") set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") set(LIBCXX_CXX_ABI_INTREE 1) else() - set(LIBCXX_CXX_ABI_LIBNAME "default") + if (WIN32 AND NOT MINGW) + # FIXME: Figure out how to configure the ABI library on Windows. + set(LIBCXX_CXX_ABI_LIBNAME "none") + else() + set(LIBCXX_CXX_ABI_LIBNAME "default") + endif() endif() else() set(LIBCXX_CXX_ABI_LIBNAME "${LIBCXX_CXX_ABI}") @@ -169,6 +174,9 @@ option(LIBCXX_HAS_PTHREAD_API "Ignore au option(LIBCXX_HAS_EXTERNAL_THREAD_API "Build libc++ with an externalized threading API. This option may only be set to ON when LIBCXX_ENABLE_THREADS=ON." OFF) +option(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY + "Build libc++ with an externalized threading library. + This option may only be set to ON when LIBCXX_ENABLE_THREADS=ON" OFF) # Misc options ---------------------------------------------------------------- # FIXME: Turn -pedantic back ON. It is currently off because it warns @@ -230,12 +238,24 @@ if(NOT LIBCXX_ENABLE_THREADS) message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_API can only be set to ON" " when LIBCXX_ENABLE_THREADS is also set to ON.") endif() + if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY) + message(FATAL_ERROR "LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY can only be set " + "to ON when LIBCXX_ENABLE_THREADS is also set to ON.") + endif() + endif() -if(LIBCXX_HAS_PTHREAD_API AND LIBCXX_HAS_EXTERNAL_THREAD_API) - message(FATAL_ERROR "The options LIBCXX_HAS_EXTERNAL_THREAD_API" - "and LIBCXX_HAS_PTHREAD_API cannot be both" - "set to ON at the same time.") +if (LIBCXX_HAS_EXTERNAL_THREAD_API) + if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY) + message(FATAL_ERROR "The options LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY and " + "LIBCXX_HAS_EXTERNAL_THREAD_API cannot both be ON at " + "the same time") + endif() + if (LIBCXX_HAS_PTHREAD_API) + message(FATAL_ERROR "The options LIBCXX_HAS_EXTERNAL_THREAD_API" + "and LIBCXX_HAS_PTHREAD_API cannot be both" + "set to ON at the same time.") + endif() endif() # Ensure LLVM_USE_SANITIZER is not specified when LIBCXX_GENERATE_COVERAGE @@ -441,7 +461,7 @@ if (NOT LIBCXX_ENABLE_RTTI) endif() # Threading flags ============================================================= -if (LIBCXX_HAS_EXTERNAL_THREAD_API AND LIBCXX_ENABLE_SHARED) +if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY AND LIBCXX_ENABLE_SHARED) # Need to allow unresolved symbols if this is to work with shared library builds if (APPLE) add_link_flags("-undefined dynamic_lookup") @@ -520,6 +540,7 @@ config_define_if_not(LIBCXX_ENABLE_THREA config_define_if(LIBCXX_HAS_PTHREAD_API _LIBCPP_HAS_THREAD_API_PTHREAD) config_define_if(LIBCXX_HAS_EXTERNAL_THREAD_API _LIBCPP_HAS_THREAD_API_EXTERNAL) +config_define_if(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC) # By default libc++ on Windows expects to use a shared library, which requires Modified: vendor/libc++/dist/CREDITS.TXT ============================================================================== --- vendor/libc++/dist/CREDITS.TXT Mon Jan 9 21:23:37 2017 (r311823) +++ vendor/libc++/dist/CREDITS.TXT Mon Jan 9 21:23:41 2017 (r311824) @@ -80,6 +80,10 @@ N: Andrew Morrow E: andrew.c.mor...@gmail.com D: Minor patches and Linux fixes. +N: Michael Park +E: mp...@apache.org +D: Implementation of <variant>. + N: Arvid Picciani E: aep at exys dot org D: Minor patches and musl port. Added: vendor/libc++/dist/docs/DesignDocs/ThreadingSupportAPI.rst ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libc++/dist/docs/DesignDocs/ThreadingSupportAPI.rst Mon Jan 9 21:23:41 2017 (r311824) @@ -0,0 +1,70 @@ +===================== +Threading Support API +===================== + +.. contents:: + :local: + +Overview +======== + +Libc++ supports using multiple different threading models and configurations +to implement the threading parts of libc++, including ``<thread>`` and ``<mutex>``. +These different models provide entirely different interfaces from each +other. To address this libc++ wraps the underlying threading API in a new and +consistent API, which it uses internally to implement threading primitives. + +The ``<__threading_support>`` header is where libc++ defines its internal +threading interface. It contains forward declarations of the internal threading +interface as well as definitions for the interface. + +External Threading API and the ``<__external_threading>`` header +================================================================ + +In order to support vendors with custom threading API's libc++ allows the +entire internal threading interface to be provided by an external, +vendor provided, header. + +When ``_LIBCPP_HAS_THREAD_API_EXTERNAL`` is defined the ``<__threading_support>`` +header simply forwards to the ``<__external_threading>`` header (which must exist). +It is expected that the ``<__external_threading>`` header provide the exact +interface normally provided by ``<__threading_support>``. + +External Threading Library +========================== + +Normally ``<__threading_support>`` provides inline definitions to each internal +threading API function it declares. However libc++ also supports using an +external library to provide the definitions. + +When ``_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL`` libc++ does not provide inline +definitions for the internal API, instead assuming the definitions will be +provided by an external library. + +Threading Configuration Macros +============================== + +**_LIBCPP_HAS_NO_THREADS** + This macro is defined when libc++ is built without threading support. It + should not be manually defined by the user. + +**_LIBCPP_HAS_THREAD_API_EXTERNAL** + This macro is defined when libc++ should use the ``<__external_threading>`` + header to provide the internal threading API. This macro overrides + ``_LIBCPP_HAS_THREAD_API_PTHREAD``. + +**_LIBCPP_HAS_THREAD_API_PTHREAD** + This macro is defined when libc++ should use POSIX threads to implement the + internal threading API. + +**_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL** + This macro is defined when libc++ expects the definitions of the internal + threading API to be provided by an external library. When defined + ``<__threading_support>`` will only provide the forward declarations and + typedefs for the internal threading API. + +**_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL** + This macro is used to build an external threading library using the + ``<__threading_support>``. Specifically it exposes the threading API + definitions in ``<__threading_support>`` as non-inline definitions meant to + be compiled into a library. Modified: vendor/libc++/dist/docs/DesignDocs/VisibilityMacros.rst ============================================================================== --- vendor/libc++/dist/docs/DesignDocs/VisibilityMacros.rst Mon Jan 9 21:23:37 2017 (r311823) +++ vendor/libc++/dist/docs/DesignDocs/VisibilityMacros.rst Mon Jan 9 21:23:41 2017 (r311824) @@ -49,7 +49,7 @@ Visibility Macros attribute. With GCC the `visibility(...)` attribute is used and member functions are affected. -**_LIBCPP_TEMPLATE_ONLY** +**_LIBCPP_TEMPLATE_VIS** The same as `_LIBCPP_TYPE_VIS` except that it may be applied to class templates. Modified: vendor/libc++/dist/docs/index.rst ============================================================================== --- vendor/libc++/dist/docs/index.rst Mon Jan 9 21:23:37 2017 (r311823) +++ vendor/libc++/dist/docs/index.rst Mon Jan 9 21:23:41 2017 (r311824) @@ -131,7 +131,7 @@ Design Documents DesignDocs/CapturingConfigInfo DesignDocs/ABIVersioning DesignDocs/VisibilityMacros - + DesignDocs/ThreadingSupportAPI * `<atomic> design <http://libcxx.llvm.org/atomic_design.html>`_ * `<type_traits> design <http://libcxx.llvm.org/type_traits_design.html>`_ Modified: vendor/libc++/dist/include/__bit_reference ============================================================================== --- vendor/libc++/dist/include/__bit_reference Mon Jan 9 21:23:37 2017 (r311823) +++ vendor/libc++/dist/include/__bit_reference Mon Jan 9 21:23:41 2017 (r311824) @@ -40,11 +40,8 @@ class __bit_reference __storage_pointer __seg_; __storage_type __mask_; -#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC) friend typename _Cp::__self; -#else - friend class _Cp::__self; -#endif + friend class __bit_const_reference<_Cp>; friend class __bit_iterator<_Cp, false>; public: @@ -130,11 +127,7 @@ class __bit_const_reference __storage_pointer __seg_; __storage_type __mask_; -#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC) friend typename _Cp::__self; -#else - friend class _Cp::__self; -#endif friend class __bit_iterator<_Cp, true>; public: _LIBCPP_INLINE_VISIBILITY @@ -1221,11 +1214,8 @@ private: __bit_iterator(__storage_pointer __s, unsigned __ctz) _NOEXCEPT : __seg_(__s), __ctz_(__ctz) {} -#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC) friend typename _Cp::__self; -#else - friend class _Cp::__self; -#endif + friend class __bit_reference<_Cp>; friend class __bit_const_reference<_Cp>; friend class __bit_iterator<_Cp, true>; Modified: vendor/libc++/dist/include/__config ============================================================================== --- vendor/libc++/dist/include/__config Mon Jan 9 21:23:37 2017 (r311823) +++ vendor/libc++/dist/include/__config Mon Jan 9 21:23:41 2017 (r311824) @@ -101,6 +101,25 @@ #define __is_identifier(__x) 1 #endif +#if defined(__clang__) +#define _LIBCPP_COMPILER_CLANG +#elif defined(__GNUC__) +#define _LIBCPP_COMPILER_GCC +#elif defined(_MSC_VER) +#define _LIBCPP_COMPILER_MSVC +#elif defined(__IBMCPP__) +#define _LIBCPP_COMPILER_IBM +#endif + +// FIXME: ABI detection should be done via compiler builtin macros. This +// is just a placeholder until Clang implements such macros. For now assume +// that Windows compilers pretending to be MSVC++ target the microsoft ABI. +#if defined(_WIN32) && defined(_MSC_VER) +# define _LIBCPP_ABI_MICROSOFT +#else +# define _LIBCPP_ABI_ITANIUM +#endif + // Need to detect which libc we're using if we're on Linux. #if defined(__linux__) #include <features.h> @@ -164,16 +183,7 @@ # define _LIBCPP_LITTLE_ENDIAN 1 # define _LIBCPP_BIG_ENDIAN 0 # define _LIBCPP_SHORT_WCHAR 1 -// Compiler intrinsics (MSVC) -# if defined(_MSC_VER) && _MSC_VER >= 1400 -# define _LIBCPP_HAS_IS_BASE_OF -# endif -# if defined(_MSC_VER) && !defined(__clang__) -# define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler -# define _LIBCPP_TOSTRING2(x) #x -# define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) -# define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x)) -# endif + // If mingw not explicitly detected, assume using MS C runtime only. # ifndef __MINGW32__ # define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library @@ -230,7 +240,7 @@ #define _LIBCPP_NO_CFI #endif -#if defined(__clang__) +#if defined(_LIBCPP_COMPILER_CLANG) // _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility. @@ -275,10 +285,6 @@ typedef __char32_t char32_t; # define _LIBCPP_NORETURN __attribute__ ((noreturn)) #endif -#if !(__has_feature(cxx_deleted_functions)) -#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS -#endif // !(__has_feature(cxx_deleted_functions)) - #if !(__has_feature(cxx_lambdas)) #define _LIBCPP_HAS_NO_LAMBDAS #endif @@ -390,7 +396,7 @@ namespace std { #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow"))) #endif -#elif defined(__GNUC__) +#elif defined(_LIBCPP_COMPILER_GCC) #define _ALIGNAS(x) __attribute__((__aligned__(x))) #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) @@ -431,7 +437,6 @@ namespace std { #ifndef __GXX_EXPERIMENTAL_CXX0X__ #define _LIBCPP_HAS_NO_DECLTYPE -#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS #define _LIBCPP_HAS_NO_NULLPTR #define _LIBCPP_HAS_NO_UNICODE_CHARS #define _LIBCPP_HAS_NO_VARIADICS @@ -448,7 +453,6 @@ namespace std { #if _GNUC_VER < 404 #define _LIBCPP_HAS_NO_DECLTYPE -#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS #define _LIBCPP_HAS_NO_UNICODE_CHARS #define _LIBCPP_HAS_NO_VARIADICS #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS @@ -475,15 +479,23 @@ using namespace _LIBCPP_NAMESPACE __attr #define _LIBCPP_HAS_NO_ASAN #endif -#elif defined(_LIBCPP_MSVC) +#elif defined(_LIBCPP_COMPILER_MSVC) + +#define _LIBCPP_TOSTRING2(x) #x +#define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) +#define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x)) +#if _MSC_VER < 1900 +#error "MSVC versions prior to Visual Studio 2015 are not supported" +#endif + +#define _LIBCPP_HAS_IS_BASE_OF #define _LIBCPP_HAS_NO_CONSTEXPR #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES #if _MSC_VER <= 1800 #define _LIBCPP_HAS_NO_UNICODE_CHARS #endif -#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS #define _LIBCPP_HAS_NO_NOEXCEPT #define __alignof__ __alignof #define _LIBCPP_NORETURN __declspec(noreturn) @@ -500,7 +512,7 @@ namespace std { #define _LIBCPP_HAS_NO_ASAN -#elif defined(__IBMCPP__) +#elif defined(_LIBCPP_COMPILER_IBM) #define _ALIGNAS(x) __attribute__((__aligned__(x))) #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) @@ -530,7 +542,7 @@ namespace std { #define _LIBCPP_HAS_NO_ASAN -#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__ +#endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] #if defined(__ELF__) #define _LIBCPP_OBJECT_FORMAT_ELF 1 @@ -566,7 +578,7 @@ namespace std { #define _LIBCPP_FUNC_VIS_ONLY #define _LIBCPP_ENUM_VIS -#if defined(_LIBCPP_MSVC) +#if defined(_LIBCPP_COMPILER_MSVC) # define _LIBCPP_INLINE_VISIBILITY __forceinline # define _LIBCPP_ALWAYS_INLINE __forceinline # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __forceinline @@ -739,7 +751,7 @@ template <unsigned> struct __static_asse #define _LIBCPP_DEFAULT = default; #endif -#ifdef _LIBCPP_HAS_NO_DELETED_FUNCTIONS +#ifdef _LIBCPP_CXX03_LANG #define _LIBCPP_EQUAL_DELETE #else #define _LIBCPP_EQUAL_DELETE = delete @@ -892,8 +904,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit // Thread API #if !defined(_LIBCPP_HAS_NO_THREADS) && \ - !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \ - !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) + !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) # if defined(__FreeBSD__) || \ defined(__Fuchsia__) || \ defined(__NetBSD__) || \ @@ -901,7 +912,9 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit defined(__APPLE__) || \ defined(__CloudABI__) || \ defined(__sun__) -# define _LIBCPP_HAS_THREAD_API_PTHREAD +# define _LIBCPP_HAS_THREAD_API_PTHREAD +# elif defined(_LIBCPP_WIN32API) +# define _LIBCPP_HAS_THREAD_API_WIN32 # else # error "No thread API" # endif // _LIBCPP_HAS_THREAD_API Modified: vendor/libc++/dist/include/__config_site.in ============================================================================== --- vendor/libc++/dist/include/__config_site.in Mon Jan 9 21:23:37 2017 (r311823) +++ vendor/libc++/dist/include/__config_site.in Mon Jan 9 21:23:41 2017 (r311824) @@ -21,6 +21,7 @@ #cmakedefine _LIBCPP_HAS_MUSL_LIBC #cmakedefine _LIBCPP_HAS_THREAD_API_PTHREAD #cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNAL +#cmakedefine _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL #cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS #endif // _LIBCPP_CONFIG_SITE Modified: vendor/libc++/dist/include/__debug ============================================================================== --- vendor/libc++/dist/include/__debug Mon Jan 9 21:23:37 2017 (r311823) +++ vendor/libc++/dist/include/__debug Mon Jan 9 21:23:41 2017 (r311824) @@ -122,7 +122,7 @@ struct _LIBCPP_TYPE_VIS __i_node __i_node* __next_; __c_node* __c_; -#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS +#ifndef _LIBCPP_CXX03_LANG __i_node(const __i_node&) = delete; __i_node& operator=(const __i_node&) = delete; #else @@ -145,7 +145,7 @@ struct _LIBCPP_TYPE_VIS __c_node __i_node** end_; __i_node** cap_; -#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS +#ifndef _LIBCPP_CXX03_LANG __c_node(const __c_node&) = delete; __c_node& operator=(const __c_node&) = delete; #else @@ -232,7 +232,7 @@ class _LIBCPP_TYPE_VIS __libcpp_db __libcpp_db(); public: -#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS +#ifndef _LIBCPP_CXX03_LANG __libcpp_db(const __libcpp_db&) = delete; __libcpp_db& operator=(const __libcpp_db&) = delete; #else Modified: vendor/libc++/dist/include/__functional_base ============================================================================== --- vendor/libc++/dist/include/__functional_base Mon Jan 9 21:23:37 2017 (r311823) +++ vendor/libc++/dist/include/__functional_base Mon Jan 9 21:23:41 2017 (r311824) @@ -552,23 +552,10 @@ cref(reference_wrapper<_Tp> __t) _NOEXCE return cref(__t.get()); } -#ifndef _LIBCPP_HAS_NO_VARIADICS -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS - +#ifndef _LIBCPP_CXX03_LANG template <class _Tp> void ref(const _Tp&&) = delete; template <class _Tp> void cref(const _Tp&&) = delete; - -#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS - -template <class _Tp> void ref(const _Tp&&);// = delete; -template <class _Tp> void cref(const _Tp&&);// = delete; - -#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif #if _LIBCPP_STD_VER > 11 template <class _Tp1, class _Tp2 = void> Modified: vendor/libc++/dist/include/__hash_table ============================================================================== --- vendor/libc++/dist/include/__hash_table Mon Jan 9 21:23:37 2017 (r311823) +++ vendor/libc++/dist/include/__hash_table Mon Jan 9 21:23:41 2017 (r311824) @@ -20,7 +20,6 @@ #include <utility> #include <__undef_min_max> -#include <__undef___deallocate> #include <__debug> @@ -1321,7 +1320,7 @@ private: void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {} #endif // _LIBCPP_CXX03_LANG - void __deallocate(__next_pointer __np) _NOEXCEPT; + void __deallocate_node(__next_pointer __np) _NOEXCEPT; __next_pointer __detach() _NOEXCEPT; template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map; @@ -1454,7 +1453,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc> "Predicate must be copy-constructible."); static_assert((is_copy_constructible<hasher>::value), "Hasher must be copy-constructible."); - __deallocate(__p1_.first().__next_); + __deallocate_node(__p1_.first().__next_); #if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__erase_c(this); #endif @@ -1492,7 +1491,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc> template <class _Tp, class _Hash, class _Equal, class _Alloc> void -__hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate(__next_pointer __np) +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np) _NOEXCEPT { __node_allocator& __na = __node_alloc(); @@ -1599,11 +1598,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc> } catch (...) { - __deallocate(__cache); + __deallocate_node(__cache); throw; } #endif // _LIBCPP_NO_EXCEPTIONS - __deallocate(__cache); + __deallocate_node(__cache); } const_iterator __i = __u.begin(); while (__u.size() != 0) @@ -1661,11 +1660,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc> } catch (...) { - __deallocate(__cache); + __deallocate_node(__cache); throw; } #endif // _LIBCPP_NO_EXCEPTIONS - __deallocate(__cache); + __deallocate_node(__cache); } for (; __first != __last; ++__first) __insert_unique(*__first); @@ -1701,11 +1700,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc> } catch (...) { - __deallocate(__cache); + __deallocate_node(__cache); throw; } #endif // _LIBCPP_NO_EXCEPTIONS - __deallocate(__cache); + __deallocate_node(__cache); } for (; __first != __last; ++__first) __insert_multi(_NodeTypes::__get_value(*__first)); @@ -1765,7 +1764,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc> { if (size() > 0) { - __deallocate(__p1_.first().__next_); + __deallocate_node(__p1_.first().__next_); __p1_.first().__next_ = nullptr; size_type __bc = bucket_count(); for (size_type __i = 0; __i < __bc; ++__i) Modified: vendor/libc++/dist/include/__sso_allocator ============================================================================== --- vendor/libc++/dist/include/__sso_allocator Mon Jan 9 21:23:37 2017 (r311823) +++ vendor/libc++/dist/include/__sso_allocator Mon Jan 9 21:23:41 2017 (r311824) @@ -15,8 +15,6 @@ #include <type_traits> #include <new> -#include <__undef___deallocate> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif @@ -64,7 +62,7 @@ public: if (__p == (pointer)&buf_) __allocated_ = false; else - _VSTD::__deallocate(__p); + _VSTD::__libcpp_deallocate(__p); } _LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);} Modified: vendor/libc++/dist/include/__threading_support ============================================================================== --- vendor/libc++/dist/include/__threading_support Mon Jan 9 21:23:37 2017 (r311823) +++ vendor/libc++/dist/include/__threading_support Mon Jan 9 21:23:41 2017 (r311824) @@ -17,39 +17,24 @@ #pragma GCC system_header #endif -#ifndef _LIBCPP_HAS_NO_THREADS - -#ifndef __libcpp_has_include - #ifndef __has_include - #define __libcpp_has_include(x) 0 - #else - #define __libcpp_has_include(x) __has_include(x) - #endif -#endif - -#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) && \ - !__libcpp_has_include(<__external_threading>) -// If the <__external_threading> header is absent, build libc++ against a -// pthread-oriented thread api but leave out its implementation. This setup -// allows building+testing of an externally-threaded library variant (on any -// platform that supports pthreads). Here, an 'externally-threaded' library -// variant is one where the implementation of the libc++ thread api is provided -// as a separate library. -#define _LIBCPP_HAS_THREAD_API_EXTERNAL_PTHREAD -#endif +#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) +# include <__external_threading> +#elif !defined(_LIBCPP_HAS_NO_THREADS) -#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) && \ - __libcpp_has_include(<__external_threading>) -#include <__external_threading> -#else +#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) +# include <pthread.h> +# include <sched.h> +#elif defined(_LIBCPP_HAS_THREAD_API_WIN32) +#include <assert.h> +#include <Windows.h> +#include <process.h> +#include <fibersapi.h> -#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) || \ - defined(_LIBCPP_HAS_THREAD_API_EXTERNAL_PTHREAD) -#include <pthread.h> -#include <sched.h> +#include <chrono> #endif -#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) +#if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \ + defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL) #define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_FUNC_VIS #else #define _LIBCPP_THREAD_ABI_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY @@ -57,8 +42,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) || \ - defined(_LIBCPP_HAS_THREAD_API_EXTERNAL_PTHREAD) +#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) // Mutex typedef pthread_mutex_t __libcpp_mutex_t; #define _LIBCPP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER @@ -81,6 +65,33 @@ typedef pthread_t __libcpp_thread_t; // Thrad Local Storage typedef pthread_key_t __libcpp_tls_key; + +#define _LIBCPP_TLS_DESTRUCTOR_CC +#else +// Mutex +typedef SRWLOCK __libcpp_mutex_t; +#define _LIBCPP_MUTEX_INITIALIZER SRWLOCK_INIT + +typedef CRITICAL_SECTION __libcpp_recursive_mutex_t; + +// Condition Variable +typedef CONDITION_VARIABLE __libcpp_condvar_t; +#define _LIBCPP_CONDVAR_INITIALIZER CONDITION_VARIABLE_INIT + +// Execute Once +typedef INIT_ONCE __libcpp_exec_once_flag; +#define _LIBCPP_EXEC_ONCE_INITIALIZER INIT_ONCE_STATIC_INIT + +// Thread ID +typedef DWORD __libcpp_thread_id; + +// Thread +typedef HANDLE __libcpp_thread_t; + +// Thread Local Storage +typedef DWORD __libcpp_tls_key; + +#define _LIBCPP_TLS_DESTRUCTOR_CC WINAPI #endif // Mutex @@ -167,7 +178,8 @@ void __libcpp_thread_yield(); // Thread local storage _LIBCPP_THREAD_ABI_VISIBILITY -int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *)); +int __libcpp_tls_create(__libcpp_tls_key* __key, + void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*)); _LIBCPP_THREAD_ABI_VISIBILITY void *__libcpp_tls_get(__libcpp_tls_key __key); @@ -175,8 +187,10 @@ void *__libcpp_tls_get(__libcpp_tls_key _LIBCPP_THREAD_ABI_VISIBILITY int __libcpp_tls_set(__libcpp_tls_key __key, void *__p); -#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) || \ - defined(_LIBCPP_BUILDING_THREAD_API_EXTERNAL_PTHREAD) +#if !defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \ + defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL) + +#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m) { @@ -342,12 +356,230 @@ int __libcpp_tls_set(__libcpp_tls_key __ return pthread_setspecific(__key, __p); } +#elif defined(_LIBCPP_HAS_THREAD_API_WIN32) + +// Mutex +int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m) +{ + InitializeCriticalSection(__m); + return 0; +} + +int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m) +{ + EnterCriticalSection(__m); + return 0; +} + +int __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m) +{ + TryEnterCriticalSection(__m); + return 0; +} + +int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m) +{ + LeaveCriticalSection(__m); + return 0; +} + +int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m) +{ + static_cast<void>(__m); + return 0; +} + +int __libcpp_mutex_lock(__libcpp_mutex_t *__m) +{ + AcquireSRWLockExclusive(__m); + return 0; +} + +int __libcpp_mutex_trylock(__libcpp_mutex_t *__m) +{ + TryAcquireSRWLockExclusive(__m); + return 0; +} + +int __libcpp_mutex_unlock(__libcpp_mutex_t *__m) +{ + ReleaseSRWLockExclusive(__m); + return 0; +} + +int __libcpp_mutex_destroy(__libcpp_mutex_t *__m) +{ + static_cast<void>(__m); + return 0; +} + +// Condition Variable +int __libcpp_condvar_signal(__libcpp_condvar_t *__cv) +{ + WakeConditionVariable(__cv); + return 0; +} + +int __libcpp_condvar_broadcast(__libcpp_condvar_t *__cv) +{ + WakeAllConditionVariable(__cv); + return 0; +} + +int __libcpp_condvar_wait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m) +{ + SleepConditionVariableSRW(__cv, __m, INFINITE, 0); + return 0; +} + +int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m, + timespec *__ts) +{ + using namespace _VSTD::chrono; + + auto duration = seconds(__ts->tv_sec) + nanoseconds(__ts->tv_nsec); + auto abstime = + system_clock::time_point(duration_cast<system_clock::duration>(duration)); + auto timeout_ms = duration_cast<milliseconds>(abstime - system_clock::now()); + + if (!SleepConditionVariableSRW(__cv, __m, + timeout_ms.count() > 0 ? timeout_ms.count() + : 0, + 0)) + return GetLastError(); + return 0; +} + +int __libcpp_condvar_destroy(__libcpp_condvar_t *__cv) +{ + static_cast<void>(__cv); + return 0; +} + +// Execute Once +static inline _LIBCPP_ALWAYS_INLINE BOOL CALLBACK +__libcpp_init_once_execute_once_thunk(PINIT_ONCE __init_once, PVOID __parameter, + PVOID *__context) +{ + static_cast<void>(__init_once); + static_cast<void>(__context); + + void (*init_routine)(void) = reinterpret_cast<void (*)(void)>(__parameter); + init_routine(); + return TRUE; +} + +int __libcpp_execute_once(__libcpp_exec_once_flag *__flag, + void (*__init_routine)(void)) +{ + if (!InitOnceExecuteOnce(__flag, __libcpp_init_once_execute_once_thunk, + reinterpret_cast<void *>(__init_routine), NULL)) + return GetLastError(); + return 0; +} + +// Thread ID +bool __libcpp_thread_id_equal(__libcpp_thread_id __lhs, + __libcpp_thread_id __rhs) +{ + return __lhs == __rhs; +} + +bool __libcpp_thread_id_less(__libcpp_thread_id __lhs, __libcpp_thread_id __rhs) +{ + return __lhs < __rhs; +} + +// Thread +struct __libcpp_beginthreadex_thunk_data +{ + void *(*__func)(void *); + void *__arg; +}; + +static inline _LIBCPP_ALWAYS_INLINE unsigned int WINAPI +__libcpp_beginthreadex_thunk(void *__data) +{ + __libcpp_beginthreadex_thunk_data data = + *reinterpret_cast<__libcpp_beginthreadex_thunk_data *>(__data); + delete reinterpret_cast<__libcpp_beginthreadex_thunk_data *>(__data); + return reinterpret_cast<unsigned int>(data.__func(data.__arg)); +} + +int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *), + void *__arg) +{ + auto *data = new __libcpp_beginthreadex_thunk_data; + data->__func = __func; + data->__arg = __arg; + + *__t = reinterpret_cast<HANDLE>(_beginthreadex(NULL, 0, + __libcpp_beginthreadex_thunk, + data, 0, NULL)); + if (*__t) + return 0; + return GetLastError(); +} + +__libcpp_thread_id __libcpp_thread_get_current_id() +{ + return GetCurrentThreadId(); +} + +__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t) +{ + return GetThreadId(*__t); +} + +int __libcpp_thread_join(__libcpp_thread_t *__t) +{ + if (WaitForSingleObjectEx(*__t, INFINITE, FALSE) == WAIT_FAILED) + return GetLastError(); + if (!CloseHandle(*__t)) + return GetLastError(); + return 0; +} + +int __libcpp_thread_detach(__libcpp_thread_t *__t) +{ + if (!CloseHandle(*__t)) + return GetLastError(); + return 0; +} + +void __libcpp_thread_yield() +{ + SwitchToThread(); +} + +// Thread Local Storage +int __libcpp_tls_create(__libcpp_tls_key* __key, + void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*)) +{ + *__key = FlsAlloc(__at_exit); + if (*__key == FLS_OUT_OF_INDEXES) + return GetLastError(); + return 0; +} + +void *__libcpp_tls_get(__libcpp_tls_key __key) +{ + return FlsGetValue(__key); +} + +int __libcpp_tls_set(__libcpp_tls_key __key, void *__p) +{ + if (!FlsSetValue(__key, __p)) + return GetLastError(); + return 0; +} + #endif // _LIBCPP_HAS_THREAD_API_PTHREAD -_LIBCPP_END_NAMESPACE_STD +#endif // !_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL || _LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL -#endif // !_LIBCPP_HAS_THREAD_API_EXTERNAL || !__libcpp_has_include(<__external_threading>) +_LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_HAS_NO_THREADS +#endif // !_LIBCPP_HAS_NO_THREADS #endif // _LIBCPP_THREADING_SUPPORT Modified: vendor/libc++/dist/include/algorithm ============================================================================== --- vendor/libc++/dist/include/algorithm Mon Jan 9 21:23:37 2017 (r311823) +++ vendor/libc++/dist/include/algorithm Mon Jan 9 21:23:41 2017 (r311824) @@ -3100,28 +3100,28 @@ template <class _PopulationIterator, cla class _UniformRandomNumberGenerator> _LIBCPP_INLINE_VISIBILITY _SampleIterator __sample(_PopulationIterator __first, - _PopulationIterator __last, _SampleIterator __out, + _PopulationIterator __last, _SampleIterator __output, _Distance __n, _UniformRandomNumberGenerator & __g, input_iterator_tag) { _Distance __k = 0; for (; __first != __last && __k < __n; ++__first, (void)++__k) - __out[__k] = *__first; + __output[__k] = *__first; _Distance __sz = __k; for (; __first != __last; ++__first, (void)++__k) { _Distance __r = _VSTD::uniform_int_distribution<_Distance>(0, __k)(__g); if (__r < __sz) - __out[__r] = *__first; + __output[__r] = *__first; } - return __out + _VSTD::min(__n, __k); + return __output + _VSTD::min(__n, __k); } template <class _PopulationIterator, class _SampleIterator, class _Distance, class _UniformRandomNumberGenerator> _LIBCPP_INLINE_VISIBILITY _SampleIterator __sample(_PopulationIterator __first, - _PopulationIterator __last, _SampleIterator __out, + _PopulationIterator __last, _SampleIterator __output, _Distance __n, _UniformRandomNumberGenerator& __g, forward_iterator_tag) { @@ -3130,18 +3130,18 @@ _SampleIterator __sample(_PopulationIter _Distance __r = _VSTD::uniform_int_distribution<_Distance>(0, --__unsampled_sz)(__g); if (__r < __n) { - *__out++ = *__first; + *__output++ = *__first; --__n; } } - return __out; + return __output; } template <class _PopulationIterator, class _SampleIterator, class _Distance, class _UniformRandomNumberGenerator> _LIBCPP_INLINE_VISIBILITY _SampleIterator __sample(_PopulationIterator __first, - _PopulationIterator __last, _SampleIterator __out, + _PopulationIterator __last, _SampleIterator __output, _Distance __n, _UniformRandomNumberGenerator& __g) { typedef typename iterator_traits<_PopulationIterator>::iterator_category _PopCategory; @@ -3153,7 +3153,7 @@ _SampleIterator __sample(_PopulationIter typedef typename common_type<_Distance, _Difference>::type _CommonType; _LIBCPP_ASSERT(__n >= 0, "N must be a positive number."); return _VSTD::__sample( - __first, __last, __out, _CommonType(__n), + __first, __last, __output, _CommonType(__n), __g, _PopCategory()); } @@ -3162,9 +3162,9 @@ template <class _PopulationIterator, cla class _UniformRandomNumberGenerator> inline _LIBCPP_INLINE_VISIBILITY _SampleIterator sample(_PopulationIterator __first, - _PopulationIterator __last, _SampleIterator __out, + _PopulationIterator __last, _SampleIterator __output, _Distance __n, _UniformRandomNumberGenerator&& __g) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"