Author: emaste
Date: Mon Feb  8 18:37:10 2010
New Revision: 203674
URL: http://svn.freebsd.org/changeset/base/203674

Log:
  MFC r162488:
  
    Use __builtin_offsetof for GCC 4.1.
  
  Submitted by: Ryan Stone

Modified:
  stable/6/sys/sys/cdefs.h
Directory Properties:
  stable/6/sys/   (props changed)
  stable/6/sys/contrib/pf/   (props changed)
  stable/6/sys/dev/cxgb/   (props changed)

Modified: stable/6/sys/sys/cdefs.h
==============================================================================
--- stable/6/sys/sys/cdefs.h    Mon Feb  8 18:16:59 2010        (r203673)
+++ stable/6/sys/sys/cdefs.h    Mon Feb  8 18:37:10 2010        (r203674)
@@ -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))
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to