Print this page
3373 gcc >= 4.5 concerns about offsetof()
*** 24,35 ****
*/
#ifndef _SA_STDDEF_H
#define _SA_STDDEF_H
- #pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Exported interfaces for standalone's subset of libc's <stddef.h>.
* All standalone code *must* use this header rather than libc's.
*/
--- 24,33 ----
*** 40,50 ****
#ifndef NULL
#define NULL 0
#endif
#ifndef offsetof
! #define offsetof(s, m) (size_t)(&(((s *)0)->m))
#endif
#ifdef __cplusplus
}
#endif
--- 38,52 ----
#ifndef NULL
#define NULL 0
#endif
#ifndef offsetof
! #if defined(__GNUC__)
! #define offsetof(s, m) __builtin_offsetof(s, m)
! #else
! #define offsetof(s, m) ((size_t)(&(((s *)0)->m)))
! #endif
#endif
#ifdef __cplusplus
}
#endif