[libcxx-commits] [libcxx] c008716 - [libc++] Mark the C++03 version of std::function as deprecated

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Feb 24 08:00:09 PST 2020


Author: Louis Dionne
Date: 2020-02-24T10:59:58-05:00
New Revision: c0087164175767bd22dc4336f48098c338aa8e7a

URL: https://github.com/llvm/llvm-project/commit/c0087164175767bd22dc4336f48098c338aa8e7a
DIFF: https://github.com/llvm/llvm-project/commit/c0087164175767bd22dc4336f48098c338aa8e7a.diff

LOG: [libc++] Mark the C++03 version of std::function as deprecated

Summary: We want to eventually remove it.

Reviewers: EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D74719

Added: 
    

Modified: 
    libcxx/include/__functional_03

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__functional_03 b/libcxx/include/__functional_03
index bf86428dea05..f945aa5bc4d9 100644
--- a/libcxx/include/__functional_03
+++ b/libcxx/include/__functional_03
@@ -443,8 +443,15 @@ __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::target_type() const
 
 }  // __function
 
+#if !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 _Rp>
-class _LIBCPP_TEMPLATE_VIS function<_Rp()>
+class _LIBCPP_DEPRECATED_CXX03_FUNCTION _LIBCPP_TEMPLATE_VIS function<_Rp()>
 {
     typedef __function::__base<_Rp()> __base;
     aligned_storage<3*sizeof(void*)>::type __buf_;
@@ -723,7 +730,7 @@ function<_Rp()>::target() const
 #endif  // _LIBCPP_NO_RTTI
 
 template<class _Rp, class _A0>
-class _LIBCPP_TEMPLATE_VIS function<_Rp(_A0)>
+class _LIBCPP_DEPRECATED_CXX03_FUNCTION _LIBCPP_TEMPLATE_VIS function<_Rp(_A0)>
     : public unary_function<_A0, _Rp>
 {
     typedef __function::__base<_Rp(_A0)> __base;
@@ -1003,7 +1010,7 @@ function<_Rp(_A0)>::target() const
 #endif  // _LIBCPP_NO_RTTI
 
 template<class _Rp, class _A0, class _A1>
-class _LIBCPP_TEMPLATE_VIS function<_Rp(_A0, _A1)>
+class _LIBCPP_DEPRECATED_CXX03_FUNCTION _LIBCPP_TEMPLATE_VIS function<_Rp(_A0, _A1)>
     : public binary_function<_A0, _A1, _Rp>
 {
     typedef __function::__base<_Rp(_A0, _A1)> __base;
@@ -1283,7 +1290,7 @@ function<_Rp(_A0, _A1)>::target() const
 #endif  // _LIBCPP_NO_RTTI
 
 template<class _Rp, class _A0, class _A1, class _A2>
-class _LIBCPP_TEMPLATE_VIS function<_Rp(_A0, _A1, _A2)>
+class _LIBCPP_DEPRECATED_CXX03_FUNCTION _LIBCPP_TEMPLATE_VIS function<_Rp(_A0, _A1, _A2)>
 {
     typedef __function::__base<_Rp(_A0, _A1, _A2)> __base;
     aligned_storage<3*sizeof(void*)>::type __buf_;


        


More information about the libcxx-commits mailing list