[libcxx-commits] [libcxx] dbe60ca - [libc++] Remove std::function in C++03
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Oct 19 02:08:41 PDT 2022
Author: Nikolas Klauser
Date: 2022-10-19T11:08:35+02:00
New Revision: dbe60caa922d5e4a30e4f335f33b2628dd82e3e7
URL: https://github.com/llvm/llvm-project/commit/dbe60caa922d5e4a30e4f335f33b2628dd82e3e7
DIFF: https://github.com/llvm/llvm-project/commit/dbe60caa922d5e4a30e4f335f33b2628dd82e3e7.diff
LOG: [libc++] Remove std::function in C++03
We've said that we'll remove `std::function` from C++03 in LLVM 16, so we might as well do it now before we forget.
Reviewed By: ldionne, #libc, Mordante
Spies: jloser, Mordante, libcxx-commits
Differential Revision: https://reviews.llvm.org/D135868
Added:
Modified:
libcxx/docs/ReleaseNotes.rst
libcxx/include/__functional/function.h
libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/move_reentrant.pass.cpp
libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign_reentrant.pass.cpp
libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.badcall/bad_function_call.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.badcall/func.wrap.badcall.const/bad_function_call_ctor.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/addressof.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.cap/operator_bool.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_incomplete.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_nullptr.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/default.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/assign_F_alloc.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.nullptr/operator_==.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target_type.pass.cpp
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp
Removed:
libcxx/test/libcxx/utilities/function.objects/func.wrap/depr_in_cxx03.verify.cpp
################################################################################
diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst
index 7befa46d199ee..8cc3d03a45571 100644
--- a/libcxx/docs/ReleaseNotes.rst
+++ b/libcxx/docs/ReleaseNotes.rst
@@ -87,6 +87,9 @@ Deprecations and Removals
the C++23 paper that makes these functions ``constexpr``, therefore the
extension has been removed.
+- The ``_LIBCPP_ENABLE_CXX03_FUNCTION`` macro that allowed re-enabling the now-deprecated C++03 implementation of
+ ``std::function`` has been removed. Users who need to use ``std::function`` should switch to C++11 and above.
+
Upcoming Deprecations and Removals
----------------------------------
diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h
index be349e2fbb2db..44e33a5a3a624 100644
--- a/libcxx/include/__functional/function.h
+++ b/libcxx/include/__functional/function.h
@@ -37,6 +37,8 @@
# pragma GCC system_header
#endif
+#ifndef _LIBCPP_CXX03_LANG
+
_LIBCPP_BEGIN_NAMESPACE_STD
// bad_function_call
@@ -72,14 +74,7 @@ void __throw_bad_function_call()
#endif
}
-#if defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) && __has_attribute(deprecated)
-# define _LIBCPP_DEPRECATED_CXX03_FUNCTION \
- __attribute__((deprecated("Using std::function in C++03 is not supported anymore. Please upgrade to C++11 or later, or use a
diff erent type")))
-#else
-# define _LIBCPP_DEPRECATED_CXX03_FUNCTION /* nothing */
-#endif
-
-template<class _Fp> class _LIBCPP_DEPRECATED_CXX03_FUNCTION _LIBCPP_TEMPLATE_VIS function; // undefined
+template<class _Fp> class _LIBCPP_TEMPLATE_VIS function; // undefined
namespace __function
{
@@ -130,8 +125,6 @@ bool __not_null(_Rp (^__p)(_Args...)) { return __p; }
} // namespace __function
-#ifndef _LIBCPP_CXX03_LANG
-
namespace __function {
// __alloc_func holds a functor and an allocator.
@@ -1250,1574 +1243,8 @@ void
swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT
{return __x.swap(__y);}
-#elif defined(_LIBCPP_ENABLE_CXX03_FUNCTION)
-
-namespace __function {
-
-template<class _Fp> class __base;
-
-template<class _Rp>
-class __base<_Rp()>
-{
- __base(const __base&);
- __base& operator=(const __base&);
-public:
- __base() {}
- virtual ~__base() {}
- virtual __base* __clone() const = 0;
- virtual void __clone(__base*) const = 0;
- virtual void destroy() = 0;
- virtual void destroy_deallocate() = 0;
- virtual _Rp operator()() = 0;
-#ifndef _LIBCPP_NO_RTTI
- virtual const void* target(const type_info&) const = 0;
- virtual const std::type_info& target_type() const = 0;
-#endif // _LIBCPP_NO_RTTI
-};
-
-template<class _Rp, class _A0>
-class __base<_Rp(_A0)>
-{
- __base(const __base&);
- __base& operator=(const __base&);
-public:
- __base() {}
- virtual ~__base() {}
- virtual __base* __clone() const = 0;
- virtual void __clone(__base*) const = 0;
- virtual void destroy() = 0;
- virtual void destroy_deallocate() = 0;
- virtual _Rp operator()(_A0) = 0;
-#ifndef _LIBCPP_NO_RTTI
- virtual const void* target(const type_info&) const = 0;
- virtual const std::type_info& target_type() const = 0;
-#endif // _LIBCPP_NO_RTTI
-};
-
-template<class _Rp, class _A0, class _A1>
-class __base<_Rp(_A0, _A1)>
-{
- __base(const __base&);
- __base& operator=(const __base&);
-public:
- __base() {}
- virtual ~__base() {}
- virtual __base* __clone() const = 0;
- virtual void __clone(__base*) const = 0;
- virtual void destroy() = 0;
- virtual void destroy_deallocate() = 0;
- virtual _Rp operator()(_A0, _A1) = 0;
-#ifndef _LIBCPP_NO_RTTI
- virtual const void* target(const type_info&) const = 0;
- virtual const std::type_info& target_type() const = 0;
-#endif // _LIBCPP_NO_RTTI
-};
-
-template<class _Rp, class _A0, class _A1, class _A2>
-class __base<_Rp(_A0, _A1, _A2)>
-{
- __base(const __base&);
- __base& operator=(const __base&);
-public:
- __base() {}
- virtual ~__base() {}
- virtual __base* __clone() const = 0;
- virtual void __clone(__base*) const = 0;
- virtual void destroy() = 0;
- virtual void destroy_deallocate() = 0;
- virtual _Rp operator()(_A0, _A1, _A2) = 0;
-#ifndef _LIBCPP_NO_RTTI
- virtual const void* target(const type_info&) const = 0;
- virtual const std::type_info& target_type() const = 0;
-#endif // _LIBCPP_NO_RTTI
-};
-
-template<class _FD, class _Alloc, class _FB> class __func;
-
-template<class _Fp, class _Alloc, class _Rp>
-class __func<_Fp, _Alloc, _Rp()>
- : public __base<_Rp()>
-{
- __compressed_pair<_Fp, _Alloc> __f_;
-public:
- explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {}
- explicit __func(_Fp __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
- virtual __base<_Rp()>* __clone() const;
- virtual void __clone(__base<_Rp()>*) const;
- virtual void destroy();
- virtual void destroy_deallocate();
- virtual _Rp operator()();
-#ifndef _LIBCPP_NO_RTTI
- virtual const void* target(const type_info&) const;
- virtual const std::type_info& target_type() const;
-#endif // _LIBCPP_NO_RTTI
-};
-
-template<class _Fp, class _Alloc, class _Rp>
-__base<_Rp()>*
-__func<_Fp, _Alloc, _Rp()>::__clone() const
-{
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __func> _Ap;
- _Ap __a(__f_.second());
- typedef __allocator_destructor<_Ap> _Dp;
- unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a));
- return __hold.release();
-}
-
-template<class _Fp, class _Alloc, class _Rp>
-void
-__func<_Fp, _Alloc, _Rp()>::__clone(__base<_Rp()>* __p) const
-{
- ::new ((void*)__p) __func(__f_.first(), __f_.second());
-}
-
-template<class _Fp, class _Alloc, class _Rp>
-void
-__func<_Fp, _Alloc, _Rp()>::destroy()
-{
- __f_.~__compressed_pair<_Fp, _Alloc>();
-}
-
-template<class _Fp, class _Alloc, class _Rp>
-void
-__func<_Fp, _Alloc, _Rp()>::destroy_deallocate()
-{
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __func> _Ap;
- _Ap __a(__f_.second());
- __f_.~__compressed_pair<_Fp, _Alloc>();
- __a.deallocate(this, 1);
-}
-
-template<class _Fp, class _Alloc, class _Rp>
-_Rp
-__func<_Fp, _Alloc, _Rp()>::operator()()
-{
- typedef __invoke_void_return_wrapper<_Rp> _Invoker;
- return _Invoker::__call(__f_.first());
-}
-
-#ifndef _LIBCPP_NO_RTTI
-
-template<class _Fp, class _Alloc, class _Rp>
-const void*
-__func<_Fp, _Alloc, _Rp()>::target(const type_info& __ti) const
-{
- if (__ti == typeid(_Fp))
- return _VSTD::addressof(__f_.first());
- return (const void*)0;
-}
-
-template<class _Fp, class _Alloc, class _Rp>
-const std::type_info&
-__func<_Fp, _Alloc, _Rp()>::target_type() const
-{
- return typeid(_Fp);
-}
-
-#endif // _LIBCPP_NO_RTTI
-
-template<class _Fp, class _Alloc, class _Rp, class _A0>
-class __func<_Fp, _Alloc, _Rp(_A0)>
- : public __base<_Rp(_A0)>
-{
- __compressed_pair<_Fp, _Alloc> __f_;
-public:
- _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {}
- _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
- : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
- virtual __base<_Rp(_A0)>* __clone() const;
- virtual void __clone(__base<_Rp(_A0)>*) const;
- virtual void destroy();
- virtual void destroy_deallocate();
- virtual _Rp operator()(_A0);
-#ifndef _LIBCPP_NO_RTTI
- virtual const void* target(const type_info&) const;
- virtual const std::type_info& target_type() const;
-#endif // _LIBCPP_NO_RTTI
-};
-
-template<class _Fp, class _Alloc, class _Rp, class _A0>
-__base<_Rp(_A0)>*
-__func<_Fp, _Alloc, _Rp(_A0)>::__clone() const
-{
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __func> _Ap;
- _Ap __a(__f_.second());
- typedef __allocator_destructor<_Ap> _Dp;
- unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a));
- return __hold.release();
-}
-
-template<class _Fp, class _Alloc, class _Rp, class _A0>
-void
-__func<_Fp, _Alloc, _Rp(_A0)>::__clone(__base<_Rp(_A0)>* __p) const
-{
- ::new ((void*)__p) __func(__f_.first(), __f_.second());
-}
-
-template<class _Fp, class _Alloc, class _Rp, class _A0>
-void
-__func<_Fp, _Alloc, _Rp(_A0)>::destroy()
-{
- __f_.~__compressed_pair<_Fp, _Alloc>();
-}
-
-template<class _Fp, class _Alloc, class _Rp, class _A0>
-void
-__func<_Fp, _Alloc, _Rp(_A0)>::destroy_deallocate()
-{
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __func> _Ap;
- _Ap __a(__f_.second());
- __f_.~__compressed_pair<_Fp, _Alloc>();
- __a.deallocate(this, 1);
-}
-
-template<class _Fp, class _Alloc, class _Rp, class _A0>
-_Rp
-__func<_Fp, _Alloc, _Rp(_A0)>::operator()(_A0 __a0)
-{
- typedef __invoke_void_return_wrapper<_Rp> _Invoker;
- return _Invoker::__call(__f_.first(), __a0);
-}
-
-#ifndef _LIBCPP_NO_RTTI
-
-template<class _Fp, class _Alloc, class _Rp, class _A0>
-const void*
-__func<_Fp, _Alloc, _Rp(_A0)>::target(const type_info& __ti) const
-{
- if (__ti == typeid(_Fp))
- return &__f_.first();
- return (const void*)0;
-}
-
-template<class _Fp, class _Alloc, class _Rp, class _A0>
-const std::type_info&
-__func<_Fp, _Alloc, _Rp(_A0)>::target_type() const
-{
- return typeid(_Fp);
-}
-
-#endif // _LIBCPP_NO_RTTI
-
-template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
-class __func<_Fp, _Alloc, _Rp(_A0, _A1)>
- : public __base<_Rp(_A0, _A1)>
-{
- __compressed_pair<_Fp, _Alloc> __f_;
-public:
- _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {}
- _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
- : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
- virtual __base<_Rp(_A0, _A1)>* __clone() const;
- virtual void __clone(__base<_Rp(_A0, _A1)>*) const;
- virtual void destroy();
- virtual void destroy_deallocate();
- virtual _Rp operator()(_A0, _A1);
-#ifndef _LIBCPP_NO_RTTI
- virtual const void* target(const type_info&) const;
- virtual const std::type_info& target_type() const;
-#endif // _LIBCPP_NO_RTTI
-};
-
-template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
-__base<_Rp(_A0, _A1)>*
-__func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone() const
-{
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __func> _Ap;
- _Ap __a(__f_.second());
- typedef __allocator_destructor<_Ap> _Dp;
- unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a));
- return __hold.release();
-}
-
-template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
-void
-__func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone(__base<_Rp(_A0, _A1)>* __p) const
-{
- ::new ((void*)__p) __func(__f_.first(), __f_.second());
-}
-
-template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
-void
-__func<_Fp, _Alloc, _Rp(_A0, _A1)>::destroy()
-{
- __f_.~__compressed_pair<_Fp, _Alloc>();
-}
-
-template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
-void
-__func<_Fp, _Alloc, _Rp(_A0, _A1)>::destroy_deallocate()
-{
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __func> _Ap;
- _Ap __a(__f_.second());
- __f_.~__compressed_pair<_Fp, _Alloc>();
- __a.deallocate(this, 1);
-}
-
-template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
-_Rp
-__func<_Fp, _Alloc, _Rp(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1)
-{
- typedef __invoke_void_return_wrapper<_Rp> _Invoker;
- return _Invoker::__call(__f_.first(), __a0, __a1);
-}
-
-#ifndef _LIBCPP_NO_RTTI
-
-template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
-const void*
-__func<_Fp, _Alloc, _Rp(_A0, _A1)>::target(const type_info& __ti) const
-{
- if (__ti == typeid(_Fp))
- return &__f_.first();
- return (const void*)0;
-}
-
-template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
-const std::type_info&
-__func<_Fp, _Alloc, _Rp(_A0, _A1)>::target_type() const
-{
- return typeid(_Fp);
-}
-
-#endif // _LIBCPP_NO_RTTI
-
-template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
-class __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>
- : public __base<_Rp(_A0, _A1, _A2)>
-{
- __compressed_pair<_Fp, _Alloc> __f_;
-public:
- _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {}
- _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
- : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
- virtual __base<_Rp(_A0, _A1, _A2)>* __clone() const;
- virtual void __clone(__base<_Rp(_A0, _A1, _A2)>*) const;
- virtual void destroy();
- virtual void destroy_deallocate();
- virtual _Rp operator()(_A0, _A1, _A2);
-#ifndef _LIBCPP_NO_RTTI
- virtual const void* target(const type_info&) const;
- virtual const std::type_info& target_type() const;
-#endif // _LIBCPP_NO_RTTI
-};
-
-template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
-__base<_Rp(_A0, _A1, _A2)>*
-__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone() const
-{
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __func> _Ap;
- _Ap __a(__f_.second());
- typedef __allocator_destructor<_Ap> _Dp;
- unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a));
- return __hold.release();
-}
-
-template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
-void
-__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone(__base<_Rp(_A0, _A1, _A2)>* __p) const
-{
- ::new ((void*)__p) __func(__f_.first(), __f_.second());
-}
-
-template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
-void
-__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::destroy()
-{
- __f_.~__compressed_pair<_Fp, _Alloc>();
-}
-
-template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
-void
-__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::destroy_deallocate()
-{
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __func> _Ap;
- _Ap __a(__f_.second());
- __f_.~__compressed_pair<_Fp, _Alloc>();
- __a.deallocate(this, 1);
-}
-
-template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
-_Rp
-__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2)
-{
- typedef __invoke_void_return_wrapper<_Rp> _Invoker;
- return _Invoker::__call(__f_.first(), __a0, __a1, __a2);
-}
-
-#ifndef _LIBCPP_NO_RTTI
-
-template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
-const void*
-__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::target(const type_info& __ti) const
-{
- if (__ti == typeid(_Fp))
- return &__f_.first();
- return (const void*)0;
-}
-
-template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
-const std::type_info&
-__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::target_type() const
-{
- return typeid(_Fp);
-}
-
-#endif // _LIBCPP_NO_RTTI
-
-} // namespace __function
-
-template<class _Rp>
-class _LIBCPP_TEMPLATE_VIS function<_Rp()>
-{
- typedef __function::__base<_Rp()> __base;
- aligned_storage<3*sizeof(void*)>::type __buf_;
- __base* __f_;
-
-public:
- typedef _Rp result_type;
-
- // 20.7.16.2.1, construct/copy/destroy:
- _LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
- _LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
- function(const function&);
- template<class _Fp>
- function(_Fp,
- typename enable_if<!is_integral<_Fp>::value>::type* = 0);
-
- template<class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- function(allocator_arg_t, const _Alloc&) : __f_(0) {}
- template<class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
- template<class _Alloc>
- function(allocator_arg_t, const _Alloc&, const function&);
- template<class _Fp, class _Alloc>
- function(allocator_arg_t, const _Alloc& __a, _Fp __f,
- typename enable_if<!is_integral<_Fp>::value>::type* = 0);
-
- function& operator=(const function&);
- function& operator=(nullptr_t);
- template<class _Fp>
- typename enable_if
- <
- !is_integral<_Fp>::value,
- function&
- >::type
- operator=(_Fp);
-
- ~function();
-
- // 20.7.16.2.2, function modifiers:
- void swap(function&);
- template<class _Fp, class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- void assign(_Fp __f, const _Alloc& __a)
- {function(allocator_arg, __a, __f).swap(*this);}
-
- // 20.7.16.2.3, function capacity:
- _LIBCPP_INLINE_VISIBILITY explicit operator bool() const {return __f_;}
-
- template<class _R2>
- bool operator==(const function<_R2()>&) const = delete;
- template<class _R2>
- bool operator!=(const function<_R2()>&) const = delete;
-
- // 20.7.16.2.4, function invocation:
- _Rp operator()() const;
-
-#ifndef _LIBCPP_NO_RTTI
- // 20.7.16.2.5, function target access:
- const std::type_info& target_type() const;
- template <typename _Tp> _Tp* target();
- template <typename _Tp> const _Tp* target() const;
-#endif // _LIBCPP_NO_RTTI
-};
-
-template<class _Rp>
-function<_Rp()>::function(const function& __f)
-{
- if (__f.__f_ == 0)
- __f_ = 0;
- else if (__f.__f_ == (const __base*)&__f.__buf_)
- {
- __f_ = (__base*)&__buf_;
- __f.__f_->__clone(__f_);
- }
- else
- __f_ = __f.__f_->__clone();
-}
-
-template<class _Rp>
-template<class _Alloc>
-function<_Rp()>::function(allocator_arg_t, const _Alloc&, const function& __f)
-{
- if (__f.__f_ == 0)
- __f_ = 0;
- else if (__f.__f_ == (const __base*)&__f.__buf_)
- {
- __f_ = (__base*)&__buf_;
- __f.__f_->__clone(__f_);
- }
- else
- __f_ = __f.__f_->__clone();
-}
-
-template<class _Rp>
-template <class _Fp>
-function<_Rp()>::function(_Fp __f,
- typename enable_if<!is_integral<_Fp>::value>::type*)
- : __f_(0)
-{
- if (__function::__not_null(__f))
- {
- typedef __function::__func<_Fp, allocator<_Fp>, _Rp()> _FF;
- if (sizeof(_FF) <= sizeof(__buf_))
- {
- __f_ = (__base*)&__buf_;
- ::new ((void*)__f_) _FF(__f);
- }
- else
- {
- typedef allocator<_FF> _Ap;
- _Ap __a;
- typedef __allocator_destructor<_Ap> _Dp;
- unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a));
- __f_ = __hold.release();
- }
- }
-}
-
-template<class _Rp>
-template <class _Fp, class _Alloc>
-function<_Rp()>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
- typename enable_if<!is_integral<_Fp>::value>::type*)
- : __f_(0)
-{
- typedef allocator_traits<_Alloc> __alloc_traits;
- if (__function::__not_null(__f))
- {
- typedef __function::__func<_Fp, _Alloc, _Rp()> _FF;
- if (sizeof(_FF) <= sizeof(__buf_))
- {
- __f_ = (__base*)&__buf_;
- ::new ((void*)__f_) _FF(__f, __a0);
- }
- else
- {
- typedef __rebind_alloc<__alloc_traits, _FF> _Ap;
- _Ap __a(__a0);
- typedef __allocator_destructor<_Ap> _Dp;
- unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) _FF(__f, _Alloc(__a));
- __f_ = __hold.release();
- }
- }
-}
-
-template<class _Rp>
-function<_Rp()>&
-function<_Rp()>::operator=(const function& __f)
-{
- if (__f)
- function(__f).swap(*this);
- else
- *this = nullptr;
- return *this;
-}
-
-template<class _Rp>
-function<_Rp()>&
-function<_Rp()>::operator=(nullptr_t)
-{
- __base* __t = __f_;
- __f_ = 0;
- if (__t == (__base*)&__buf_)
- __t->destroy();
- else if (__t)
- __t->destroy_deallocate();
- return *this;
-}
-
-template<class _Rp>
-template <class _Fp>
-typename enable_if
-<
- !is_integral<_Fp>::value,
- function<_Rp()>&
->::type
-function<_Rp()>::operator=(_Fp __f)
-{
- function(_VSTD::move(__f)).swap(*this);
- return *this;
-}
-
-template<class _Rp>
-function<_Rp()>::~function()
-{
- if (__f_ == (__base*)&__buf_)
- __f_->destroy();
- else if (__f_)
- __f_->destroy_deallocate();
-}
-
-template<class _Rp>
-void
-function<_Rp()>::swap(function& __f)
-{
- if (_VSTD::addressof(__f) == this)
- return;
- if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
- {
- typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
- __base* __t = (__base*)&__tempbuf;
- __f_->__clone(__t);
- __f_->destroy();
- __f_ = 0;
- __f.__f_->__clone((__base*)&__buf_);
- __f.__f_->destroy();
- __f.__f_ = 0;
- __f_ = (__base*)&__buf_;
- __t->__clone((__base*)&__f.__buf_);
- __t->destroy();
- __f.__f_ = (__base*)&__f.__buf_;
- }
- else if (__f_ == (__base*)&__buf_)
- {
- __f_->__clone((__base*)&__f.__buf_);
- __f_->destroy();
- __f_ = __f.__f_;
- __f.__f_ = (__base*)&__f.__buf_;
- }
- else if (__f.__f_ == (__base*)&__f.__buf_)
- {
- __f.__f_->__clone((__base*)&__buf_);
- __f.__f_->destroy();
- __f.__f_ = __f_;
- __f_ = (__base*)&__buf_;
- }
- else
- _VSTD::swap(__f_, __f.__f_);
-}
-
-template<class _Rp>
-_Rp
-function<_Rp()>::operator()() const
-{
- if (__f_ == 0)
- __throw_bad_function_call();
- return (*__f_)();
-}
-
-#ifndef _LIBCPP_NO_RTTI
-
-template<class _Rp>
-const std::type_info&
-function<_Rp()>::target_type() const
-{
- if (__f_ == 0)
- return typeid(void);
- return __f_->target_type();
-}
-
-template<class _Rp>
-template <typename _Tp>
-_Tp*
-function<_Rp()>::target()
-{
- if (__f_ == 0)
- return (_Tp*)0;
- return (_Tp*) const_cast<void *>(__f_->target(typeid(_Tp)));
-}
-
-template<class _Rp>
-template <typename _Tp>
-const _Tp*
-function<_Rp()>::target() const
-{
- if (__f_ == 0)
- return (const _Tp*)0;
- return (const _Tp*)__f_->target(typeid(_Tp));
-}
-
-#endif // _LIBCPP_NO_RTTI
-
-template<class _Rp, class _A0>
-class _LIBCPP_TEMPLATE_VIS function<_Rp(_A0)>
- : public unary_function<_A0, _Rp>
-{
- typedef __function::__base<_Rp(_A0)> __base;
- aligned_storage<3*sizeof(void*)>::type __buf_;
- __base* __f_;
-
-public:
- typedef _Rp result_type;
-
- // 20.7.16.2.1, construct/copy/destroy:
- _LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
- _LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
- function(const function&);
- template<class _Fp>
- function(_Fp,
- typename enable_if<!is_integral<_Fp>::value>::type* = 0);
-
- template<class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- function(allocator_arg_t, const _Alloc&) : __f_(0) {}
- template<class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
- template<class _Alloc>
- function(allocator_arg_t, const _Alloc&, const function&);
- template<class _Fp, class _Alloc>
- function(allocator_arg_t, const _Alloc& __a, _Fp __f,
- typename enable_if<!is_integral<_Fp>::value>::type* = 0);
-
- function& operator=(const function&);
- function& operator=(nullptr_t);
- template<class _Fp>
- typename enable_if
- <
- !is_integral<_Fp>::value,
- function&
- >::type
- operator=(_Fp);
-
- ~function();
-
- // 20.7.16.2.2, function modifiers:
- void swap(function&);
- template<class _Fp, class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- void assign(_Fp __f, const _Alloc& __a)
- {function(allocator_arg, __a, __f).swap(*this);}
-
- // 20.7.16.2.3, function capacity:
- _LIBCPP_INLINE_VISIBILITY explicit operator bool() const {return __f_;}
-
- template<class _R2, class _B0>
- bool operator==(const function<_R2(_B0)>&) const = delete;
- template<class _R2, class _B0>
- bool operator!=(const function<_R2(_B0)>&) const = delete;
-
- // 20.7.16.2.4, function invocation:
- _Rp operator()(_A0) const;
-
-#ifndef _LIBCPP_NO_RTTI
- // 20.7.16.2.5, function target access:
- const std::type_info& target_type() const;
- template <typename _Tp> _Tp* target();
- template <typename _Tp> const _Tp* target() const;
-#endif // _LIBCPP_NO_RTTI
-};
-
-template<class _Rp, class _A0>
-function<_Rp(_A0)>::function(const function& __f)
-{
- if (__f.__f_ == 0)
- __f_ = 0;
- else if (__f.__f_ == (const __base*)&__f.__buf_)
- {
- __f_ = (__base*)&__buf_;
- __f.__f_->__clone(__f_);
- }
- else
- __f_ = __f.__f_->__clone();
-}
-
-template<class _Rp, class _A0>
-template<class _Alloc>
-function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc&, const function& __f)
-{
- if (__f.__f_ == 0)
- __f_ = 0;
- else if (__f.__f_ == (const __base*)&__f.__buf_)
- {
- __f_ = (__base*)&__buf_;
- __f.__f_->__clone(__f_);
- }
- else
- __f_ = __f.__f_->__clone();
-}
-
-template<class _Rp, class _A0>
-template <class _Fp>
-function<_Rp(_A0)>::function(_Fp __f,
- typename enable_if<!is_integral<_Fp>::value>::type*)
- : __f_(0)
-{
- if (__function::__not_null(__f))
- {
- typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0)> _FF;
- if (sizeof(_FF) <= sizeof(__buf_))
- {
- __f_ = (__base*)&__buf_;
- ::new ((void*)__f_) _FF(__f);
- }
- else
- {
- typedef allocator<_FF> _Ap;
- _Ap __a;
- typedef __allocator_destructor<_Ap> _Dp;
- unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a));
- __f_ = __hold.release();
- }
- }
-}
-
-template<class _Rp, class _A0>
-template <class _Fp, class _Alloc>
-function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
- typename enable_if<!is_integral<_Fp>::value>::type*)
- : __f_(0)
-{
- typedef allocator_traits<_Alloc> __alloc_traits;
- if (__function::__not_null(__f))
- {
- typedef __function::__func<_Fp, _Alloc, _Rp(_A0)> _FF;
- if (sizeof(_FF) <= sizeof(__buf_))
- {
- __f_ = (__base*)&__buf_;
- ::new ((void*)__f_) _FF(__f, __a0);
- }
- else
- {
- typedef __rebind_alloc<__alloc_traits, _FF> _Ap;
- _Ap __a(__a0);
- typedef __allocator_destructor<_Ap> _Dp;
- unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) _FF(__f, _Alloc(__a));
- __f_ = __hold.release();
- }
- }
-}
-
-template<class _Rp, class _A0>
-function<_Rp(_A0)>&
-function<_Rp(_A0)>::operator=(const function& __f)
-{
- if (__f)
- function(__f).swap(*this);
- else
- *this = nullptr;
- return *this;
-}
-
-template<class _Rp, class _A0>
-function<_Rp(_A0)>&
-function<_Rp(_A0)>::operator=(nullptr_t)
-{
- __base* __t = __f_;
- __f_ = 0;
- if (__t == (__base*)&__buf_)
- __t->destroy();
- else if (__t)
- __t->destroy_deallocate();
- return *this;
-}
-
-template<class _Rp, class _A0>
-template <class _Fp>
-typename enable_if
-<
- !is_integral<_Fp>::value,
- function<_Rp(_A0)>&
->::type
-function<_Rp(_A0)>::operator=(_Fp __f)
-{
- function(_VSTD::move(__f)).swap(*this);
- return *this;
-}
-
-template<class _Rp, class _A0>
-function<_Rp(_A0)>::~function()
-{
- if (__f_ == (__base*)&__buf_)
- __f_->destroy();
- else if (__f_)
- __f_->destroy_deallocate();
-}
-
-template<class _Rp, class _A0>
-void
-function<_Rp(_A0)>::swap(function& __f)
-{
- if (_VSTD::addressof(__f) == this)
- return;
- if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
- {
- typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
- __base* __t = (__base*)&__tempbuf;
- __f_->__clone(__t);
- __f_->destroy();
- __f_ = 0;
- __f.__f_->__clone((__base*)&__buf_);
- __f.__f_->destroy();
- __f.__f_ = 0;
- __f_ = (__base*)&__buf_;
- __t->__clone((__base*)&__f.__buf_);
- __t->destroy();
- __f.__f_ = (__base*)&__f.__buf_;
- }
- else if (__f_ == (__base*)&__buf_)
- {
- __f_->__clone((__base*)&__f.__buf_);
- __f_->destroy();
- __f_ = __f.__f_;
- __f.__f_ = (__base*)&__f.__buf_;
- }
- else if (__f.__f_ == (__base*)&__f.__buf_)
- {
- __f.__f_->__clone((__base*)&__buf_);
- __f.__f_->destroy();
- __f.__f_ = __f_;
- __f_ = (__base*)&__buf_;
- }
- else
- _VSTD::swap(__f_, __f.__f_);
-}
-
-template<class _Rp, class _A0>
-_Rp
-function<_Rp(_A0)>::operator()(_A0 __a0) const
-{
- if (__f_ == 0)
- __throw_bad_function_call();
- return (*__f_)(__a0);
-}
-
-#ifndef _LIBCPP_NO_RTTI
-
-template<class _Rp, class _A0>
-const std::type_info&
-function<_Rp(_A0)>::target_type() const
-{
- if (__f_ == 0)
- return typeid(void);
- return __f_->target_type();
-}
-
-template<class _Rp, class _A0>
-template <typename _Tp>
-_Tp*
-function<_Rp(_A0)>::target()
-{
- if (__f_ == 0)
- return (_Tp*)0;
- return (_Tp*) const_cast<void *>(__f_->target(typeid(_Tp)));
-}
-
-template<class _Rp, class _A0>
-template <typename _Tp>
-const _Tp*
-function<_Rp(_A0)>::target() const
-{
- if (__f_ == 0)
- return (const _Tp*)0;
- return (const _Tp*)__f_->target(typeid(_Tp));
-}
-
-#endif // _LIBCPP_NO_RTTI
-
-template<class _Rp, class _A0, class _A1>
-class _LIBCPP_TEMPLATE_VIS function<_Rp(_A0, _A1)>
- : public binary_function<_A0, _A1, _Rp>
-{
- typedef __function::__base<_Rp(_A0, _A1)> __base;
- aligned_storage<3*sizeof(void*)>::type __buf_;
- __base* __f_;
-
-public:
- typedef _Rp result_type;
-
- // 20.7.16.2.1, construct/copy/destroy:
- _LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
- _LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
- function(const function&);
- template<class _Fp>
- function(_Fp,
- typename enable_if<!is_integral<_Fp>::value>::type* = 0);
-
- template<class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- function(allocator_arg_t, const _Alloc&) : __f_(0) {}
- template<class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
- template<class _Alloc>
- function(allocator_arg_t, const _Alloc&, const function&);
- template<class _Fp, class _Alloc>
- function(allocator_arg_t, const _Alloc& __a, _Fp __f,
- typename enable_if<!is_integral<_Fp>::value>::type* = 0);
-
- function& operator=(const function&);
- function& operator=(nullptr_t);
- template<class _Fp>
- typename enable_if
- <
- !is_integral<_Fp>::value,
- function&
- >::type
- operator=(_Fp);
-
- ~function();
-
- // 20.7.16.2.2, function modifiers:
- void swap(function&);
- template<class _Fp, class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- void assign(_Fp __f, const _Alloc& __a)
- {function(allocator_arg, __a, __f).swap(*this);}
-
- // 20.7.16.2.3, function capacity:
- _LIBCPP_INLINE_VISIBILITY explicit operator bool() const {return __f_;}
-
- template<class _R2, class _B0, class _B1>
- bool operator==(const function<_R2(_B0, _B1)>&) const = delete;
- template<class _R2, class _B0, class _B1>
- bool operator!=(const function<_R2(_B0, _B1)>&) const = delete;
-
- // 20.7.16.2.4, function invocation:
- _Rp operator()(_A0, _A1) const;
-
-#ifndef _LIBCPP_NO_RTTI
- // 20.7.16.2.5, function target access:
- const std::type_info& target_type() const;
- template <typename _Tp> _Tp* target();
- template <typename _Tp> const _Tp* target() const;
-#endif // _LIBCPP_NO_RTTI
-};
-
-template<class _Rp, class _A0, class _A1>
-function<_Rp(_A0, _A1)>::function(const function& __f)
-{
- if (__f.__f_ == 0)
- __f_ = 0;
- else if (__f.__f_ == (const __base*)&__f.__buf_)
- {
- __f_ = (__base*)&__buf_;
- __f.__f_->__clone(__f_);
- }
- else
- __f_ = __f.__f_->__clone();
-}
-
-template<class _Rp, class _A0, class _A1>
-template<class _Alloc>
-function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc&, const function& __f)
-{
- if (__f.__f_ == 0)
- __f_ = 0;
- else if (__f.__f_ == (const __base*)&__f.__buf_)
- {
- __f_ = (__base*)&__buf_;
- __f.__f_->__clone(__f_);
- }
- else
- __f_ = __f.__f_->__clone();
-}
-
-template<class _Rp, class _A0, class _A1>
-template <class _Fp>
-function<_Rp(_A0, _A1)>::function(_Fp __f,
- typename enable_if<!is_integral<_Fp>::value>::type*)
- : __f_(0)
-{
- if (__function::__not_null(__f))
- {
- typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1)> _FF;
- if (sizeof(_FF) <= sizeof(__buf_))
- {
- __f_ = (__base*)&__buf_;
- ::new ((void*)__f_) _FF(__f);
- }
- else
- {
- typedef allocator<_FF> _Ap;
- _Ap __a;
- typedef __allocator_destructor<_Ap> _Dp;
- unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a));
- __f_ = __hold.release();
- }
- }
-}
-
-template<class _Rp, class _A0, class _A1>
-template <class _Fp, class _Alloc>
-function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
- typename enable_if<!is_integral<_Fp>::value>::type*)
- : __f_(0)
-{
- typedef allocator_traits<_Alloc> __alloc_traits;
- if (__function::__not_null(__f))
- {
- typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1)> _FF;
- if (sizeof(_FF) <= sizeof(__buf_))
- {
- __f_ = (__base*)&__buf_;
- ::new ((void*)__f_) _FF(__f, __a0);
- }
- else
- {
- typedef __rebind_alloc<__alloc_traits, _FF> _Ap;
- _Ap __a(__a0);
- typedef __allocator_destructor<_Ap> _Dp;
- unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) _FF(__f, _Alloc(__a));
- __f_ = __hold.release();
- }
- }
-}
-
-template<class _Rp, class _A0, class _A1>
-function<_Rp(_A0, _A1)>&
-function<_Rp(_A0, _A1)>::operator=(const function& __f)
-{
- if (__f)
- function(__f).swap(*this);
- else
- *this = nullptr;
- return *this;
-}
-
-template<class _Rp, class _A0, class _A1>
-function<_Rp(_A0, _A1)>&
-function<_Rp(_A0, _A1)>::operator=(nullptr_t)
-{
- __base* __t = __f_;
- __f_ = 0;
- if (__t == (__base*)&__buf_)
- __t->destroy();
- else if (__t)
- __t->destroy_deallocate();
- return *this;
-}
-
-template<class _Rp, class _A0, class _A1>
-template <class _Fp>
-typename enable_if
-<
- !is_integral<_Fp>::value,
- function<_Rp(_A0, _A1)>&
->::type
-function<_Rp(_A0, _A1)>::operator=(_Fp __f)
-{
- function(_VSTD::move(__f)).swap(*this);
- return *this;
-}
-
-template<class _Rp, class _A0, class _A1>
-function<_Rp(_A0, _A1)>::~function()
-{
- if (__f_ == (__base*)&__buf_)
- __f_->destroy();
- else if (__f_)
- __f_->destroy_deallocate();
-}
-
-template<class _Rp, class _A0, class _A1>
-void
-function<_Rp(_A0, _A1)>::swap(function& __f)
-{
- if (_VSTD::addressof(__f) == this)
- return;
- if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
- {
- typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
- __base* __t = (__base*)&__tempbuf;
- __f_->__clone(__t);
- __f_->destroy();
- __f_ = 0;
- __f.__f_->__clone((__base*)&__buf_);
- __f.__f_->destroy();
- __f.__f_ = 0;
- __f_ = (__base*)&__buf_;
- __t->__clone((__base*)&__f.__buf_);
- __t->destroy();
- __f.__f_ = (__base*)&__f.__buf_;
- }
- else if (__f_ == (__base*)&__buf_)
- {
- __f_->__clone((__base*)&__f.__buf_);
- __f_->destroy();
- __f_ = __f.__f_;
- __f.__f_ = (__base*)&__f.__buf_;
- }
- else if (__f.__f_ == (__base*)&__f.__buf_)
- {
- __f.__f_->__clone((__base*)&__buf_);
- __f.__f_->destroy();
- __f.__f_ = __f_;
- __f_ = (__base*)&__buf_;
- }
- else
- _VSTD::swap(__f_, __f.__f_);
-}
-
-template<class _Rp, class _A0, class _A1>
-_Rp
-function<_Rp(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1) const
-{
- if (__f_ == 0)
- __throw_bad_function_call();
- return (*__f_)(__a0, __a1);
-}
-
-#ifndef _LIBCPP_NO_RTTI
-
-template<class _Rp, class _A0, class _A1>
-const std::type_info&
-function<_Rp(_A0, _A1)>::target_type() const
-{
- if (__f_ == 0)
- return typeid(void);
- return __f_->target_type();
-}
-
-template<class _Rp, class _A0, class _A1>
-template <typename _Tp>
-_Tp*
-function<_Rp(_A0, _A1)>::target()
-{
- if (__f_ == 0)
- return (_Tp*)0;
- return (_Tp*) const_cast<void *>(__f_->target(typeid(_Tp)));
-}
-
-template<class _Rp, class _A0, class _A1>
-template <typename _Tp>
-const _Tp*
-function<_Rp(_A0, _A1)>::target() const
-{
- if (__f_ == 0)
- return (const _Tp*)0;
- return (const _Tp*)__f_->target(typeid(_Tp));
-}
-
-#endif // _LIBCPP_NO_RTTI
-
-template<class _Rp, class _A0, class _A1, class _A2>
-class _LIBCPP_TEMPLATE_VIS function<_Rp(_A0, _A1, _A2)>
-{
- typedef __function::__base<_Rp(_A0, _A1, _A2)> __base;
- aligned_storage<3*sizeof(void*)>::type __buf_;
- __base* __f_;
-
-public:
- typedef _Rp result_type;
-
- // 20.7.16.2.1, construct/copy/destroy:
- _LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
- _LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
- function(const function&);
- template<class _Fp>
- function(_Fp,
- typename enable_if<!is_integral<_Fp>::value>::type* = 0);
-
- template<class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- function(allocator_arg_t, const _Alloc&) : __f_(0) {}
- template<class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
- template<class _Alloc>
- function(allocator_arg_t, const _Alloc&, const function&);
- template<class _Fp, class _Alloc>
- function(allocator_arg_t, const _Alloc& __a, _Fp __f,
- typename enable_if<!is_integral<_Fp>::value>::type* = 0);
-
- function& operator=(const function&);
- function& operator=(nullptr_t);
- template<class _Fp>
- typename enable_if
- <
- !is_integral<_Fp>::value,
- function&
- >::type
- operator=(_Fp);
-
- ~function();
-
- // 20.7.16.2.2, function modifiers:
- void swap(function&);
- template<class _Fp, class _Alloc>
- _LIBCPP_INLINE_VISIBILITY
- void assign(_Fp __f, const _Alloc& __a)
- {function(allocator_arg, __a, __f).swap(*this);}
-
- // 20.7.16.2.3, function capacity:
- _LIBCPP_INLINE_VISIBILITY explicit operator bool() const {return __f_;}
-
- template<class _R2, class _B0, class _B1, class _B2>
- bool operator==(const function<_R2(_B0, _B1, _B2)>&) const = delete;
- template<class _R2, class _B0, class _B1, class _B2>
- bool operator!=(const function<_R2(_B0, _B1, _B2)>&) const = delete;
-
- // 20.7.16.2.4, function invocation:
- _Rp operator()(_A0, _A1, _A2) const;
-
-#ifndef _LIBCPP_NO_RTTI
- // 20.7.16.2.5, function target access:
- const std::type_info& target_type() const;
- template <typename _Tp> _Tp* target();
- template <typename _Tp> const _Tp* target() const;
-#endif // _LIBCPP_NO_RTTI
-};
-
-template<class _Rp, class _A0, class _A1, class _A2>
-function<_Rp(_A0, _A1, _A2)>::function(const function& __f)
-{
- if (__f.__f_ == 0)
- __f_ = 0;
- else if (__f.__f_ == (const __base*)&__f.__buf_)
- {
- __f_ = (__base*)&__buf_;
- __f.__f_->__clone(__f_);
- }
- else
- __f_ = __f.__f_->__clone();
-}
-
-template<class _Rp, class _A0, class _A1, class _A2>
-template<class _Alloc>
-function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc&,
- const function& __f)
-{
- if (__f.__f_ == 0)
- __f_ = 0;
- else if (__f.__f_ == (const __base*)&__f.__buf_)
- {
- __f_ = (__base*)&__buf_;
- __f.__f_->__clone(__f_);
- }
- else
- __f_ = __f.__f_->__clone();
-}
-
-template<class _Rp, class _A0, class _A1, class _A2>
-template <class _Fp>
-function<_Rp(_A0, _A1, _A2)>::function(_Fp __f,
- typename enable_if<!is_integral<_Fp>::value>::type*)
- : __f_(0)
-{
- if (__function::__not_null(__f))
- {
- typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1, _A2)> _FF;
- if (sizeof(_FF) <= sizeof(__buf_))
- {
- __f_ = (__base*)&__buf_;
- ::new ((void*)__f_) _FF(__f);
- }
- else
- {
- typedef allocator<_FF> _Ap;
- _Ap __a;
- typedef __allocator_destructor<_Ap> _Dp;
- unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a));
- __f_ = __hold.release();
- }
- }
-}
-
-template<class _Rp, class _A0, class _A1, class _A2>
-template <class _Fp, class _Alloc>
-function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
- typename enable_if<!is_integral<_Fp>::value>::type*)
- : __f_(0)
-{
- typedef allocator_traits<_Alloc> __alloc_traits;
- if (__function::__not_null(__f))
- {
- typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)> _FF;
- if (sizeof(_FF) <= sizeof(__buf_))
- {
- __f_ = (__base*)&__buf_;
- ::new ((void*)__f_) _FF(__f, __a0);
- }
- else
- {
- typedef __rebind_alloc<__alloc_traits, _FF> _Ap;
- _Ap __a(__a0);
- typedef __allocator_destructor<_Ap> _Dp;
- unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) _FF(__f, _Alloc(__a));
- __f_ = __hold.release();
- }
- }
-}
-
-template<class _Rp, class _A0, class _A1, class _A2>
-function<_Rp(_A0, _A1, _A2)>&
-function<_Rp(_A0, _A1, _A2)>::operator=(const function& __f)
-{
- if (__f)
- function(__f).swap(*this);
- else
- *this = nullptr;
- return *this;
-}
-
-template<class _Rp, class _A0, class _A1, class _A2>
-function<_Rp(_A0, _A1, _A2)>&
-function<_Rp(_A0, _A1, _A2)>::operator=(nullptr_t)
-{
- __base* __t = __f_;
- __f_ = 0;
- if (__t == (__base*)&__buf_)
- __t->destroy();
- else if (__t)
- __t->destroy_deallocate();
- return *this;
-}
-
-template<class _Rp, class _A0, class _A1, class _A2>
-template <class _Fp>
-typename enable_if
-<
- !is_integral<_Fp>::value,
- function<_Rp(_A0, _A1, _A2)>&
->::type
-function<_Rp(_A0, _A1, _A2)>::operator=(_Fp __f)
-{
- function(_VSTD::move(__f)).swap(*this);
- return *this;
-}
-
-template<class _Rp, class _A0, class _A1, class _A2>
-function<_Rp(_A0, _A1, _A2)>::~function()
-{
- if (__f_ == (__base*)&__buf_)
- __f_->destroy();
- else if (__f_)
- __f_->destroy_deallocate();
-}
-
-template<class _Rp, class _A0, class _A1, class _A2>
-void
-function<_Rp(_A0, _A1, _A2)>::swap(function& __f)
-{
- if (_VSTD::addressof(__f) == this)
- return;
- if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
- {
- typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
- __base* __t = (__base*)&__tempbuf;
- __f_->__clone(__t);
- __f_->destroy();
- __f_ = 0;
- __f.__f_->__clone((__base*)&__buf_);
- __f.__f_->destroy();
- __f.__f_ = 0;
- __f_ = (__base*)&__buf_;
- __t->__clone((__base*)&__f.__buf_);
- __t->destroy();
- __f.__f_ = (__base*)&__f.__buf_;
- }
- else if (__f_ == (__base*)&__buf_)
- {
- __f_->__clone((__base*)&__f.__buf_);
- __f_->destroy();
- __f_ = __f.__f_;
- __f.__f_ = (__base*)&__f.__buf_;
- }
- else if (__f.__f_ == (__base*)&__f.__buf_)
- {
- __f.__f_->__clone((__base*)&__buf_);
- __f.__f_->destroy();
- __f.__f_ = __f_;
- __f_ = (__base*)&__buf_;
- }
- else
- _VSTD::swap(__f_, __f.__f_);
-}
-
-template<class _Rp, class _A0, class _A1, class _A2>
-_Rp
-function<_Rp(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2) const
-{
- if (__f_ == 0)
- __throw_bad_function_call();
- return (*__f_)(__a0, __a1, __a2);
-}
-
-#ifndef _LIBCPP_NO_RTTI
-
-template<class _Rp, class _A0, class _A1, class _A2>
-const std::type_info&
-function<_Rp(_A0, _A1, _A2)>::target_type() const
-{
- if (__f_ == 0)
- return typeid(void);
- return __f_->target_type();
-}
-
-template<class _Rp, class _A0, class _A1, class _A2>
-template <typename _Tp>
-_Tp*
-function<_Rp(_A0, _A1, _A2)>::target()
-{
- if (__f_ == 0)
- return (_Tp*)0;
- return (_Tp*) const_cast<void *>(__f_->target(typeid(_Tp)));
-}
-
-template<class _Rp, class _A0, class _A1, class _A2>
-template <typename _Tp>
-const _Tp*
-function<_Rp(_A0, _A1, _A2)>::target() const
-{
- if (__f_ == 0)
- return (const _Tp*)0;
- return (const _Tp*)__f_->target(typeid(_Tp));
-}
-
-#endif // _LIBCPP_NO_RTTI
-
-template <class _Fp>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator==(const function<_Fp>& __f, nullptr_t) {return !__f;}
-
-template <class _Fp>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator==(nullptr_t, const function<_Fp>& __f) {return !__f;}
-
-template <class _Fp>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator!=(const function<_Fp>& __f, nullptr_t) {return (bool)__f;}
-
-template <class _Fp>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator!=(nullptr_t, const function<_Fp>& __f) {return (bool)__f;}
-
-template <class _Fp>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-swap(function<_Fp>& __x, function<_Fp>& __y)
-{return __x.swap(__y);}
+_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_CXX03_LANG
-_LIBCPP_END_NAMESPACE_STD
-
#endif // _LIBCPP___FUNCTIONAL_FUNCTION_H
diff --git a/libcxx/test/libcxx/utilities/function.objects/func.wrap/depr_in_cxx03.verify.cpp b/libcxx/test/libcxx/utilities/function.objects/func.wrap/depr_in_cxx03.verify.cpp
deleted file mode 100644
index 2d9a7e4d16037..0000000000000
--- a/libcxx/test/libcxx/utilities/function.objects/func.wrap/depr_in_cxx03.verify.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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.
-//
-//===----------------------------------------------------------------------===//
-
-// <functional>
-
-// Check that libc++'s emulation of std::function is deprecated in C++03
-
-// REQUIRES: c++03
-
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
-#include <functional>
-#include "test_macros.h"
-
-int main(int, char**) {
- // Note:
- // We use sizeof() to require it to be a complete type. We don't create a
- // variable because otherwise we get two warnings for each variable (the
- // second warning is when the destructor is implicitly called).
- (void)sizeof(std::function<void ()>); // expected-warning {{'function<void ()>' is deprecated}}
- (void)sizeof(std::function<void (int)>); // expected-warning {{'function<void (int)>' is deprecated}}
- (void)sizeof(std::function<void (int, int)>); // expected-warning {{'function<void (int, int)>' is deprecated}}
- (void)sizeof(std::function<void (int, int, int)>); // expected-warning {{'function<void (int, int, int)>' is deprecated}}
- return 0;
-}
diff --git a/libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/move_reentrant.pass.cpp b/libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/move_reentrant.pass.cpp
index 0e8f2705195ee..b9cf2c6d5ecae 100644
--- a/libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/move_reentrant.pass.cpp
+++ b/libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/move_reentrant.pass.cpp
@@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
// function& operator=(function &&);
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <functional>
#include <cassert>
diff --git a/libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign_reentrant.pass.cpp b/libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign_reentrant.pass.cpp
index ba0242ee50869..b8dc4e6d212ed 100644
--- a/libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign_reentrant.pass.cpp
+++ b/libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign_reentrant.pass.cpp
@@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
// function& operator=(nullptr_t);
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <functional>
#include <cassert>
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp
index e34dbc999592f..968f1d05efe77 100644
--- a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp
@@ -8,6 +8,8 @@
// <streambuf>
+// UNSUPPORTED: c++03
+
// template <class charT, class traits = char_traits<charT> >
// class basic_streambuf;
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.badcall/bad_function_call.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.badcall/bad_function_call.pass.cpp
index 254ad9e2bcf6a..c390e5904c5f4 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.badcall/bad_function_call.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.badcall/bad_function_call.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// Class bad_function_call
// class bad_function_call
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.badcall/func.wrap.badcall.const/bad_function_call_ctor.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.badcall/func.wrap.badcall.const/bad_function_call_ctor.pass.cpp
index e72ca95bae82b..a5a8c5936cc03 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.badcall/func.wrap.badcall.const/bad_function_call_ctor.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.badcall/func.wrap.badcall.const/bad_function_call_ctor.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// Class bad_function_call
// bad_function_call();
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/addressof.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/addressof.pass.cpp
index 703b56f5cde89..717e655a4c0d8 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/addressof.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/addressof.pass.cpp
@@ -6,13 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
// Make sure we can use std::function with a type that has a hostile overload
// of operator&().
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp
index c35c67a572b5a..3924274190c41 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
@@ -13,9 +15,6 @@
// template <MoveConstructible R, MoveConstructible ... ArgTypes>
// void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&) noexcept;
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <functional>
#include <cstdlib>
#include <cassert>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.cap/operator_bool.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.cap/operator_bool.pass.cpp
index 59253c01a6cc2..9742d53bdbb46 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.cap/operator_bool.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.cap/operator_bool.pass.cpp
@@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
// explicit operator bool() const
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <functional>
#include <cassert>
#include <type_traits>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp
index 3af43f2019a65..c1ad528254af1 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp
@@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
// function(F);
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <functional>
#include <cassert>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp
index 4abf6b8e91df0..589528dbf5412 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+ // UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
@@ -15,9 +17,6 @@
// && Convertible<Callable<F, ArgTypes...>::result_type
// operator=(F f);
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <functional>
#include <cassert>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_incomplete.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_incomplete.pass.cpp
index ce0aba71ac258..531324fa7cce1 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_incomplete.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_incomplete.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
@@ -14,9 +16,6 @@
// Allow incomplete argument types in the __is_callable check
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <functional>
#include <cassert>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_nullptr.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_nullptr.pass.cpp
index d3f7ee0c6e80f..6ed4c5ca305ec 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_nullptr.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_nullptr.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
@@ -15,9 +17,6 @@
// Ensure that __not_null works for all function types.
// See https://llvm.org/PR23589
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
//------------------------------------------------------------------------------
// TESTING std::function<...>::__not_null(Callable)
//
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp
index 2f3cc6e31bdd3..fd73fba6b67a5 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// <functional>
-// REQUIRES: c++03 || c++11 || c++14
+// REQUIRES: c++11 || c++14
// class function<R(ArgTypes...)>
@@ -15,9 +15,6 @@
//
// This signature was removed in C++17
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <functional>
#include <cassert>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp
index 9f35871d51af6..1c546477b5287 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp
@@ -7,15 +7,12 @@
//===----------------------------------------------------------------------===//
// <functional>
-// REQUIRES: c++03 || c++11 || c++14
+// REQUIRES: c++11 || c++14
// class function<R(ArgTypes...)>
// template<class F, class A> function(allocator_arg_t, const A&, F);
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <functional>
#include <cassert>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp
index 3ef1712ecf34b..4537e6d760245 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp
@@ -7,15 +7,12 @@
//===----------------------------------------------------------------------===//
// <functional>
-// REQUIRES: c++03 || c++11 || c++14
+// REQUIRES: c++11 || c++14
// class function<R(ArgTypes...)>
// template<class A> function(allocator_arg_t, const A&, const function&);
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <functional>
#include <cassert>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp
index 99746c057088a..65bda95818325 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// <functional>
-// REQUIRES: c++03 || c++11 || c++14
+// REQUIRES: c++11 || c++14
// class function<R(ArgTypes...)>
@@ -15,9 +15,6 @@
//
// This signature was removed in C++17
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <functional>
#include <cassert>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp
index b1bf69ef17744..75eaa55dc71ed 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp
@@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
// function& operator=(const function& f);
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <cassert>
#include <functional>
#include <utility>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp
index 70a1b3afd7d39..6ad6e2a9e813d 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp
@@ -10,6 +10,8 @@
// allocations.
// XFAIL: target=x86_64-pc-windows-msvc && stdlib=libc++
+// UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
@@ -17,9 +19,6 @@
// function(const function& f);
// function(function&& f); // noexcept in C++20
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <functional>
#include <memory>
#include <cstdlib>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/default.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/default.pass.cpp
index 90c83cd58769a..9b99a7ac62727 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/default.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/default.pass.cpp
@@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
// function();
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <functional>
#include <cassert>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t.pass.cpp
index c7e6d19c207e7..1cdafc56fa915 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t.pass.cpp
@@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
// function(nullptr_t);
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <functional>
#include <cassert>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp
index 51a5a0fe5b22c..391e2a7434bf7 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp
@@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
// function& operator=(nullptr_t);
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <functional>
#include <cassert>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp
index b1ef0aaa9596f..241b1f7b19614 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/assign_F_alloc.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/assign_F_alloc.pass.cpp
index a565d9f4f6a5c..c2dd409a1903a 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/assign_F_alloc.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/assign_F_alloc.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
@@ -13,9 +15,6 @@
// template<class F, class A> void assign(F&&, const A&);
// This call was removed post-C++14
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <functional>
#include <cassert>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp
index e7f6989b4e07f..d51c35ea44fa0 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp
@@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
// void swap(function& other);
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <functional>
#include <cassert>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.nullptr/operator_==.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.nullptr/operator_==.pass.cpp
index d2c1dd11467ec..f52f77bb79c0a 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.nullptr/operator_==.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.nullptr/operator_==.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
@@ -22,9 +24,6 @@
// template <MoveConstructible R, MoveConstructible ... ArgTypes>
// bool operator!=(nullptr_t, const function<R(ArgTypes...)>&);
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <functional>
#include <cassert>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp
index 9d9c6443482bb..240c7fb3bbd2e 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
@@ -19,9 +21,6 @@
// const T*
// target() const;
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
// UNSUPPORTED: no-rtti
#include <functional>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target_type.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target_type.pass.cpp
index b7eb0cccabc80..f899530a67f00 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target_type.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target_type.pass.cpp
@@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// <functional>
// class function<R(ArgTypes...)>
// const std::type_info& target_type() const;
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
// UNSUPPORTED: no-rtti
#include <functional>
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp
index e3fa858306f0b..45a3d7aa910de 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
// <functional>
// template<Returnable R, CopyConstructible... ArgTypes>
@@ -21,9 +23,6 @@
// ...
// };
-// This test runs in C++03, but we have deprecated using std::function in C++03.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
-
#include <functional>
#include <type_traits>
More information about the libcxx-commits
mailing list