Date: Thu, 26 May 2016 18:52:49 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300770 - in head: . contrib/libc++/include contrib/libc++/include/experimental contrib/libc++/include/ext contrib/libc++/src contrib/libc++/src/include contrib/libc++/src/support lib/l... Message-ID: <201605261852.u4QIqn5w073953@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Thu May 26 18:52:49 2016 New Revision: 300770 URL: https://svnweb.freebsd.org/changeset/base/300770 Log: Update libc++ to 3.8.0. Excerpted list of fixes (with upstream revision numbers): r242679 Implement the plugin-based version of std::search. There are no searchers yet; those are coming soon. r242682 Implement the default searcher for std::experimental::search. r243728 Add <experimental/any> v2. r245330 implement more of N4258 - Cleaning up noexcept in the standard library. Specifically add new noexcept stuff to vector and string's move-assignment operations r245334 Fix PR22606 - Leak pthread_key with static storage duration to ensure all of thread-local destructors are called. r245335 Fix PR23589: std::function doesn't recognize null pointer to varargs function. r247036 Implementation of Boyer-Moore and Boyer-Moore-Horspool searchers for the LFTS. r249325 Implement LWG#2063, and update the issues links to point to the github generated pages r249738 Split <ctype.h> out of <cctype>. r249739 Split <errno.h> out of <cerrno>. r249740 Split <float.h> out of <cfloat>. r249741 Split <inttypes.h> out of <cinttypes>. r249742 Split <math.h> out of <cmath>. r249743 Split <setjmp.h> out of <csetjmp>. r249761 Split <stddef.h> out of <cstddef>. r249798 Split <stdio.h> out of <cstdio>. r249800 Split <stdlib.h> out of <cstdlib>. r249889 Split <wchar.h> out of <cwchar>. r249890 Split <wctype.h> out of <cwctype>. r249929 Split <string.h> out of <cstring>. r250254 ABI versioning macros for libc++. r251246 Fix LWG#2244: basic_istream::seekg r251247 Fix LWG#2127: Move-construction with raw_storage_iterator. r251253 Fix LWG#2476: scoped_allocator_adaptor is not assignable r251257 Fix LWG#2489: mem_fn() should be noexcept r251618 Implement P0004R1 'Remove Deprecated iostreams aliases' r251766 Implement the first part of P0006R0: Adopt Type Traits Variable Templates for C++17. r252195 Implement P0092R1 for C++1z r252350 Allow deque to handle incomplete types. r252406 More of P0006R0: type traits variable aliases for C++17. r252407 Implement LWG#2353: std::next is over-constrained r252905 Implement P0074: Making owner_less more flexible r253215 Implement P0013R1: Logical Operator Type Traits. r253274 Implement P0007: Constant View: A proposal for a std::as_const helper function template. r254119 Add static_assert to set/multiset/map/multimap/forward_list/deque that the allocator's value_type match the container's value_type. r254283 Implement more of P0006; Type Traits Variable Templates. r255941 LWG2485: get() should be overloaded for const tuple&&. r256325 Fix LWG Issue #2367 - Fixing std::tuple and std::pair's default constructors. r256652 Fix for ALL undefined behavior in <list>. r256859 First half of LWG#2354: 'Unnecessary copying when inserting into maps with braced-init syntax' Exp-run: antoine Relnotes: yes Added: head/contrib/libc++/include/__nullptr - copied unchanged from r298146, vendor/libc++/dist/include/__nullptr head/contrib/libc++/include/ctype.h - copied unchanged from r298146, vendor/libc++/dist/include/ctype.h head/contrib/libc++/include/errno.h - copied unchanged from r298146, vendor/libc++/dist/include/errno.h head/contrib/libc++/include/experimental/any - copied unchanged from r298146, vendor/libc++/dist/include/experimental/any head/contrib/libc++/include/experimental/functional - copied unchanged from r298146, vendor/libc++/dist/include/experimental/functional head/contrib/libc++/include/float.h - copied unchanged from r298146, vendor/libc++/dist/include/float.h head/contrib/libc++/include/inttypes.h - copied unchanged from r298146, vendor/libc++/dist/include/inttypes.h head/contrib/libc++/include/math.h - copied unchanged from r298146, vendor/libc++/dist/include/math.h head/contrib/libc++/include/setjmp.h - copied unchanged from r298146, vendor/libc++/dist/include/setjmp.h head/contrib/libc++/include/stddef.h - copied unchanged from r298146, vendor/libc++/dist/include/stddef.h head/contrib/libc++/include/stdio.h - copied unchanged from r298146, vendor/libc++/dist/include/stdio.h head/contrib/libc++/include/stdlib.h - copied unchanged from r298146, vendor/libc++/dist/include/stdlib.h head/contrib/libc++/include/wchar.h - copied unchanged from r298146, vendor/libc++/dist/include/wchar.h head/contrib/libc++/include/wctype.h - copied unchanged from r298146, vendor/libc++/dist/include/wctype.h head/contrib/libc++/src/any.cpp - copied unchanged from r298146, vendor/libc++/dist/src/any.cpp head/contrib/libc++/src/include/ - copied from r298146, vendor/libc++/dist/src/include/ Deleted: head/contrib/libc++/src/config_elast.h head/contrib/libc++/src/support/ Modified: head/Makefile.inc1 head/contrib/libc++/include/__config head/contrib/libc++/include/__functional_03 head/contrib/libc++/include/__functional_base head/contrib/libc++/include/__functional_base_03 head/contrib/libc++/include/__hash_table head/contrib/libc++/include/__locale head/contrib/libc++/include/__mutex_base head/contrib/libc++/include/__split_buffer head/contrib/libc++/include/__tree head/contrib/libc++/include/__tuple head/contrib/libc++/include/algorithm head/contrib/libc++/include/array head/contrib/libc++/include/atomic head/contrib/libc++/include/bitset head/contrib/libc++/include/cctype head/contrib/libc++/include/cerrno head/contrib/libc++/include/cfenv head/contrib/libc++/include/cfloat head/contrib/libc++/include/chrono head/contrib/libc++/include/cinttypes head/contrib/libc++/include/cmath head/contrib/libc++/include/complex.h head/contrib/libc++/include/condition_variable head/contrib/libc++/include/csetjmp head/contrib/libc++/include/cstddef head/contrib/libc++/include/cstdio head/contrib/libc++/include/cstdlib head/contrib/libc++/include/cwchar head/contrib/libc++/include/cwctype head/contrib/libc++/include/deque head/contrib/libc++/include/exception head/contrib/libc++/include/experimental/algorithm head/contrib/libc++/include/experimental/dynarray head/contrib/libc++/include/ext/hash_map head/contrib/libc++/include/forward_list head/contrib/libc++/include/functional head/contrib/libc++/include/future head/contrib/libc++/include/ios head/contrib/libc++/include/istream head/contrib/libc++/include/iterator head/contrib/libc++/include/limits head/contrib/libc++/include/list head/contrib/libc++/include/locale head/contrib/libc++/include/map head/contrib/libc++/include/memory head/contrib/libc++/include/module.modulemap head/contrib/libc++/include/mutex head/contrib/libc++/include/random head/contrib/libc++/include/ratio head/contrib/libc++/include/regex head/contrib/libc++/include/scoped_allocator head/contrib/libc++/include/set head/contrib/libc++/include/string head/contrib/libc++/include/thread head/contrib/libc++/include/tuple head/contrib/libc++/include/type_traits head/contrib/libc++/include/unordered_map head/contrib/libc++/include/utility head/contrib/libc++/include/valarray head/contrib/libc++/include/vector head/contrib/libc++/src/exception.cpp head/contrib/libc++/src/future.cpp head/contrib/libc++/src/ios.cpp head/contrib/libc++/src/locale.cpp head/contrib/libc++/src/memory.cpp head/contrib/libc++/src/mutex.cpp head/contrib/libc++/src/new.cpp head/contrib/libc++/src/stdexcept.cpp head/contrib/libc++/src/system_error.cpp head/contrib/libc++/src/typeinfo.cpp head/lib/libc++/Makefile Directory Properties: head/contrib/libc++/ (props changed) Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu May 26 18:52:26 2016 (r300769) +++ head/Makefile.inc1 Thu May 26 18:52:49 2016 (r300770) @@ -500,7 +500,7 @@ HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MT HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT .endif -CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCFLAGS} ${XCXXFLAGS}" \ +CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCXXFLAGS} ${XCFLAGS}" \ CPP="${XCPP} ${XCFLAGS}" \ AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \ OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \ Modified: head/contrib/libc++/include/__config ============================================================================== --- head/contrib/libc++/include/__config Thu May 26 18:52:26 2016 (r300769) +++ head/contrib/libc++/include/__config Thu May 26 18:52:49 2016 (r300770) @@ -11,19 +11,37 @@ #ifndef _LIBCPP_CONFIG #define _LIBCPP_CONFIG -#if !defined(_MSC_VER) || defined(__clang__) +#if defined(_MSC_VER) && !defined(__clang__) +#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER +#endif + +#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER #pragma GCC system_header #endif +#ifdef __cplusplus + #ifdef __GNUC__ #define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__) #else #define _GNUC_VER 0 #endif -#define _LIBCPP_VERSION 3700 +#define _LIBCPP_VERSION 3800 +#ifndef _LIBCPP_ABI_VERSION #define _LIBCPP_ABI_VERSION 1 +#endif + +#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2 +// Change short string represention so that string data starts at offset 0, +// improving its alignment in some cases. +#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT +// Fix deque iterator type in order to support incomplete types. +#define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE +// Fix undefined behavior in how std::list stores it's linked nodes. +#define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB +#endif #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y #define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) @@ -37,6 +55,9 @@ #ifndef __has_builtin #define __has_builtin(__x) 0 #endif +#ifndef __has_extension +#define __has_extension(__x) 0 +#endif #ifndef __has_feature #define __has_feature(__x) 0 #endif @@ -61,6 +82,16 @@ #endif // __BIG_ENDIAN__ #endif // __BIG_ENDIAN__ +#ifdef __BYTE_ORDER__ +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define _LIBCPP_LITTLE_ENDIAN 1 +#define _LIBCPP_BIG_ENDIAN 0 +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +#define _LIBCPP_LITTLE_ENDIAN 0 +#define _LIBCPP_BIG_ENDIAN 1 +#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +#endif // __BYTE_ORDER__ + #ifdef __FreeBSD__ # include <sys/endian.h> # if _BYTE_ORDER == _LITTLE_ENDIAN @@ -227,9 +258,12 @@ #if defined(__clang__) -#if defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \ - !defined(__arm__) -#define _LIBCPP_ALTERNATE_STRING_LAYOUT +// _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for +// _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility. +#if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \ + !defined(__arm__)) || \ + defined(_LIBCPP_ALTERNATE_STRING_LAYOUT) +#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT #endif #if __has_feature(cxx_alignas) @@ -273,6 +307,10 @@ typedef __char32_t char32_t; #define _LIBCPP_UNUSED __attribute__((__unused__)) +#if !(__has_feature(cxx_default_function_template_args)) +#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS +#endif + #if !(__has_feature(cxx_defaulted_functions)) #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS #endif // !(__has_feature(cxx_defaulted_functions)) @@ -354,14 +392,19 @@ typedef __char32_t char32_t; #elif defined(__ANDROID__) #define _LIBCPP_HAS_QUICK_EXIT #elif defined(__linux__) -#include <features.h> +#if !defined(_LIBCPP_HAS_MUSL_LIBC) +# include <features.h> #if __GLIBC_PREREQ(2, 15) #define _LIBCPP_HAS_QUICK_EXIT #endif #if __GLIBC_PREREQ(2, 17) #define _LIBCPP_HAS_C11_FEATURES #endif +#else // defined(_LIBCPP_HAS_MUSL_LIBC) +#define _LIBCPP_HAS_QUICK_EXIT +#define _LIBCPP_HAS_C11_FEATURES #endif +#endif // __linux__ #endif #if !(__has_feature(cxx_noexcept)) @@ -390,6 +433,11 @@ namespace std { #define _LIBCPP_HAS_NO_ASAN #endif +// Allow for build-time disabling of unsigned integer sanitization +#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute((no_sanitize("unsigned-integer-overflow"))) +#endif + #elif defined(__GNUC__) #define _ALIGNAS(x) __attribute__((__aligned__(x))) @@ -437,6 +485,7 @@ namespace std { #define _LIBCPP_HAS_NO_ADVANCED_SFINAE #define _LIBCPP_HAS_NO_DECLTYPE +#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS #define _LIBCPP_HAS_NO_NULLPTR @@ -444,22 +493,18 @@ namespace std { #define _LIBCPP_HAS_NO_UNICODE_CHARS #define _LIBCPP_HAS_NO_VARIADICS #define _LIBCPP_HAS_NO_RVALUE_REFERENCES -#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS #define _LIBCPP_HAS_NO_STRONG_ENUMS #define _LIBCPP_HAS_NO_NOEXCEPT #else // __GXX_EXPERIMENTAL_CXX0X__ -#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS - #if _GNUC_VER < 403 +#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS #define _LIBCPP_HAS_NO_RVALUE_REFERENCES -#endif - -#if _GNUC_VER < 403 #define _LIBCPP_HAS_NO_STATIC_ASSERT #endif + #if _GNUC_VER < 404 #define _LIBCPP_HAS_NO_DECLTYPE #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS @@ -498,7 +543,6 @@ using namespace _LIBCPP_NAMESPACE __attr #elif defined(_LIBCPP_MSVC) #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES -#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER #define _LIBCPP_HAS_NO_CONSTEXPR #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES @@ -532,9 +576,9 @@ namespace std { #define _LIBCPP_NORETURN __attribute__((noreturn)) #define _LIBCPP_UNUSED +#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES #define _LIBCPP_HAS_NO_ADVANCED_SFINAE -#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #define _LIBCPP_HAS_NO_NOEXCEPT #define _LIBCPP_HAS_NO_NULLPTR @@ -579,9 +623,11 @@ typedef unsigned int char32_t; #ifdef _LIBCPP_HAS_NO_STATIC_ASSERT +extern "C++" { template <bool> struct __static_assert_test; template <> struct __static_assert_test<true> {}; template <unsigned> struct __static_assert_check {}; +} #define static_assert(__b, __m) \ typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \ _LIBCPP_CONCAT(__t, __LINE__) @@ -724,6 +770,12 @@ template <unsigned> struct __static_asse #define _LIBCPP_CONSTEXPR_AFTER_CXX11 #endif +#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES +# define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x) +#else +# define _LIBCPP_EXPLICIT_MOVE(x) (x) +#endif + #ifndef _LIBCPP_HAS_NO_ASAN extern "C" void __sanitizer_annotate_contiguous_container( const void *, const void *, const void *, const void *); @@ -733,7 +785,7 @@ extern "C" void __sanitizer_annotate_con // g++ and cl.exe have RTTI on by default and define a macro when it is. // g++ only defines the macro in 4.3.2 and onwards. #if !defined(_LIBCPP_NO_RTTI) -# if defined(__GNUG__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \ +# if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \ (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI) # define _LIBCPP_NO_RTTI # elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI) @@ -765,7 +817,7 @@ extern "C" void __sanitizer_annotate_con #define _LIBCPP_HAS_NO_STDOUT #endif -#if defined(__ANDROID__) || defined(__CloudABI__) +#if defined(__ANDROID__) || defined(__CloudABI__) || defined(_LIBCPP_HAS_MUSL_LIBC) #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE #endif @@ -775,4 +827,21 @@ extern "C" void __sanitizer_annotate_con #define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS #endif -#endif // _LIBCPP_CONFIG +#if __has_feature(cxx_atomic) || __has_extension(c_atomic) +#define _LIBCPP_HAS_C_ATOMIC_IMP +#elif _GNUC_VER > 407 +#define _LIBCPP_HAS_GCC_ATOMIC_IMP +#endif + +#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \ + || defined(_LIBCPP_HAS_NO_THREADS) +#define _LIBCPP_HAS_NO_ATOMIC_HEADER +#endif + +#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +#endif + +#endif // __cplusplus + +#endif // _LIBCPP_CONFIG Modified: head/contrib/libc++/include/__functional_03 ============================================================================== --- head/contrib/libc++/include/__functional_03 Thu May 26 18:52:26 2016 (r300769) +++ head/contrib/libc++/include/__functional_03 Thu May 26 18:52:49 2016 (r300770) @@ -17,218 +17,7 @@ #pragma GCC system_header #endif -template <class _Tp> -class __mem_fn - : public __weak_result_type<_Tp> -{ -public: - // types - typedef _Tp type; -private: - type __f_; - -public: - _LIBCPP_INLINE_VISIBILITY __mem_fn(type __f) : __f_(__f) {} - - // invoke - - typename __invoke_return<type>::type - operator() () const - { - return __invoke(__f_); - } - - template <class _A0> - typename __invoke_return0<type, _A0>::type - operator() (_A0& __a0) const - { - return __invoke(__f_, __a0); - } - - template <class _A0, class _A1> - typename __invoke_return1<type, _A0, _A1>::type - operator() (_A0& __a0, _A1& __a1) const - { - return __invoke(__f_, __a0, __a1); - } - - template <class _A0, class _A1, class _A2> - typename __invoke_return2<type, _A0, _A1, _A2>::type - operator() (_A0& __a0, _A1& __a1, _A2& __a2) const - { - return __invoke(__f_, __a0, __a1, __a2); - } -}; - -template<class _Rp, class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp _Tp::*> -mem_fn(_Rp _Tp::* __pm) -{ - return __mem_fn<_Rp _Tp::*>(__pm); -} - -template<class _Rp, class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)()> -mem_fn(_Rp (_Tp::* __pm)()) -{ - return __mem_fn<_Rp (_Tp::*)()>(__pm); -} - -template<class _Rp, class _Tp, class _A0> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0)> -mem_fn(_Rp (_Tp::* __pm)(_A0)) -{ - return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm); -} - -template<class _Rp, class _Tp, class _A0, class _A1> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1)> -mem_fn(_Rp (_Tp::* __pm)(_A0, _A1)) -{ - return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm); -} - -template<class _Rp, class _Tp, class _A0, class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)> -mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2)) -{ - return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm); -} - -template<class _Rp, class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)() const> -mem_fn(_Rp (_Tp::* __pm)() const) -{ - return __mem_fn<_Rp (_Tp::*)() const>(__pm); -} - -template<class _Rp, class _Tp, class _A0> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0) const> -mem_fn(_Rp (_Tp::* __pm)(_A0) const) -{ - return __mem_fn<_Rp (_Tp::*)(_A0) const>(__pm); -} - -template<class _Rp, class _Tp, class _A0, class _A1> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1) const> -mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const) -{ - return __mem_fn<_Rp (_Tp::*)(_A0, _A1) const>(__pm); -} - -template<class _Rp, class _Tp, class _A0, class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const> -mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const) -{ - return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const>(__pm); -} - -template<class _Rp, class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)() volatile> -mem_fn(_Rp (_Tp::* __pm)() volatile) -{ - return __mem_fn<_Rp (_Tp::*)() volatile>(__pm); -} - -template<class _Rp, class _Tp, class _A0> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0) volatile> -mem_fn(_Rp (_Tp::* __pm)(_A0) volatile) -{ - return __mem_fn<_Rp (_Tp::*)(_A0) volatile>(__pm); -} - -template<class _Rp, class _Tp, class _A0, class _A1> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1) volatile> -mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) volatile) -{ - return __mem_fn<_Rp (_Tp::*)(_A0, _A1) volatile>(__pm); -} - -template<class _Rp, class _Tp, class _A0, class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) volatile> -mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) volatile) -{ - return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) volatile>(__pm); -} - -template<class _Rp, class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)() const volatile> -mem_fn(_Rp (_Tp::* __pm)() const volatile) -{ - return __mem_fn<_Rp (_Tp::*)() const volatile>(__pm); -} - -template<class _Rp, class _Tp, class _A0> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0) const volatile> -mem_fn(_Rp (_Tp::* __pm)(_A0) const volatile) -{ - return __mem_fn<_Rp (_Tp::*)(_A0) const volatile>(__pm); -} - -template<class _Rp, class _Tp, class _A0, class _A1> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1) const volatile> -mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const volatile) -{ - return __mem_fn<_Rp (_Tp::*)(_A0, _A1) const volatile>(__pm); -} - -template<class _Rp, class _Tp, class _A0, class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const volatile> -mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const volatile) -{ - return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const volatile>(__pm); -} - -// bad_function_call - -class _LIBCPP_EXCEPTION_ABI bad_function_call - : public exception -{ -}; - -template<class _Fp> class _LIBCPP_TYPE_VIS_ONLY function; // undefined - -namespace __function -{ - -template<class _Fp> -struct __maybe_derive_from_unary_function -{ -}; - -template<class _Rp, class _A1> -struct __maybe_derive_from_unary_function<_Rp(_A1)> - : public unary_function<_A1, _Rp> -{ -}; - -template<class _Fp> -struct __maybe_derive_from_binary_function -{ -}; - -template<class _Rp, class _A1, class _A2> -struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)> - : public binary_function<_A1, _A2, _Rp> -{ -}; +namespace __function { template<class _Fp> class __base; @@ -662,15 +451,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp aligned_storage<3*sizeof(void*)>::type __buf_; __base* __f_; - template <class _Fp> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const _Fp&) {return true;} - template <class _R2> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (*__p)()) {return __p;} - template <class _R2> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const function<_R2()>& __p) {return __p;} public: typedef _Rp result_type; @@ -769,7 +549,7 @@ function<_Rp()>::function(_Fp __f, typename enable_if<!is_integral<_Fp>::value>::type*) : __f_(0) { - if (__not_null(__f)) + if (__function::__not_null(__f)) { typedef __function::__func<_Fp, allocator<_Fp>, _Rp()> _FF; if (sizeof(_FF) <= sizeof(__buf_)) @@ -796,7 +576,7 @@ function<_Rp()>::function(allocator_arg_ : __f_(0) { typedef allocator_traits<_Alloc> __alloc_traits; - if (__not_null(__f)) + if (__function::__not_null(__f)) { typedef __function::__func<_Fp, _Alloc, _Rp()> _FF; if (sizeof(_FF) <= sizeof(__buf_)) @@ -947,27 +727,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp aligned_storage<3*sizeof(void*)>::type __buf_; __base* __f_; - template <class _Fp> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const _Fp&) {return true;} - template <class _R2, class _B0> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (*__p)(_B0)) {return __p;} - template <class _R2, class _Cp> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)()) {return __p;} - template <class _R2, class _Cp> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)() const) {return __p;} - template <class _R2, class _Cp> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)() volatile) {return __p;} - template <class _R2, class _Cp> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)() const volatile) {return __p;} - template <class _R2, class _B0> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const function<_R2(_B0)>& __p) {return __p;} public: typedef _Rp result_type; @@ -1066,7 +825,7 @@ function<_Rp(_A0)>::function(_Fp __f, typename enable_if<!is_integral<_Fp>::value>::type*) : __f_(0) { - if (__not_null(__f)) + if (__function::__not_null(__f)) { typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) @@ -1093,7 +852,7 @@ function<_Rp(_A0)>::function(allocator_a : __f_(0) { typedef allocator_traits<_Alloc> __alloc_traits; - if (__not_null(__f)) + if (__function::__not_null(__f)) { typedef __function::__func<_Fp, _Alloc, _Rp(_A0)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) @@ -1244,27 +1003,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp aligned_storage<3*sizeof(void*)>::type __buf_; __base* __f_; - template <class _Fp> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const _Fp&) {return true;} - template <class _R2, class _B0, class _B1> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (*__p)(_B0, _B1)) {return __p;} - template <class _R2, class _Cp, class _B1> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)(_B1)) {return __p;} - template <class _R2, class _Cp, class _B1> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)(_B1) const) {return __p;} - template <class _R2, class _Cp, class _B1> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)(_B1) volatile) {return __p;} - template <class _R2, class _Cp, class _B1> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)(_B1) const volatile) {return __p;} - template <class _R2, class _B0, class _B1> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const function<_R2(_B0, _B1)>& __p) {return __p;} public: typedef _Rp result_type; @@ -1363,7 +1101,7 @@ function<_Rp(_A0, _A1)>::function(_Fp __ typename enable_if<!is_integral<_Fp>::value>::type*) : __f_(0) { - if (__not_null(__f)) + if (__function::__not_null(__f)) { typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) @@ -1390,7 +1128,7 @@ function<_Rp(_A0, _A1)>::function(alloca : __f_(0) { typedef allocator_traits<_Alloc> __alloc_traits; - if (__not_null(__f)) + if (__function::__not_null(__f)) { typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) @@ -1540,27 +1278,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp aligned_storage<3*sizeof(void*)>::type __buf_; __base* __f_; - template <class _Fp> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const _Fp&) {return true;} - template <class _R2, class _B0, class _B1, class _B2> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (*__p)(_B0, _B1, _B2)) {return __p;} - template <class _R2, class _Cp, class _B1, class _B2> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2)) {return __p;} - template <class _R2, class _Cp, class _B1, class _B2> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) const) {return __p;} - template <class _R2, class _Cp, class _B1, class _B2> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) volatile) {return __p;} - template <class _R2, class _Cp, class _B1, class _B2> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) const volatile) {return __p;} - template <class _R2, class _B0, class _B1, class _B2> - _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const function<_R2(_B0, _B1, _B2)>& __p) {return __p;} public: typedef _Rp result_type; @@ -1660,7 +1377,7 @@ function<_Rp(_A0, _A1, _A2)>::function(_ typename enable_if<!is_integral<_Fp>::value>::type*) : __f_(0) { - if (__not_null(__f)) + if (__function::__not_null(__f)) { typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1, _A2)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) @@ -1687,7 +1404,7 @@ function<_Rp(_A0, _A1, _A2)>::function(a : __f_(0) { typedef allocator_traits<_Alloc> __alloc_traits; - if (__not_null(__f)) + if (__function::__not_null(__f)) { typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) @@ -1856,274 +1573,4 @@ void swap(function<_Fp>& __x, function<_Fp>& __y) {return __x.swap(__y);} -template<class _Tp> struct __is_bind_expression : public false_type {}; -template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_bind_expression - : public __is_bind_expression<typename remove_cv<_Tp>::type> {}; - -template<class _Tp> struct __is_placeholder : public integral_constant<int, 0> {}; -template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_placeholder - : public __is_placeholder<typename remove_cv<_Tp>::type> {}; - -namespace placeholders -{ - -template <int _Np> struct __ph {}; - -extern __ph<1> _1; -extern __ph<2> _2; -extern __ph<3> _3; -extern __ph<4> _4; -extern __ph<5> _5; -extern __ph<6> _6; -extern __ph<7> _7; -extern __ph<8> _8; -extern __ph<9> _9; -extern __ph<10> _10; - -} // placeholders - -template<int _Np> -struct __is_placeholder<placeholders::__ph<_Np> > - : public integral_constant<int, _Np> {}; - -template <class _Tp, class _Uj> -inline _LIBCPP_INLINE_VISIBILITY -_Tp& -__mu(reference_wrapper<_Tp> __t, _Uj&) -{ - return __t.get(); -} -/* -template <bool _IsBindExpr, class _Ti, class ..._Uj> -struct __mu_return1 {}; - -template <class _Ti, class ..._Uj> -struct __mu_return1<true, _Ti, _Uj...> -{ - typedef typename result_of<_Ti(_Uj...)>::type type; -}; - -template <class _Ti, class ..._Uj, size_t ..._Indx> -inline _LIBCPP_INLINE_VISIBILITY -typename __mu_return1<true, _Ti, _Uj...>::type -__mu_expand(_Ti& __ti, tuple<_Uj...>&& __uj, __tuple_indices<_Indx...>) -{ - __ti(_VSTD::forward<typename tuple_element<_Indx, _Uj>::type>(_VSTD::get<_Indx>(__uj))...); -} - -template <class _Ti, class ..._Uj> -inline _LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_bind_expression<_Ti>::value, - typename __mu_return1<is_bind_expression<_Ti>::value, _Ti, _Uj...>::type ->::type -__mu(_Ti& __ti, tuple<_Uj...>& __uj) -{ - typedef typename __make_tuple_indices<sizeof...(_Uj)>::type __indices; - return __mu_expand(__ti, __uj, __indices()); -} - -template <bool IsPh, class _Ti, class _Uj> -struct __mu_return2 {}; - -template <class _Ti, class _Uj> -struct __mu_return2<true, _Ti, _Uj> -{ - typedef typename tuple_element<is_placeholder<_Ti>::value - 1, _Uj>::type type; -}; - -template <class _Ti, class _Uj> -inline _LIBCPP_INLINE_VISIBILITY -typename enable_if -< - 0 < is_placeholder<_Ti>::value, - typename __mu_return2<0 < is_placeholder<_Ti>::value, _Ti, _Uj>::type ->::type -__mu(_Ti&, _Uj& __uj) -{ - const size_t _Indx = is_placeholder<_Ti>::value - 1; - // compiler bug workaround - typename tuple_element<_Indx, _Uj>::type __t = _VSTD::get<_Indx>(__uj); - return __t; -// return _VSTD::forward<typename tuple_element<_Indx, _Uj>::type>(_VSTD::get<_Indx>(__uj)); -} - -template <class _Ti, class _Uj> -inline _LIBCPP_INLINE_VISIBILITY -typename enable_if -< - !is_bind_expression<_Ti>::value && - is_placeholder<_Ti>::value == 0 && - !__is_reference_wrapper<_Ti>::value, - _Ti& ->::type -__mu(_Ti& __ti, _Uj& __uj) -{ - return __ti; -} - -template <class _Ti, bool IsBindEx, bool IsPh, class _TupleUj> -struct ____mu_return; - -template <class _Ti, class ..._Uj> -struct ____mu_return<_Ti, true, false, tuple<_Uj...> > -{ - typedef typename result_of<_Ti(_Uj...)>::type type; -}; - -template <class _Ti, class _TupleUj> -struct ____mu_return<_Ti, false, true, _TupleUj> -{ - typedef typename tuple_element<is_placeholder<_Ti>::value - 1, - _TupleUj>::type&& type; -}; - -template <class _Ti, class _TupleUj> -struct ____mu_return<_Ti, false, false, _TupleUj> -{ - typedef _Ti& type; -}; - -template <class _Ti, class _TupleUj> -struct __mu_return - : public ____mu_return<_Ti, - is_bind_expression<_Ti>::value, - 0 < is_placeholder<_Ti>::value, - _TupleUj> -{ -}; - -template <class _Ti, class _TupleUj> -struct __mu_return<reference_wrapper<_Ti>, _TupleUj> -{ - typedef _Ti& type; -}; - -template <class _Fp, class _BoundArgs, class _TupleUj> -struct __bind_return; - -template <class _Fp, class ..._BoundArgs, class _TupleUj> -struct __bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj> -{ - typedef typename __ref_return - < - _Fp&, - typename __mu_return - < - _BoundArgs, - _TupleUj - >::type... - >::type type; -}; - -template <class _Fp, class ..._BoundArgs, class _TupleUj> -struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj> -{ - typedef typename __ref_return - < - _Fp&, - typename __mu_return - < - const _BoundArgs, - _TupleUj - >::type... - >::type type; -}; - -template <class _Fp, class _BoundArgs, size_t ..._Indx, class _Args> -inline _LIBCPP_INLINE_VISIBILITY -typename __bind_return<_Fp, _BoundArgs, _Args>::type -__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, - _Args&& __args) -{ - return __invoke(__f, __mu(_VSTD::get<_Indx>(__bound_args), __args)...); -} - -template<class _Fp, class ..._BoundArgs> -class __bind -{ - _Fp __f_; - tuple<_BoundArgs...> __bound_args_; - - typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices; -public: - template <class _Gp, class ..._BA> - explicit __bind(_Gp&& __f, _BA&& ...__bound_args) - : __f_(_VSTD::forward<_Gp>(__f)), - __bound_args_(_VSTD::forward<_BA>(__bound_args)...) {} - - template <class ..._Args> - typename __bind_return<_Fp, tuple<_BoundArgs...>, tuple<_Args&&...> >::type - operator()(_Args&& ...__args) - { - // compiler bug workaround - return __apply_functor(__f_, __bound_args_, __indices(), - tuple<_Args&&...>(__args...)); - } - - template <class ..._Args> - typename __bind_return<_Fp, tuple<_BoundArgs...>, tuple<_Args&&...> >::type - operator()(_Args&& ...__args) const - { - return __apply_functor(__f_, __bound_args_, __indices(), - tuple<_Args&&...>(__args...)); - } -}; - -template<class _Fp, class ..._BoundArgs> -struct __is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {}; - -template<class _Rp, class _Fp, class ..._BoundArgs> -class __bind_r - : public __bind<_Fp, _BoundArgs...> -{ - typedef __bind<_Fp, _BoundArgs...> base; -public: - typedef _Rp result_type; - - template <class _Gp, class ..._BA> - explicit __bind_r(_Gp&& __f, _BA&& ...__bound_args) - : base(_VSTD::forward<_Gp>(__f), - _VSTD::forward<_BA>(__bound_args)...) {} - - template <class ..._Args> - result_type - operator()(_Args&& ...__args) - { - typedef __invoke_void_return_wrapper<_Rp> _Invoker; - return _Invoker::__call(static_cast<base&>(*this), _VSTD::forward<_Args>(__args)...); - } - - template <class ..._Args> - result_type - operator()(_Args&& ...__args) const - { - typedef __invoke_void_return_wrapper<_Rp> _Invoker; - return _Invoker::__call(static_cast<base const&>(*this), _VSTD::forward<_Args>(__args)...); - } -}; - -template<class _Rp, class _Fp, class ..._BoundArgs> -struct __is_bind_expression<__bind_r<_Rp, _Fp, _BoundArgs...> > : public true_type {}; - -template<class _Fp, class ..._BoundArgs> -inline _LIBCPP_INLINE_VISIBILITY -__bind<typename decay<_Fp>::type, typename decay<_BoundArgs>::type...> -bind(_Fp&& __f, _BoundArgs&&... __bound_args) -{ - typedef __bind<typename decay<_Fp>::type, typename decay<_BoundArgs>::type...> type; - return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...); -} - -template<class _Rp, class _Fp, class ..._BoundArgs> -inline _LIBCPP_INLINE_VISIBILITY -__bind_r<_Rp, typename decay<_Fp>::type, typename decay<_BoundArgs>::type...> -bind(_Fp&& __f, _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)...); -} -*/ - #endif // _LIBCPP_FUNCTIONAL_03 Modified: head/contrib/libc++/include/__functional_base ============================================================================== --- head/contrib/libc++/include/__functional_base Thu May 26 18:52:26 2016 (r300769) +++ head/contrib/libc++/include/__functional_base Thu May 26 18:52:49 2016 (r300770) @@ -77,62 +77,6 @@ struct _LIBCPP_TYPE_VIS_ONLY less<void> }; #endif -// addressof - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -_Tp* -addressof(_Tp& __x) _NOEXCEPT -{ - return (_Tp*)&reinterpret_cast<const volatile char&>(__x); -} - -#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF) -// Objective-C++ Automatic Reference Counting uses qualified pointers -// that require special addressof() signatures. When -// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler -// itself is providing these definitions. Otherwise, we provide them. -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -__strong _Tp* -addressof(__strong _Tp& __x) _NOEXCEPT -{ - return &__x; -} - -#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -__weak _Tp* -addressof(__weak _Tp& __x) _NOEXCEPT -{ - return &__x; -} -#endif - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -__autoreleasing _Tp* -addressof(__autoreleasing _Tp& __x) _NOEXCEPT -{ - return &__x; -} - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -__unsafe_unretained _Tp* -addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT -{ - return &__x; -} -#endif - -#ifdef _LIBCPP_HAS_NO_VARIADICS - -#include <__functional_base_03> - -#else // _LIBCPP_HAS_NO_VARIADICS - // __weak_result_type template <class _Tp> @@ -314,6 +258,8 @@ struct __weak_result_type<_Rp (_Cp::*)(_ { }; + +#ifndef _LIBCPP_HAS_NO_VARIADICS // 3 or more arguments *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605261852.u4QIqn5w073953>