From 9eb61809638db2d6cf4068b8509c46a4632b925c Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Tue, 7 Jul 2015 21:31:55 +0200 Subject: 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 Reviewed-on: http://review.coreboot.org/10827 Reviewed-by: Patrick Georgi Tested-by: build bot (Jenkins) --- src/include/stddef.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/include/stddef.h b/src/include/stddef.h index 3bbf914246..f87c65f089 100644 --- a/src/include/stddef.h +++ b/src/include/stddef.h @@ -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 -- cgit v1.2.3