BUILD/MINOR: compiler: fix offsetof() on older compilers
authorWilly Tarreau <w@1wt.eu>
Mon, 30 Jul 2018 09:47:35 +0000 (11:47 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 30 Jul 2018 09:49:35 +0000 (11:49 +0200)
An offsetof() macro was introduced with commit 928fbfa ("MINOR: compiler:
introduce offsetoff().") with a fallback for older compilers. But this
breaks gcc 3.4 because __size_t and __uintptr_t are not defined there.
However size_t and uintptr_t are, so let's fix it this way. No backport
needed.

include/common/compiler.h

index 125c473..ad99694 100644 (file)
 #define offsetof(type, field)  __builtin_offsetof(type, field)
 #else
 #define offsetof(type, field) \
-        ((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->field))
+        ((size_t)(uintptr_t)((const volatile void *)&((type *)0)->field))
 #endif
 #endif