Print this page
3373 gcc >= 4.5 concerns about offsetof()
@@ -45,11 +45,15 @@
#ifndef TEXT_DOMAIN
#define TEXT_DOMAIN "SYS_TEST"
#endif
/* calculate offset of a particular element in a structure */
+#if defined(__GNUC__)
+#define offsetof(s, m) __builtin_offsetof(s, m)
+#else
#define offsetof(s, m) ((size_t)(&(((s *)0)->m)))
+#endif
#define addrof(s) ((char **)&(s))
/* verify if a field is printable in respect of the current option flags */
#define PRINTABLE(i) ((lf->plf_ffs[(i)].pff_prt & D_FIELD) || \
(lf->plf_ffs[(i)].pff_prt & X_FIELD))