From d1f061dee88d2ea01601d6d2742635c66985ca61 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Sun, 16 Jun 2019 12:16:18 -0700 Subject: [PATCH] Don't use statement expressions on non-GNU compilers --- include/list.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/list.h b/include/list.h index 5d86b131..7108cea7 100644 --- a/include/list.h +++ b/include/list.h @@ -5,9 +5,14 @@ #include +#ifdef __GNUC__ #define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) +#else +#define container_of(ptr, type, member) ( \ + (type *)( (char *)(ptr) - offsetof(type,member) )) +#endif struct list_head { struct list_head *next, *prev; -- 2.20.1