From 1113e50796315a2aaaf768a243e3788cdb4aac78 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 14 Apr 2023 13:55:31 +0900 Subject: tree-wide: replace __alignof__() with alignof() Addresses https://github.com/systemd/systemd/pull/27254#discussion_r1165267046. --- src/fundamental/macro-fundamental.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/fundamental') 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 +#include #include #include #include #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; \ }) -- cgit v1.2.1