Skip to content

Commit 1465b6f

Browse files
Nerixyzchriskohlhoff
authored andcommitted
Annotate deprecated items with [[deprecated]].
1 parent 3817c12 commit 1465b6f

File tree

10 files changed

+35
-6
lines changed

10 files changed

+35
-6
lines changed

include/asio/basic_deadline_timer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ namespace asio {
129129
template <typename Time,
130130
typename TimeTraits = asio::time_traits<Time>,
131131
typename Executor = any_io_executor>
132-
class basic_deadline_timer
132+
class ASIO_DEPRECATED_MSG("Use basic_waitable_timer") basic_deadline_timer
133133
{
134134
private:
135135
class initiate_async_wait;

include/asio/basic_io_object.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ template <typename IoObjectService>
6060
template <typename IoObjectService,
6161
bool Movable = detail::service_has_move<IoObjectService>::value>
6262
#endif
63-
class basic_io_object
63+
class ASIO_DEPRECATED_MSG("Deprecated without replacement")
64+
basic_io_object
6465
{
6566
public:
6667
/// The type of the service that will be used to provide I/O operations.
@@ -190,7 +191,8 @@ class basic_io_object
190191

191192
// Specialisation for movable objects.
192193
template <typename IoObjectService>
193-
class basic_io_object<IoObjectService, true>
194+
class ASIO_DEPRECATED_MSG("Deprecated without replacement")
195+
basic_io_object<IoObjectService, true>
194196
{
195197
public:
196198
typedef IoObjectService service_type;

include/asio/buffer.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,9 @@ class const_buffer
328328
/// (Deprecated: Use the socket/descriptor wait() and async_wait() member
329329
/// functions.) An implementation of both the ConstBufferSequence and
330330
/// MutableBufferSequence concepts to represent a null buffer sequence.
331-
class null_buffers
331+
class ASIO_DEPRECATED_MSG(
332+
"Use the socket/descriptor wait() and async_wait() member functions")
333+
null_buffers
332334
{
333335
public:
334336
/// The type for each element in the list of buffers.

include/asio/deadline_timer.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ namespace asio {
3131

3232
/// (Deprecated: Use system_timer.) Typedef for the typical usage of timer. Uses
3333
/// a UTC clock.
34+
ASIO_DEPRECATED_MSG("Use system_timer")
3435
typedef basic_deadline_timer<boost::posix_time::ptime> deadline_timer;
3536

3637
} // namespace asio

include/asio/detail/config.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,6 +1390,20 @@
13901390
# define ASIO_NODISCARD
13911391
#endif // !defined(ASIO_NODISCARD)
13921392

1393+
// Compiler support for the the [[deprecated(msg)]] attribute.
1394+
#if !defined(ASIO_DEPRECATED_MSG)
1395+
# if !defined(ASIO_DISABLE_DEPRECATED_MSG)
1396+
# if defined(__has_cpp_attribute)
1397+
# if __has_cpp_attribute(deprecated)
1398+
# define ASIO_DEPRECATED_MSG(msg) [[deprecated(msg)]]
1399+
# endif // __has_cpp_attribute(deprecated)
1400+
# endif // defined(__has_cpp_attribute)
1401+
# endif // !defined(ASIO_DISABLE_DEPRECATED_MSG)
1402+
#endif // !defined(ASIO_DEPRECATED_MSG)
1403+
#if !defined(ASIO_DEPRECATED_MSG)
1404+
# define ASIO_DEPRECATED_MSG(msg)
1405+
#endif // !defined(ASIO_DEPRECATED_MSG)
1406+
13931407
// Kernel support for MSG_NOSIGNAL.
13941408
#if !defined(ASIO_HAS_MSG_NOSIGNAL)
13951409
# if defined(__linux__)

include/asio/detail/push_options.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262

6363
# pragma GCC diagnostic push
6464
# pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
65+
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
6566
# if (__clang_major__ >= 6)
6667
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
6768
# endif // (__clang_major__ >= 6)
@@ -106,6 +107,9 @@
106107
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) || (__GNUC__ > 4)
107108
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
108109
# endif // (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) || (__GNUC__ > 4)
110+
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ > 4)
111+
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
112+
# endif // (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ > 4)
109113
# if (__GNUC__ >= 7)
110114
# pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
111115
# endif // (__GNUC__ >= 7)
@@ -184,6 +188,7 @@
184188
# pragma warning (disable:4512)
185189
# pragma warning (disable:4610)
186190
# pragma warning (disable:4675)
191+
# pragma warning (disable:4996)
187192
# if (_MSC_VER < 1600)
188193
// Visual Studio 2008 generates spurious warnings about unused parameters.
189194
# pragma warning (disable:4100)

include/asio/impl/execution_context.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ Service& make_service(execution_context& e, Args&&... args)
114114
}
115115

116116
template <typename Service>
117+
ASIO_DEPRECATED_MSG("Use make_service()")
117118
inline void add_service(execution_context& e, Service* svc)
118119
{
119120
// Check that Service meets the necessary type requirements.

include/asio/io_context.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ class io_context
498498
* boost::bind(f, a1, ... an)); @endcode
499499
*/
500500
template <typename Handler>
501+
ASIO_DEPRECATED_MSG("Use asio::bind_executor()")
501502
#if defined(GENERATING_DOCUMENTATION)
502503
unspecified
503504
#else

include/asio/io_context_strand.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ class io_context::strand
236236
* @code asio::dispatch(strand, boost::bind(f, a1, ... an)); @endcode
237237
*/
238238
template <typename Handler>
239+
ASIO_DEPRECATED_MSG("Use asio::bind_executor()")
239240
#if defined(GENERATING_DOCUMENTATION)
240241
unspecified
241242
#else

include/asio/time_traits.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ namespace asio {
3030

3131
/// (Deprecated) Time traits suitable for use with the deadline timer.
3232
template <typename Time>
33-
struct time_traits;
33+
struct ASIO_DEPRECATED_MSG("Use basic_waitable_timer and wait_traits")
34+
time_traits;
3435

3536
/// (Deprecated) Time traits specialised for posix_time.
3637
template <>
37-
struct time_traits<boost::posix_time::ptime>
38+
struct ASIO_DEPRECATED_MSG("Use basic_waitable_timer and wait_traits")
39+
time_traits<boost::posix_time::ptime>
3840
{
3941
/// The time type.
4042
typedef boost::posix_time::ptime time_type;

0 commit comments

Comments
 (0)