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
This commit is contained in:
Lennart Poettering
2018-10-18 19:01:54 +02:00
parent 849d653a4e
commit 0fef958361
+1 -1
View File
@@ -5,7 +5,7 @@
#include <efilib.h>
#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";