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


  30 #include <unistd.h>
  31 #include <stdlib.h>
  32 #include <unistd.h>
  33 #include <locale.h>
  34 #include <string.h>
  35 #include <ctype.h>
  36 #include <limits.h>
  37 #include <errno.h>
  38 
  39 #include <pool.h>
  40 #include "utils.h"
  41 #include "poolstat.h"
  42 #include "poolstat_utils.h"
  43 #include "statcommon.h"
  44 
  45 #ifndef TEXT_DOMAIN
  46 #define TEXT_DOMAIN     "SYS_TEST"
  47 #endif
  48 
  49 /* calculate offset of a particular element in a structure      */



  50 #define offsetof(s, m)  ((size_t)(&(((s *)0)->m)))

  51 #define addrof(s)  ((char **)&(s))
  52 
  53 /* verify if a field is printable in respect of the current option flags */
  54 #define PRINTABLE(i)    ((lf->plf_ffs[(i)].pff_prt & D_FIELD) || \
  55         (lf->plf_ffs[(i)].pff_prt & X_FIELD))
  56 
  57 typedef int (* formatter) (char *, int, int, poolstat_field_format_t *, char *);
  58 
  59 static uint_t timestamp_fmt = NODATE;
  60 
  61 /* available field formatters   */
  62 static int default_f(char *, int, int, poolstat_field_format_t *, char *);
  63 static int bigno_f(char *, int, int, poolstat_field_format_t *, char *);
  64 static int used_stat_f(char *, int, int, poolstat_field_format_t *, char *);
  65 static int header_f(char *, int, int, poolstat_field_format_t *, char *);
  66 
  67 /* statistics bags used to collect data from various provider   */
  68 static statistic_bag_t  pool_sbag_s;
  69 static statistic_bag_t  pset_sbag_s;
  70 static statistic_bag_t  *pool_sbag = &pool_sbag_s;




  30 #include <unistd.h>
  31 #include <stdlib.h>
  32 #include <unistd.h>
  33 #include <locale.h>
  34 #include <string.h>
  35 #include <ctype.h>
  36 #include <limits.h>
  37 #include <errno.h>
  38 
  39 #include <pool.h>
  40 #include "utils.h"
  41 #include "poolstat.h"
  42 #include "poolstat_utils.h"
  43 #include "statcommon.h"
  44 
  45 #ifndef TEXT_DOMAIN
  46 #define TEXT_DOMAIN     "SYS_TEST"
  47 #endif
  48 
  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
  53 #define offsetof(s, m)  ((size_t)(&(((s *)0)->m)))
  54 #endif
  55 #define addrof(s)  ((char **)&(s))
  56 
  57 /* verify if a field is printable in respect of the current option flags */
  58 #define PRINTABLE(i)    ((lf->plf_ffs[(i)].pff_prt & D_FIELD) || \
  59         (lf->plf_ffs[(i)].pff_prt & X_FIELD))
  60 
  61 typedef int (* formatter) (char *, int, int, poolstat_field_format_t *, char *);
  62 
  63 static uint_t timestamp_fmt = NODATE;
  64 
  65 /* available field formatters   */
  66 static int default_f(char *, int, int, poolstat_field_format_t *, char *);
  67 static int bigno_f(char *, int, int, poolstat_field_format_t *, char *);
  68 static int used_stat_f(char *, int, int, poolstat_field_format_t *, char *);
  69 static int header_f(char *, int, int, poolstat_field_format_t *, char *);
  70 
  71 /* statistics bags used to collect data from various provider   */
  72 static statistic_bag_t  pool_sbag_s;
  73 static statistic_bag_t  pset_sbag_s;
  74 static statistic_bag_t  *pool_sbag = &pool_sbag_s;