aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColy Li <colyli@suse.de>2020-08-16 23:57:56 +0800
committerColy Li <colyli@suse.de>2020-08-17 20:01:08 +0800
commit1129319af1cb5ec0cd38b283a4a3d14e55d616c7 (patch)
tree576a26edb31a37442f5677d6bd38f28ba98d7c8f
parent45d1412ee834b062a03b42596ee945d9916d3242 (diff)
downloadbcache-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.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/list.h b/list.h
index 55d2bb4d..458281d3 100644
--- a/list.h
+++ b/list.h
@@ -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