diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-04-14 06:55:31 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-04-14 07:39:06 +0200 |
commit | 1113e50796315a2aaaf768a243e3788cdb4aac78 (patch) | |
tree | d36eb1d9c1294828069085c5fb84a90650847c2f /src/fundamental | |
parent | socket-util: add one missing paren (diff) | |
download | systemd-1113e50796315a2aaaf768a243e3788cdb4aac78.tar.xz systemd-1113e50796315a2aaaf768a243e3788cdb4aac78.zip |
tree-wide: replace __alignof__() with alignof()
Addresses https://github.com/systemd/systemd/pull/27254#discussion_r1165267046.
Diffstat (limited to 'src/fundamental')
-rw-r--r-- | src/fundamental/macro-fundamental.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/fundamental/macro-fundamental.h b/src/fundamental/macro-fundamental.h index fa5b5d221a..e901e8fb59 100644 --- a/src/fundamental/macro-fundamental.h +++ b/src/fundamental/macro-fundamental.h @@ -6,12 +6,13 @@ #endif #include <limits.h> +#include <stdalign.h> #include <stdbool.h> #include <stddef.h> #include <stdint.h> #define _align_(x) __attribute__((__aligned__(x))) -#define _alignas_(x) __attribute__((__aligned__(__alignof__(x)))) +#define _alignas_(x) __attribute__((__aligned__(alignof(x)))) #define _alignptr_ __attribute__((__aligned__(sizeof(void *)))) #define _cleanup_(x) __attribute__((__cleanup__(x))) #define _const_ __attribute__((__const__)) @@ -343,9 +344,9 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) { #define ALIGN_PTR(p) ((void*) ALIGN((uintptr_t) (p))) /* Checks if the specified pointer is aligned as appropriate for the specific type */ -#define IS_ALIGNED16(p) (((uintptr_t) p) % __alignof__(uint16_t) == 0) -#define IS_ALIGNED32(p) (((uintptr_t) p) % __alignof__(uint32_t) == 0) -#define IS_ALIGNED64(p) (((uintptr_t) p) % __alignof__(uint64_t) == 0) +#define IS_ALIGNED16(p) (((uintptr_t) p) % alignof(uint16_t) == 0) +#define IS_ALIGNED32(p) (((uintptr_t) p) % alignof(uint32_t) == 0) +#define IS_ALIGNED64(p) (((uintptr_t) p) % alignof(uint64_t) == 0) /* Same as ALIGN_TO but callable in constant contexts. */ #define CONST_ALIGN_TO(l, ali) \ @@ -363,7 +364,7 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) { #define CAST_ALIGN_PTR(t, p) \ ({ \ const void *_p = (p); \ - assert(((uintptr_t) _p) % __alignof__(t) == 0); \ + assert(((uintptr_t) _p) % alignof(t) == 0); \ (t *) _p; \ }) |