[PATCH 3/8] bcache-tools: list.h: only define offsetof() when it is undefined

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 list.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/list.h b/list.h
index 55d2bb4..458281d 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
-- 
2.26.2




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux