diff options
Diffstat (limited to 'libmisc')
-rw-r--r-- | libmisc/assert.c | 2 | ||||
-rw-r--r-- | libmisc/include/libmisc/assert.h | 7 | ||||
-rw-r--r-- | libmisc/include/libmisc/log.h | 3 | ||||
-rw-r--r-- | libmisc/tests/test_assert.c | 2 |
4 files changed, 6 insertions, 8 deletions
diff --git a/libmisc/assert.c b/libmisc/assert.c index 456ac24..8231c85 100644 --- a/libmisc/assert.c +++ b/libmisc/assert.c @@ -13,7 +13,7 @@ #include <libmisc/assert.h> #ifndef NDEBUG -__attribute__((noreturn, weak)) +[[noreturn, gnu::weak]] void __assert_msg_fail(const char *expr, const char *file, unsigned int line, const char *func, const char *msg) { diff --git a/libmisc/include/libmisc/assert.h b/libmisc/include/libmisc/assert.h index 92b9a51..da2ba2b 100644 --- a/libmisc/include/libmisc/assert.h +++ b/libmisc/include/libmisc/assert.h @@ -11,10 +11,9 @@ # define __assert_msg(expr, expr_str, msg) ((void)0) #else # define __assert_msg(expr, expr_str, msg) do { if (!(expr)) __assert_msg_fail(expr_str, __FILE__, __LINE__, __func__, msg); } while (0) -__attribute__((noreturn)) void -__assert_msg_fail(const char *expr, - const char *file, unsigned int line, const char *func, - const char *msg); +[[noreturn]] void __assert_msg_fail(const char *expr, + const char *file, unsigned int line, const char *func, + const char *msg); #endif #define assert_msg(expr, msg) __assert_msg(expr, #expr, msg) /* libmisc */ diff --git a/libmisc/include/libmisc/log.h b/libmisc/include/libmisc/log.h index 85b2201..37da20b 100644 --- a/libmisc/include/libmisc/log.h +++ b/libmisc/include/libmisc/log.h @@ -21,8 +21,7 @@ #define __LOG_CAT3(a, b, c) a ## b ## c #define _LOG_CAT3(a, b, c) __LOG_CAT3(a, b, c) -__attribute__((format(printf, 1, 2))) -int _log_printf(const char *format, ...); +[[format(printf, 1, 2)]] int _log_printf(const char *format, ...); #define errorf(fmt, ...) do { _log_printf("error: " _LOG_STR(LOG_NAME) ": " fmt "\n" __VA_OPT__(,) __VA_ARGS__); } while (0) #define infof(fmt, ...) do { _log_printf("info : " _LOG_STR(LOG_NAME) ": " fmt "\n" __VA_OPT__(,) __VA_ARGS__); } while (0) diff --git a/libmisc/tests/test_assert.c b/libmisc/tests/test_assert.c index a2ac743..5b28561 100644 --- a/libmisc/tests/test_assert.c +++ b/libmisc/tests/test_assert.c @@ -29,7 +29,7 @@ jmp_buf global_env; setjmp(global_env) == 0; \ }) -__attribute__((noreturn)) void abort(void) { +[[noreturn]] void abort(void) { global_failed = true; longjmp(global_env, 1); } |