Print this page
3373 gcc >= 4.5 concerns about offsetof()
*** 25,36 ****
*/
#ifndef _MISC_H
#define _MISC_H
- #pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/time.h>
#include <thread.h>
#include <pthread.h>
#include <stdarg.h>
--- 25,34 ----
*** 48,58 ****
--- 46,60 ----
* various utility functions
* These are globally implemented.
*/
#undef offsetof
+ #if defined(__GNUC__)
+ #define offsetof(s, m) __builtin_offsetof(s, m)
+ #else
#define offsetof(s, m) ((size_t)(&(((s *)0)->m)))
+ #endif
/*
* a safe printf -- do not use for error messages.
*/
void debug_printf(const char *format, ...);