stddef.h: Disable check_member() macro when compiling with CLANG
CLANG assumes that _Static_assert() is a C++11 only feature and errs out when encountering the check_member macro complaining about a reinterpret_cast. Change-Id: Id8c6b47b4f5716e6184aec9e0bc4b0e1c7aaf17c Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-on: http://review.coreboot.org/10827 Reviewed-by: Patrick Georgi <pgeorgi@google.com> Tested-by: build bot (Jenkins)
This commit is contained in:
parent
0fa5d8f219
commit
9eb6180963
|
@ -32,9 +32,13 @@ typedef unsigned int wint_t;
|
|||
|
||||
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
||||
|
||||
#if !defined(__clang__)
|
||||
#define check_member(structure, member, offset) _Static_assert( \
|
||||
offsetof(struct structure, member) == offset, \
|
||||
"`struct " #structure "` offset for `" #member "` is not " #offset )
|
||||
#else
|
||||
#define check_member(structure, member, offset)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* container_of - cast a member of a structure out to the containing structure
|
||||
|
|
Loading…
Reference in New Issue