From 6758690d2ff83a1dd0da0a059017be88de1a113c Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Tue, 6 Oct 2020 03:42:00 +0300 Subject: [PATCH] Add BOOST_SYSTEM_DEPRECATED; mark deprecated categories --- include/boost/system/detail/config.hpp | 14 ++++++++++++++ include/boost/system/detail/generic_category.hpp | 8 ++++---- include/boost/system/detail/system_category.hpp | 4 ++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/include/boost/system/detail/config.hpp b/include/boost/system/detail/config.hpp index 5742a94..f6ace68 100644 --- a/include/boost/system/detail/config.hpp +++ b/include/boost/system/detail/config.hpp @@ -48,4 +48,18 @@ # define BOOST_SYSTEM_CONSTEXPR #endif +// BOOST_SYSTEM_DEPRECATED + +#if defined(__clang__) +# define BOOST_SYSTEM_DEPRECATED(msg) __attribute__((deprecated(msg))) +#elif defined(__GNUC__) +# if __GNUC__ * 100 + __GNUC_MINOR__ >= 405 +# define BOOST_SYSTEM_DEPRECATED(msg) __attribute__((deprecated(msg))) +# else +# define BOOST_SYSTEM_DEPRECATED(msg) __attribute__((deprecated)) +# endif +#elif defined(_MSC_VER) +# define BOOST_SYSTEM_DEPRECATED(msg) __declspec(deprecated(msg)) +#endif + #endif // BOOST_SYSTEM_DETAIL_CONFIG_HPP_INCLUDED diff --git a/include/boost/system/detail/generic_category.hpp b/include/boost/system/detail/generic_category.hpp index 98b5708..0a41b67 100644 --- a/include/boost/system/detail/generic_category.hpp +++ b/include/boost/system/detail/generic_category.hpp @@ -109,10 +109,10 @@ inline error_category const & generic_category() BOOST_NOEXCEPT #ifdef BOOST_SYSTEM_ENABLE_DEPRECATED -inline const error_category & get_generic_category() { return generic_category(); } -inline const error_category & get_posix_category() { return generic_category(); } -static const error_category & posix_category BOOST_ATTRIBUTE_UNUSED = generic_category(); -static const error_category & errno_ecat BOOST_ATTRIBUTE_UNUSED = generic_category(); +BOOST_SYSTEM_DEPRECATED("please use generic_category()") inline const error_category & get_generic_category() { return generic_category(); } +BOOST_SYSTEM_DEPRECATED("please use generic_category()") inline const error_category & get_posix_category() { return generic_category(); } +BOOST_SYSTEM_DEPRECATED("please use generic_category()") static const error_category & posix_category BOOST_ATTRIBUTE_UNUSED = generic_category(); +BOOST_SYSTEM_DEPRECATED("please use generic_category()") static const error_category & errno_ecat BOOST_ATTRIBUTE_UNUSED = generic_category(); #endif diff --git a/include/boost/system/detail/system_category.hpp b/include/boost/system/detail/system_category.hpp index 9e788a6..ae8c953 100644 --- a/include/boost/system/detail/system_category.hpp +++ b/include/boost/system/detail/system_category.hpp @@ -98,8 +98,8 @@ inline error_category const & system_category() BOOST_NOEXCEPT #ifdef BOOST_SYSTEM_ENABLE_DEPRECATED -inline const error_category & get_system_category() { return system_category(); } -static const error_category & native_ecat BOOST_ATTRIBUTE_UNUSED = system_category(); +BOOST_SYSTEM_DEPRECATED("please use system_category()") inline const error_category & get_system_category() { return system_category(); } +BOOST_SYSTEM_DEPRECATED("please use system_category()") static const error_category & native_ecat BOOST_ATTRIBUTE_UNUSED = system_category(); #endif