summaryrefslogtreecommitdiff
path: root/libmisc/include
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-21 23:51:38 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-23 13:56:38 -0700
commit0615af6f4748e4f7dc6a4f034a9db636742cc3bd (patch)
treea0c09720ca4c8670869b56d03e57431b46073f75 /libmisc/include
parent3064cb13577edd31d3a3ceb79b2bc72314ec208b (diff)
Use C23 (C++11) attribute syntax instead of __attribute__
Diffstat (limited to 'libmisc/include')
-rw-r--r--libmisc/include/libmisc/assert.h7
-rw-r--r--libmisc/include/libmisc/log.h3
2 files changed, 4 insertions, 6 deletions
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)