From d34514709e71813a850e45b31d49a271fdbcbade Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Fri, 7 Mar 2025 15:17:16 +0100 Subject: [PATCH] Annotate deprecated items with `[[deprecated]]` --- asio/include/asio/basic_deadline_timer.hpp | 2 +- asio/include/asio/basic_io_object.hpp | 6 +++--- asio/include/asio/buffer.hpp | 4 +++- asio/include/asio/deadline_timer.hpp | 1 + asio/include/asio/detail/config.hpp | 14 ++++++++++++++ asio/include/asio/detail/push_options.hpp | 5 +++++ asio/include/asio/detail/timer_queue_ptime.hpp | 2 +- asio/include/asio/impl/execution_context.hpp | 1 + asio/include/asio/io_context.hpp | 1 + asio/include/asio/io_context_strand.hpp | 1 + asio/include/asio/time_traits.hpp | 4 ++-- 11 files changed, 33 insertions(+), 8 deletions(-) diff --git a/asio/include/asio/basic_deadline_timer.hpp b/asio/include/asio/basic_deadline_timer.hpp index 0ee307ece2..1482ed9928 100644 --- a/asio/include/asio/basic_deadline_timer.hpp +++ b/asio/include/asio/basic_deadline_timer.hpp @@ -129,7 +129,7 @@ namespace asio { template , typename Executor = any_io_executor> -class basic_deadline_timer +class ASIO_DEPRECATED_X("Use basic_waitable_timer") basic_deadline_timer { private: class initiate_async_wait; diff --git a/asio/include/asio/basic_io_object.hpp b/asio/include/asio/basic_io_object.hpp index 27cdbc7a36..f43e26582f 100644 --- a/asio/include/asio/basic_io_object.hpp +++ b/asio/include/asio/basic_io_object.hpp @@ -30,7 +30,7 @@ namespace detail { // Type trait used to determine whether a service supports move. template - class service_has_move + class ASIO_DEPRECATED service_has_move { private: typedef IoObjectService service_type; @@ -60,7 +60,7 @@ template template ::value> #endif -class basic_io_object +class ASIO_DEPRECATED basic_io_object { public: /// The type of the service that will be used to provide I/O operations. @@ -190,7 +190,7 @@ class basic_io_object // Specialisation for movable objects. template -class basic_io_object +class ASIO_DEPRECATED basic_io_object { public: typedef IoObjectService service_type; diff --git a/asio/include/asio/buffer.hpp b/asio/include/asio/buffer.hpp index 89276ce5ce..a650a772ba 100644 --- a/asio/include/asio/buffer.hpp +++ b/asio/include/asio/buffer.hpp @@ -328,7 +328,9 @@ class const_buffer /// (Deprecated: Use the socket/descriptor wait() and async_wait() member /// functions.) An implementation of both the ConstBufferSequence and /// MutableBufferSequence concepts to represent a null buffer sequence. -class null_buffers +class ASIO_DEPRECATED_X( + "Use the socket/descriptor wait() and async_wait() member functions") +null_buffers { public: /// The type for each element in the list of buffers. diff --git a/asio/include/asio/deadline_timer.hpp b/asio/include/asio/deadline_timer.hpp index e806c34440..cc0dab9b06 100644 --- a/asio/include/asio/deadline_timer.hpp +++ b/asio/include/asio/deadline_timer.hpp @@ -31,6 +31,7 @@ namespace asio { /// (Deprecated: Use system_timer.) Typedef for the typical usage of timer. Uses /// a UTC clock. +ASIO_DEPRECATED_X("Use system_timer") typedef basic_deadline_timer deadline_timer; } // namespace asio diff --git a/asio/include/asio/detail/config.hpp b/asio/include/asio/detail/config.hpp index 44171c4b24..d93d6d0de5 100644 --- a/asio/include/asio/detail/config.hpp +++ b/asio/include/asio/detail/config.hpp @@ -1386,6 +1386,20 @@ # define ASIO_NODISCARD #endif // !defined(ASIO_NODISCARD) +// Compiler support for the the [[deprecated(msg)]] attribute. +#if !defined(ASIO_DEPRECATED) +# if defined(__has_cpp_attribute) +# if __has_cpp_attribute(deprecated) && !defined(ASIO_IGNORE_DEPRECATED) +# define ASIO_DEPRECATED [[deprecated]] +# define ASIO_DEPRECATED_X(msg) [[deprecated(msg)]] +# endif // __has_cpp_attribute(deprecated) +# endif // defined(__has_cpp_attribute) +#endif // !defined(ASIO_DEPRECATED) +#if !defined(ASIO_DEPRECATED) +# define ASIO_DEPRECATED +# define ASIO_DEPRECATED_X(msg) +#endif // !defined(ASIO_DEPRECATED) + // Kernel support for MSG_NOSIGNAL. #if !defined(ASIO_HAS_MSG_NOSIGNAL) # if defined(__linux__) diff --git a/asio/include/asio/detail/push_options.hpp b/asio/include/asio/detail/push_options.hpp index 345a911889..20b5ee8961 100644 --- a/asio/include/asio/detail/push_options.hpp +++ b/asio/include/asio/detail/push_options.hpp @@ -62,6 +62,7 @@ # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wnon-virtual-dtor" +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" # if (__clang_major__ >= 6) # pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" # endif // (__clang_major__ >= 6) @@ -106,6 +107,9 @@ # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) || (__GNUC__ > 4) # pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" # endif // (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) || (__GNUC__ > 4) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ > 4) +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +# endif // (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ > 4) # if (__GNUC__ >= 7) # pragma GCC diagnostic ignored "-Wimplicit-fallthrough" # endif // (__GNUC__ >= 7) @@ -184,6 +188,7 @@ # pragma warning (disable:4512) # pragma warning (disable:4610) # pragma warning (disable:4675) +# pragma warning (disable:4996) # if (_MSC_VER < 1600) // Visual Studio 2008 generates spurious warnings about unused parameters. # pragma warning (disable:4100) diff --git a/asio/include/asio/detail/timer_queue_ptime.hpp b/asio/include/asio/detail/timer_queue_ptime.hpp index 5f5a92ad60..92b7776221 100644 --- a/asio/include/asio/detail/timer_queue_ptime.hpp +++ b/asio/include/asio/detail/timer_queue_ptime.hpp @@ -33,7 +33,7 @@ struct forwarding_posix_time_traits : time_traits {}; // Template specialisation for the commonly used instantiation. template <> -class timer_queue> +class ASIO_DEPRECATED timer_queue> : public timer_queue_base { public: diff --git a/asio/include/asio/impl/execution_context.hpp b/asio/include/asio/impl/execution_context.hpp index 4e969d122f..4b5dffd01e 100644 --- a/asio/include/asio/impl/execution_context.hpp +++ b/asio/include/asio/impl/execution_context.hpp @@ -46,6 +46,7 @@ Service& make_service(execution_context& e, Args&&... args) } template +ASIO_DEPRECATED_X("Use make_service()") inline void add_service(execution_context& e, Service* svc) { // Check that Service meets the necessary type requirements. diff --git a/asio/include/asio/io_context.hpp b/asio/include/asio/io_context.hpp index d83cf0ad0d..1f13d963b9 100644 --- a/asio/include/asio/io_context.hpp +++ b/asio/include/asio/io_context.hpp @@ -459,6 +459,7 @@ class io_context * boost::bind(f, a1, ... an)); @endcode */ template + ASIO_DEPRECATED_X("Use asio::bind_executor()") #if defined(GENERATING_DOCUMENTATION) unspecified #else diff --git a/asio/include/asio/io_context_strand.hpp b/asio/include/asio/io_context_strand.hpp index ae6170995a..6f2c4cf03e 100644 --- a/asio/include/asio/io_context_strand.hpp +++ b/asio/include/asio/io_context_strand.hpp @@ -236,6 +236,7 @@ class io_context::strand * @code asio::dispatch(strand, boost::bind(f, a1, ... an)); @endcode */ template + ASIO_DEPRECATED_X("Use asio::bind_executor()") #if defined(GENERATING_DOCUMENTATION) unspecified #else diff --git a/asio/include/asio/time_traits.hpp b/asio/include/asio/time_traits.hpp index 242481d778..781ded1312 100644 --- a/asio/include/asio/time_traits.hpp +++ b/asio/include/asio/time_traits.hpp @@ -30,11 +30,11 @@ namespace asio { /// (Deprecated) Time traits suitable for use with the deadline timer. template -struct time_traits; +struct ASIO_DEPRECATED time_traits; /// (Deprecated) Time traits specialised for posix_time. template <> -struct time_traits +struct ASIO_DEPRECATED time_traits { /// The time type. typedef boost::posix_time::ptime time_type;