refactor: use C++'s [[noreturn]] atrribute (#1960)

This commit is contained in:
Charles Kerr 2021-10-14 22:16:52 -05:00 committed by GitHub
parent f0171668c6
commit c98b4d33c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 10 deletions

View File

@ -14,7 +14,7 @@
#if !defined(NDEBUG) || defined(TR_FORCE_ASSERTIONS)
bool tr_assert_report(char const* file, int line, char const* message_fmt, ...)
[[noreturn]] bool tr_assert_report(char const* file, int line, char const* message_fmt, ...)
{
va_list args;
va_start(args, message_fmt);

View File

@ -14,7 +14,7 @@
#include "tr-macros.h"
bool TR_NORETURN tr_assert_report(char const* file, int line, char const* message_fmt, ...) TR_GNUC_PRINTF(3, 4);
[[noreturn]] bool tr_assert_report(char const* file, int line, char const* message_fmt, ...) TR_GNUC_PRINTF(3, 4);
#define TR_ASSERT(x) ((void)(TR_LIKELY(x) || tr_assert_report(__FILE__, __LINE__, "%s", #x)))
#define TR_ASSERT_MSG(x, ...) ((void)(TR_LIKELY(x) || tr_assert_report(__FILE__, __LINE__, __VA_ARGS__)))

View File

@ -64,14 +64,6 @@
****
***/
#if __has_attribute(__noreturn__) || TR_GNUC_CHECK_VERSION(2, 5)
#define TR_NORETURN __attribute__((__noreturn__))
#elif defined(_MSC_VER)
#define TR_NORETURN __declspec(noreturn)
#else
#define TR_NORETURN
#endif
#if __has_attribute(__deprecated__) || TR_GNUC_CHECK_VERSION(3, 1)
#define TR_DEPRECATED __attribute__((__deprecated__))
#elif defined(_MSC_VER)