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

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/pools/poolstat/poolstat.c
          +++ new/usr/src/cmd/pools/poolstat/poolstat.c
↓ open down ↓ 39 lines elided ↑ open up ↑
  40   40  #include "utils.h"
  41   41  #include "poolstat.h"
  42   42  #include "poolstat_utils.h"
  43   43  #include "statcommon.h"
  44   44  
  45   45  #ifndef TEXT_DOMAIN
  46   46  #define TEXT_DOMAIN     "SYS_TEST"
  47   47  #endif
  48   48  
  49   49  /* calculate offset of a particular element in a structure      */
       50 +#if defined(__GNUC__)
       51 +#define offsetof(s, m)  __builtin_offsetof(s, m)
       52 +#else
  50   53  #define offsetof(s, m)  ((size_t)(&(((s *)0)->m)))
       54 +#endif
  51   55  #define addrof(s)  ((char **)&(s))
  52   56  
  53   57  /* verify if a field is printable in respect of the current option flags */
  54   58  #define PRINTABLE(i)    ((lf->plf_ffs[(i)].pff_prt & D_FIELD) || \
  55   59          (lf->plf_ffs[(i)].pff_prt & X_FIELD))
  56   60  
  57   61  typedef int (* formatter) (char *, int, int, poolstat_field_format_t *, char *);
  58   62  
  59   63  static uint_t timestamp_fmt = NODATE;
  60   64  
↓ open down ↓ 965 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX