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,10 @@ 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 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. Also note that per the Standard, ``unary_function`` + and ``binary_function`` will be removed in C++17 and above starting in the next release. - 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/include/__functional/binary_function.h b/libcxx/include/__functional/binary_function.h --- a/libcxx/include/__functional/binary_function.h +++ b/libcxx/include/__functional/binary_function.h @@ -23,9 +23,9 @@ template struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binary_function { - typedef _Arg1 first_argument_type; - typedef _Arg2 second_argument_type; - typedef _Result result_type; + typedef _Arg1 first_argument_type _LIBCPP_DEPRECATED_IN_CXX17; + typedef _Arg2 second_argument_type _LIBCPP_DEPRECATED_IN_CXX17; + typedef _Result result_type _LIBCPP_DEPRECATED_IN_CXX17; }; #endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) diff --git a/libcxx/include/__functional/unary_function.h b/libcxx/include/__functional/unary_function.h --- a/libcxx/include/__functional/unary_function.h +++ b/libcxx/include/__functional/unary_function.h @@ -22,8 +22,8 @@ template struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 unary_function { - typedef _Arg argument_type; - typedef _Result result_type; + typedef _Arg argument_type _LIBCPP_DEPRECATED_IN_CXX17; + typedef _Result result_type _LIBCPP_DEPRECATED_IN_CXX17; }; #endif // _LIBCPP_STD_VER <= 14