From 0fef9583615435d41a7724b0c49f530433b4c572 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 18 Oct 2018 17:10:42 +0200 Subject: [PATCH] efi: rework OFFSETOF() based on __builtin_offsetof() Since both LLVM and gcc supported this for a long time, we are not adding a fallback compat kludge. And even if there's some relevant compiler that doesn't know this concept, it'll fail with a compiler error, and we'll fix it then. As suggested by @keszybz: https://github.com/systemd/systemd/pull/10174#discussion_r226266540 --- src/boot/efi/util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/boot/efi/util.h b/src/boot/efi/util.h index 40ede66d4a9..daa386b7696 100644 --- a/src/boot/efi/util.h +++ b/src/boot/efi/util.h @@ -5,7 +5,7 @@ #include #define ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0])) -#define OFFSETOF(x,y) ((UINTN) &(((x*)0)->y)) +#define OFFSETOF(x,y) __builtin_offsetof(x,y) static inline const CHAR16 *yes_no(BOOLEAN b) { return b ? L"yes" : L"no"; -- 2.47.3