diff options
author | Coly Li <colyli@suse.de> | 2020-08-16 23:57:56 +0800 |
---|---|---|
committer | Coly Li <colyli@suse.de> | 2020-08-17 20:01:08 +0800 |
commit | 1129319af1cb5ec0cd38b283a4a3d14e55d616c7 (patch) | |
tree | 576a26edb31a37442f5677d6bd38f28ba98d7c8f | |
parent | 45d1412ee834b062a03b42596ee945d9916d3242 (diff) | |
download | bcache-tools-1129319af1cb5ec0cd38b283a4a3d14e55d616c7.tar.gz |
bcache-tools: list.h: only define offsetof() when it is undefined
For new gcc headers, offsetof() is defined, the definition in list.h
will be warned as redefined.
This patch checks whether offsetof() is defined, and only defines local
version of offsetof() when it is not defined by gcc headers.
Signed-off-by: Coly Li <colyli@suse.de>
-rw-r--r-- | list.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -25,10 +25,12 @@ */ /*@{*/ +#ifndef offsetof /** * Get offset of a member */ #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#endif /* offsetof*/ /** * Casts a member of a structure out to the containing structure |