From 138dd3f16df9c628469b963b1f119750702ff1af Mon Sep 17 00:00:00 2001 From: Bjoern Doebel Date: Fri, 20 Nov 2020 15:35:11 +0100 Subject: [PATCH] compiler.h: Remove extra parentheses in call to memberof() When switching to `-nostdinc -nostdlib` we are going to start using local defintions of those macros that we apparently did not use before. I found a bug in the implementation of `offsetof` that leads to a compile time error and is fixed by removing the parentheses around the type parameter. Signed-off-by: Bjoern Doebel --- include/compiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/compiler.h b/include/compiler.h index 73b47de8..5f05af0d 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -94,7 +94,7 @@ typedef uint64_t off_t; #define memberof(type, member) (((type *) 0)->member) #ifndef offsetof -#define offsetof(type, member) ((off_t) &memberof((type), member)) +#define offsetof(type, member) ((off_t) &memberof(type, member)) #endif #define BUILD_BUG_ON(cond) ({ _Static_assert(!(cond), "!(" STR(cond) ")"); })