From 0a817e84ec5a86782cd20c8225c742eae6cdb904 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Wed, 16 May 2018 22:24:38 -0700 Subject: [PATCH] util: squelch clang cast alignment warning caused by container_of() --- src/util.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util.h b/src/util.h index 20e5627..ee6a1b7 100644 --- a/src/util.h +++ b/src/util.h @@ -3,6 +3,7 @@ #include #include +#include #include "internal.h" @@ -12,8 +13,10 @@ typedef intptr_t ssize_t; #define array_count(a) (sizeof(a) / (sizeof((a)[0]))) +/* clang-format off */ #define container_of(ptr, type, member) \ - ((type*) ((char*) (ptr) -offsetof(type, member))) + ((type*) ((uintptr_t) (ptr) - offsetof(type, member))) +/* clang-format on */ #define unused_var(v) ((void) (v))