[libcxx-commits] [PATCH] D134473: [libc++] Keep unary_function and binary_function in C++17 for one more release

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Sep 23 13:17:43 PDT 2022


ldionne updated this revision to Diff 462578.
ldionne marked 2 inline comments as done.
ldionne added a comment.

Address comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134473/new/

https://reviews.llvm.org/D134473

Files:
  libcxx/docs/ReleaseNotes.rst
  libcxx/include/__config
  libcxx/test/libcxx/depr/depr.func.adaptor.typedefs/typedefs.depr_in_cxx17.verify.cpp


Index: libcxx/test/libcxx/depr/depr.func.adaptor.typedefs/typedefs.depr_in_cxx17.verify.cpp
===================================================================
--- libcxx/test/libcxx/depr/depr.func.adaptor.typedefs/typedefs.depr_in_cxx17.verify.cpp
+++ libcxx/test/libcxx/depr/depr.func.adaptor.typedefs/typedefs.depr_in_cxx17.verify.cpp
@@ -19,6 +19,12 @@
 #include <utility>
 #include "test_macros.h"
 
+// This test is disabled in LLVM 15 because we enable the removed
+// unary_function and binary_function classes by default, which means
+// that we also don't produce deprecation warnings for using their members.
+
+// expected-no-diagnostics
+#if 0
 void test_functional()
 {
     {
@@ -123,3 +129,4 @@
         (void)c;
     }
 }
+#endif
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -1101,6 +1101,13 @@
 #    define _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
 #  endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
 
+// Leave the deprecation notices in by default, but don't remove unary_function and
+// binary_function entirely just yet. That way, folks will have one release to act
+// on the deprecation warnings.
+#  ifndef _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
+#    define _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
+#  endif
+
 #  if defined(_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES)
 #    define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
 #    define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_VOID_SPECIALIZATION
Index: libcxx/docs/ReleaseNotes.rst
===================================================================
--- libcxx/docs/ReleaseNotes.rst
+++ libcxx/docs/ReleaseNotes.rst
@@ -141,11 +141,11 @@
   or upgrade to C++11 or later. It is possible to re-enable ``std::function`` in C++03 by defining
   ``_LIBCPP_ENABLE_CXX03_FUNCTION``. This option will be removed in LLVM 16.
 
-- ``unary_function`` and ``binary_function`` are no longer available in C++17 and C++20.
-  They can be re-enabled by defining ``_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION``.
-  They are also marked as ``[[deprecated]]`` in C++11 and later. To disable deprecation warnings
-  you have to define ``_LIBCPP_DISABLE_DEPRECATION_WARNINGS``. Note that this disables
-  all deprecation warnings.
+- ``unary_function`` and ``binary_function`` are now marked as ``[[deprecated]]`` in C++11 and later.
+  Deprecation warnings can be disabled by defining ``_LIBCPP_DISABLE_DEPRECATION_WARNINGS``, however
+  this disables all deprecation warnings, not only those for ``unary_function`` and ``binary_function``.
+  Also note that starting in LLVM 16, ``unary_function`` and ``binary_function`` will be removed entirely
+  (not only deprecated) in C++17 and above, as mandated by the Standard.
 
 - The contents of ``<codecvt>``, ``wstring_convert`` and ``wbuffer_convert`` have been marked as deprecated.
   To disable deprecation warnings you have to define ``_LIBCPP_DISABLE_DEPRECATION_WARNINGS``. Note that this


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134473.462578.patch
Type: text/x-patch
Size: 3054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220923/e71adb07/attachment.bin>


More information about the libcxx-commits mailing list