diff --git a/include/libtorrent/aux_/throw.hpp b/include/libtorrent/aux_/throw.hpp index cfa5b05d5..aa91f125e 100644 --- a/include/libtorrent/aux_/throw.hpp +++ b/include/libtorrent/aux_/throw.hpp @@ -41,11 +41,11 @@ namespace libtorrent { namespace aux { template #ifdef BOOST_NO_EXCEPTIONS - void TORRENT_NO_RETURN throw_ex(Args&&...) { + [[noreturn]] void throw_ex(Args&&...) { std::terminate(); } #else - void TORRENT_NO_RETURN throw_ex(Args&&... args) { + [[noreturn]] void throw_ex(Args&&... args) { throw T(std::forward(args)...); } #endif diff --git a/include/libtorrent/config.hpp b/include/libtorrent/config.hpp index ccdccc192..3bbec20e0 100644 --- a/include/libtorrent/config.hpp +++ b/include/libtorrent/config.hpp @@ -346,16 +346,6 @@ POSSIBILITY OF SUCH DAMAGE. #define TORRENT_UNUSED(x) (void)(x) -// at the highest warning level, clang actually warns about functions -// that could be marked noreturn. -#if defined __clang__ || defined __GNUC__ -#define TORRENT_NO_RETURN __attribute((noreturn)) -#elif _MSC_VER -#define TORRENT_NO_RETURN __declspec(noreturn) -#else -#define TORRENT_NO_RETURN -#endif - #if defined __GNUC__ || defined __clang__ #define TORRENT_FORMAT(fmt, ellipsis) __attribute__((__format__(__printf__, fmt, ellipsis))) #else diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp index 36c0b1c91..fc565c85e 100644 --- a/include/libtorrent/torrent_handle.hpp +++ b/include/libtorrent/torrent_handle.hpp @@ -72,7 +72,7 @@ namespace aux { class torrent; #ifndef BOOST_NO_EXCEPTIONS - void TORRENT_NO_RETURN throw_invalid_handle(); + [[noreturn]] void throw_invalid_handle(); #endif using status_flags_t = flags::bitfield_flag; diff --git a/src/entry.cpp b/src/entry.cpp index b28347ae7..750d765eb 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -70,7 +70,7 @@ namespace detail { namespace { - inline void TORRENT_NO_RETURN throw_error() + [[noreturn]] inline void throw_error() { aux::throw_ex(errors::invalid_entry_type); } template diff --git a/src/torrent_handle.cpp b/src/torrent_handle.cpp index b7996eb79..d74f268a6 100644 --- a/src/torrent_handle.cpp +++ b/src/torrent_handle.cpp @@ -78,7 +78,7 @@ namespace libtorrent { constexpr status_flags_t torrent_handle::query_save_path; #ifndef BOOST_NO_EXCEPTIONS - void TORRENT_NO_RETURN throw_invalid_handle() + [[noreturn]] void throw_invalid_handle() { throw system_error(errors::invalid_torrent_handle); } diff --git a/test/main.cpp b/test/main.cpp index 2e68ffeb2..5209c84c0 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -166,7 +166,7 @@ LONG WINAPI seh_exception_handler(LPEXCEPTION_POINTERS p) #else -void TORRENT_NO_RETURN sig_handler(int sig) +[[noreturn]] void sig_handler(int sig) { char stack_text[10000];