Mail Archives: djgpp-workers/2000/05/17/10:48:25
> From: Laurynas Biveinis <lauras AT softhome DOT net>
>
> 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 <stdio.h>,
> and according to ANSI, offsetof lives in <stddef.h>.
>
> This patch includes <stddef.h> (if configure script has found it)
> before offsetof and NULL fallback definitions.
>
> 2000-05-17 Laurynas Biveinis <lauras AT softhome DOT net>
>
> * system.h: #include <stddef.h> 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__ */
- Raw text -