Print this page
3373 gcc >= 4.5 concerns about offsetof()
@@ -146,11 +146,15 @@
* Introduce an index into the list to speed up insert_into looking for the
* right position in the list. This index is an AVL tree of all the
* iodev_snapshot in the list.
*/
-#define offsetof(s, m) (size_t)(&(((s *)0)->m)) /* for avl_create */
+#if defined(__GNUC__)
+#define offsetof(s, m) __builtin_offsetof(s, m)
+#else
+#define offsetof(s, m) ((size_t)(&(((s *)0)->m))) /* for avl_create */
+#endif
static int
avl_iodev_cmp(const void* is1, const void* is2)
{
int c = iodev_cmp((struct iodev_snapshot *)is1,