From 53c2210a1be59d1a3b0d8a2dfc4d7d4d7e8a128b Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 10 May 2017 12:29:47 +1000 Subject: [PATCH] util: drop GCC specifics for container_of MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit clang supports __typeof__ which was the only real difference. Not sure any other compilers matter (that don't support __typeof__) Signed-off-by: Peter Hutterer Reviewed-by: Armin Krezović Tested-by: Armin Krezović Reviewed-by: Eric Engestrom (cherry picked from commit 89490d2b344c671721744d7cd4c3a98d14fcfee3) --- src/libinput-util.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/libinput-util.h b/src/libinput-util.h index 66fd336f..392797d9 100644 --- a/src/libinput-util.h +++ b/src/libinput-util.h @@ -70,15 +70,9 @@ void list_insert(struct list *list, struct list *elm); void list_remove(struct list *elm); bool list_empty(const struct list *list); -#ifdef __GNUC__ #define container_of(ptr, sample, member) \ (__typeof__(sample))((char *)(ptr) - \ ((char *)&(sample)->member - (char *)(sample))) -#else -#define container_of(ptr, sample, member) \ - (void *)((char *)(ptr) - \ - ((char *)&(sample)->member - (char *)(sample))) -#endif #define list_for_each(pos, head, member) \ for (pos = 0, pos = container_of((head)->next, pos, member); \