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

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Feb 17 08:00:36 PST 2020


ldionne created this revision.
ldionne added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, dexonsmith, jkorous, christof.
Herald added a project: libc++.

We want to eventually remove it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74719

Files:
  libcxx/include/__functional_03


Index: libcxx/include/__functional_03
===================================================================
--- libcxx/include/__functional_03
+++ libcxx/include/__functional_03
@@ -443,8 +443,15 @@
 
 }  // __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 different 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 @@
 #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 @@
 #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 @@
 #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_;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74719.244978.patch
Type: text/x-patch
Size: 1832 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200217/09287de0/attachment-0001.bin>


More information about the libcxx-commits mailing list