From a5ba0f4e08b0a589a5c061a43f590bd823fe1e1c Mon Sep 17 00:00:00 2001
From: kan <kan@FreeBSD.org>
Date: Thu, 21 Sep 2006 01:38:58 +0000
Subject: [PATCH] Use __builtin_offsetof for GCC 4.1.

---
 sys/sys/cdefs.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index 544338c73f0a..d7dff1f2be55 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -304,6 +304,9 @@
  * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
  * require it.
  */
+#if __GNUC_PREREQ__(4, 1)
+#define __offsetof(type, field)	 __builtin_offsetof(type, field)
+#else
 #ifndef __cplusplus
 #define	__offsetof(type, field)	((size_t)(&((type *)0)->field))
 #else
@@ -312,6 +315,7 @@
                  (&reinterpret_cast <const volatile char &>	\
                   (static_cast<type *> (0)->field))))
 #endif
+#endif
 #define	__rangeof(type, start, end) \
 	(__offsetof(type, end) - __offsetof(type, start))