From 0615af6f4748e4f7dc6a4f034a9db636742cc3bd Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Thu, 21 Nov 2024 23:51:38 -0700 Subject: Use C23 (C++11) attribute syntax instead of __attribute__ --- libmisc/include/libmisc/assert.h | 7 +++---- libmisc/include/libmisc/log.h | 3 +-- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'libmisc/include') 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) -- cgit v1.2.3-2-g168b