noreturn attribute is standard in C++11

This commit is contained in:
Arvid Norberg 2019-02-26 20:48:23 +01:00 committed by Arvid Norberg
parent 9bd5f424d3
commit 57017e3ace
6 changed files with 6 additions and 16 deletions

View File

@ -41,11 +41,11 @@ namespace libtorrent { namespace aux {
template <typename T, typename... Args>
#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>(args)...);
}
#endif

View File

@ -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

View File

@ -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<std::uint32_t, struct status_flags_tag>;

View File

@ -70,7 +70,7 @@ namespace detail {
namespace {
inline void TORRENT_NO_RETURN throw_error()
[[noreturn]] inline void throw_error()
{ aux::throw_ex<system_error>(errors::invalid_entry_type); }
template <class T>

View File

@ -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);
}

View File

@ -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];