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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/ecppvar.h
          +++ new/usr/src/uts/common/sys/ecppvar.h
↓ open down ↓ 19 lines elided ↑ open up ↑
  20   20   * CDDL HEADER END
  21   21   */
  22   22  /*
  23   23   * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27   27  #ifndef _SYS_ECPPVAR_H
  28   28  #define _SYS_ECPPVAR_H
  29   29  
  30      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  31      -
  32   30  #include <sys/note.h>
  33   31  
  34   32  #ifdef  __cplusplus
  35   33  extern "C" {
  36   34  #endif
  37   35  
  38   36  struct ecppunit;
  39   37  
  40   38  /*
  41   39   * Hardware-abstraction structure
↓ open down ↓ 464 lines elided ↑ open up ↑
 506  504                      (pp)->current_mode == ECPP_COMPAT_MODE))
 507  505  
 508  506  #define COMPAT_DMA(pp) (((pp)->io_mode == ECPP_DMA) &&          \
 509  507                      ((pp)->current_mode == ECPP_CENTRONICS ||   \
 510  508                      (pp)->current_mode == ECPP_COMPAT_MODE))
 511  509  
 512  510  /*
 513  511   * Other useful macros
 514  512   */
 515  513  #define NELEM(a)        (sizeof (a) / sizeof (*(a)))
      514 +#if defined(__GNUC__)
      515 +#define offsetof(s, m)  __builtin_offsetof(s, m)
      516 +#else
 516  517  #define offsetof(s, m)  ((size_t)(&(((s *)0)->m)))
      518 +#endif
 517  519  
 518  520  #ifdef  __cplusplus
 519  521  }
 520  522  #endif
 521  523  
 522  524  #endif  /* _SYS_ECPPVAR_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX