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

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libumem/common/misc.h
          +++ new/usr/src/lib/libumem/common/misc.h
↓ open down ↓ 19 lines elided ↑ open up ↑
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27   27  #ifndef _MISC_H
  28   28  #define _MISC_H
  29   29  
  30      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  31      -
  32   30  #include <sys/types.h>
  33   31  #include <sys/time.h>
  34   32  #include <thread.h>
  35   33  #include <pthread.h>
  36   34  #include <stdarg.h>
  37   35  
  38   36  #ifdef  __cplusplus
  39   37  extern "C" {
  40   38  #endif
  41   39  
↓ open down ↓ 1 lines elided ↑ open up ↑
  43   41  extern uint_t umem_output;              /* output error messages to stderr */
  44   42  extern caddr_t umem_min_stack;          /* max stack address for audit log */
  45   43  extern caddr_t umem_max_stack;          /* min stack address for audit log */
  46   44  
  47   45  /*
  48   46   * various utility functions
  49   47   * These are globally implemented.
  50   48   */
  51   49  
  52   50  #undef  offsetof
       51 +#if defined(__GNUC__)
       52 +#define offsetof(s, m)  __builtin_offsetof(s, m)
       53 +#else
  53   54  #define offsetof(s, m)  ((size_t)(&(((s *)0)->m)))
       55 +#endif
  54   56  
  55   57  /*
  56   58   * a safe printf  -- do not use for error messages.
  57   59   */
  58   60  void debug_printf(const char *format, ...);
  59   61  
  60   62  /*
  61   63   * adds a message to the log without writing it out.
  62   64   */
  63   65  void log_message(const char *format, ...);
↓ open down ↓ 78 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX