Print this page
3373 gcc >= 4.5 concerns about offsetof()
Portions contributed by: Igor Pashev <pashev.igor@gmail.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/head/iso/stddef_iso.h
          +++ new/usr/src/head/iso/stddef_iso.h
↓ open down ↓ 72 lines elided ↑ open up ↑
  73   73  typedef unsigned long   size_t;         /* size of something in bytes */
  74   74  #else
  75   75  typedef unsigned int    size_t;         /* (historical version) */
  76   76  #endif
  77   77  #endif  /* !_SIZE_T */
  78   78  
  79   79  #if __cplusplus >= 199711L
  80   80  }
  81   81  #endif /* end of namespace std */
  82   82  
       83 +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
       84 +#define offsetof(s, m) __builtin_offsetof(s, m)
       85 +#else
  83   86  #if __cplusplus >= 199711L
  84   87  #define offsetof(s, m)  (std::size_t)(&(((s *)0)->m))
  85   88  #else
  86   89  #define offsetof(s, m)  (size_t)(&(((s *)0)->m))
  87   90  #endif
       91 +#endif  /* GNUC, etc. */
  88   92  
  89   93  #ifdef  __cplusplus
  90   94  }
  91   95  #endif
  92   96  
  93   97  #endif  /* _ISO_STDDEF_ISO_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX