Date: Wed, 17 May 2000 10:35:48 -0400 (EDT) From: "Kaveh R. Ghazi" Message-Id: <200005171435.KAA24872@caip.rutgers.edu> To: gcc-patches AT gcc DOT gnu DOT org, lauras AT softhome DOT net Subject: Re: Minor system.h patch Cc: djgpp-workers AT delorie DOT com Reply-To: djgpp-workers AT delorie DOT com > From: Laurynas Biveinis > > This kills warnings under DJGPP about 'offsetof' redefinition. > Current system.h defines its own offsetof macro only if it hasn't > been defined previously. But before that, it #includes just , > and according to ANSI, offsetof lives in . > > This patch includes (if configure script has found it) > before offsetof and NULL fallback definitions. > > 2000-05-17 Laurynas Biveinis > > * system.h: #include if HAVE_STDDEF_H defined. > It might be better to simply move the offsetof fallback definition to the end of system.h. We get stddef.h via libiberty.h, which is included in system.h. So there's no need to include stddef.h a second time IMHO. Does this patch fix the problem for you? --- system.h~ Wed May 17 10:12:37 2000 +++ system.h Wed May 17 10:12:48 2000 @@ -50,10 +50,6 @@ Boston, MA 02111-1307, USA. */ #define NULL 0 #endif -#ifndef offsetof -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#endif - /* The compiler is not a multi-threaded application and therefore we do not have to use the locking functions. @@ -581,5 +577,8 @@ extern void abort PARAMS ((void)); #define ENUM_BITFIELD(TYPE) unsigned int #endif +#ifndef offsetof +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#endif #endif /* __GCC_SYSTEM_H__ */