diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst --- a/libcxx/docs/ReleaseNotes.rst +++ b/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 ````, ``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 diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/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 diff --git a/libcxx/test/libcxx/depr/depr.func.adaptor.typedefs/typedefs.depr_in_cxx17.verify.cpp b/libcxx/test/libcxx/depr/depr.func.adaptor.typedefs/typedefs.depr_in_cxx17.verify.cpp --- a/libcxx/test/libcxx/depr/depr.func.adaptor.typedefs/typedefs.depr_in_cxx17.verify.cpp +++ b/libcxx/test/libcxx/depr/depr.func.adaptor.typedefs/typedefs.depr_in_cxx17.verify.cpp @@ -19,6 +19,12 @@ #include #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