summaryrefslogtreecommitdiff
path: root/lib9p/internal.h
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 /lib9p/internal.h
parent3064cb13577edd31d3a3ceb79b2bc72314ec208b (diff)
Use C23 (C++11) attribute syntax instead of __attribute__
Diffstat (limited to 'lib9p/internal.h')
-rw-r--r--lib9p/internal.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib9p/internal.h b/lib9p/internal.h
index 004660a..57f7aa7 100644
--- a/lib9p/internal.h
+++ b/lib9p/internal.h
@@ -38,9 +38,9 @@ static_assert(CONFIG_9P_MAX_HOSTMSG_SIZE <= SSIZE_MAX);
/* C language *****************************************************************/
-#define UNUSED(name) /* name __attribute__((unused)) */
-#define ALWAYS_INLINE inline __attribute__((always_inline))
-#define FLATTEN __attribute__((flatten))
+#define UNUSED(name)
+#define ALWAYS_INLINE [[gnu::always_inline]] inline
+#define FLATTEN [[gnu::flatten]]
#define ARRAY_LEN(arr) (sizeof(arr)/sizeof((arr)[0]))
#define CAT2(a, b) a##b
#define CAT3(a, b, c) a##b##c
@@ -99,22 +99,22 @@ bool _lib9p_marshal_stat(struct _marshal_ctx *ctx, struct lib9p_stat *val);
/* unmarshal utilities ********************************************************/
-static ALWAYS_INLINE uint8_t decode_u8le(uint8_t *in) {
+ALWAYS_INLINE static uint8_t decode_u8le(uint8_t *in) {
return in[0];
}
-static ALWAYS_INLINE uint16_t decode_u16le(uint8_t *in) {
+ALWAYS_INLINE static uint16_t decode_u16le(uint8_t *in) {
return (((uint16_t)(in[0])) << 0)
| (((uint16_t)(in[1])) << 8)
;
}
-static ALWAYS_INLINE uint32_t decode_u32le(uint8_t *in) {
+ALWAYS_INLINE static uint32_t decode_u32le(uint8_t *in) {
return (((uint32_t)(in[0])) << 0)
| (((uint32_t)(in[1])) << 8)
| (((uint32_t)(in[2])) << 16)
| (((uint32_t)(in[3])) << 24)
;
}
-static ALWAYS_INLINE uint64_t decode_u64le(uint8_t *in) {
+ALWAYS_INLINE static uint64_t decode_u64le(uint8_t *in) {
return (((uint64_t)(in[0])) << 0)
| (((uint64_t)(in[1])) << 8)
| (((uint64_t)(in[2])) << 16)
@@ -152,20 +152,20 @@ static inline bool _is_valid_utf8(uint8_t *str, size_t len, bool forbid_nul) {
/* marshal utilities **********************************************************/
-static ALWAYS_INLINE void encode_u8le(uint8_t in, uint8_t *out) {
+ALWAYS_INLINE static void encode_u8le(uint8_t in, uint8_t *out) {
out[0] = in;
}
-static ALWAYS_INLINE void encode_u16le(uint16_t in, uint8_t *out) {
+ALWAYS_INLINE static void encode_u16le(uint16_t in, uint8_t *out) {
out[0] = (uint8_t)((in >> 0) & 0xFF);
out[1] = (uint8_t)((in >> 8) & 0xFF);
}
-static ALWAYS_INLINE void encode_u32le(uint32_t in, uint8_t *out) {
+ALWAYS_INLINE static void encode_u32le(uint32_t in, uint8_t *out) {
out[0] = (uint8_t)((in >> 0) & 0xFF);
out[1] = (uint8_t)((in >> 8) & 0xFF);
out[2] = (uint8_t)((in >> 16) & 0xFF);
out[3] = (uint8_t)((in >> 24) & 0xFF);
}
-static ALWAYS_INLINE void encode_u64le(uint64_t in, uint8_t *out) {
+ALWAYS_INLINE static void encode_u64le(uint64_t in, uint8_t *out) {
out[0] = (uint8_t)((in >> 0) & 0xFF);
out[1] = (uint8_t)((in >> 8) & 0xFF);
out[2] = (uint8_t)((in >> 16) & 0xFF);