Print this page
3373 gcc >= 4.5 concerns about offsetof()

@@ -21,12 +21,10 @@
 /*
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident   "%Z%%M% %I%     %E% SMI"
-
 #include <meta.h>
 #include <assert.h>
 #include <ctype.h>
 #include <mdiox.h>
 #include <meta.h>

@@ -159,11 +157,15 @@
  * MAXSIZEMDRECNAME is the value that has historically been used to allocate
  * space for the metadevice name
  */
 #define MAXSIZEMDRECNAME        20
 #define NAMEWIDTH               16
+#if defined(__GNUC__)
+#define offsetof(s, m)  __builtin_offsetof(s, m)
+#else
 #define offsetof(s, m)  ((size_t)(&(((s *)0)->m)))
+#endif
 #define NOT_PHYSICAL_DEV        0
 #define PHYSICAL_DEV            1
 
 
 /*