From c5652bffcbe441880474a8f6c01bccd4d5b0d577 Mon Sep 17 00:00:00 2001 From: John Gilmore Date: Fri, 17 Sep 1993 09:08:00 +0000 Subject: [PATCH] Make sure that "offsetof" is defined on all hosts, now that archive.c uses it. --- bfd/hosts/alphaosf.h | 2 ++ bfd/hosts/amix.h | 7 ++++++- bfd/hosts/apollo68.h | 9 +++++++-- bfd/hosts/apollov68.h | 9 +++++++-- bfd/hosts/delta88.h | 7 ++++++- bfd/hosts/dgux.h | 7 ++++++- bfd/hosts/dose.h | 3 ++- bfd/hosts/go32.h | 3 ++- bfd/hosts/harris.h | 7 ++++++- bfd/hosts/hp300.h | 3 ++- bfd/hosts/hppabsd.h | 5 +++-- bfd/hosts/hppahpux.h | 7 ++++--- bfd/hosts/i386aix.h | 7 ++++++- bfd/hosts/i386lynx.h | 9 +++++++-- bfd/hosts/i386v.h | 11 ++++++++--- bfd/hosts/i386v4.h | 7 ++++++- bfd/hosts/irix3.h | 5 +++++ bfd/hosts/irix4.h | 5 +++++ bfd/hosts/ncr3000.h | 7 ++++++- bfd/hosts/rs6000.h | 3 ++- bfd/hosts/rtbsd.h | 7 ++++++- bfd/hosts/solaris2.h | 2 +- bfd/hosts/sparc-ll.h | 9 +++++---- bfd/hosts/std-host.h | 24 ++++++++++++++++-------- bfd/hosts/stratus.h | 7 ++++++- bfd/hosts/sun3.h | 9 +++++++-- bfd/hosts/sysv4.h | 3 ++- bfd/hosts/ultra3.h | 7 ++++++- bfd/hosts/we32k.h | 9 +++++++-- 29 files changed, 154 insertions(+), 46 deletions(-) diff --git a/bfd/hosts/alphaosf.h b/bfd/hosts/alphaosf.h index ab66873..cbb5ac2 100644 --- a/bfd/hosts/alphaosf.h +++ b/bfd/hosts/alphaosf.h @@ -1,3 +1,4 @@ +#include #include #include #include @@ -20,4 +21,5 @@ typedef long int64_type; #define uint64_typeLOW(x) (((x) & 0xffffffff)) #define uint64_typeHIGH(x) (((x) >> 32) & 0xffffffff) + #include "fopen-same.h" diff --git a/bfd/hosts/amix.h b/bfd/hosts/amix.h index 16d2bfe..a2b072e 100644 --- a/bfd/hosts/amix.h +++ b/bfd/hosts/amix.h @@ -10,7 +10,7 @@ #include #include -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif #define SEEK_SET 0 @@ -48,3 +48,8 @@ extern int fputc(); extern int unlink(); #include "fopen-same.h" + +/* From ANSI C , which we can't depend upon the existence of */ +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) +#endif diff --git a/bfd/hosts/apollo68.h b/bfd/hosts/apollo68.h index eb14ad8..f644986 100644 --- a/bfd/hosts/apollo68.h +++ b/bfd/hosts/apollo68.h @@ -6,7 +6,7 @@ #include #include #include -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif #ifndef SEEK_SET @@ -18,10 +18,15 @@ #define MAXPATHLEN 1024 #endif /* MAXPATHLEN */ -#ifndef DONTDECLARE_MALLOC +#ifndef DONTDECLARE_MALLOC extern PTR malloc PARAMS ((unsigned)); extern PTR realloc PARAMS ((PTR, unsigned)); extern void free PARAMS ((PTR)); #endif #include "fopen-same.h" + +/* From ANSI C , which we can't depend upon the existence of */ +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) +#endif diff --git a/bfd/hosts/apollov68.h b/bfd/hosts/apollov68.h index 3c4c6d9..27580ea 100644 --- a/bfd/hosts/apollov68.h +++ b/bfd/hosts/apollov68.h @@ -7,7 +7,7 @@ #include #include #include -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif #define SEEK_SET 0 @@ -29,10 +29,15 @@ #include -#ifndef DONTDECLARE_MALLOC +#ifndef DONTDECLARE_MALLOC extern PTR malloc PARAMS ((unsigned)); extern PTR realloc PARAMS ((PTR, unsigned)); extern void free PARAMS ((PTR)); #endif #include "fopen-same.h" + +/* From ANSI C , which we can't depend upon the existence of */ +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) +#endif diff --git a/bfd/hosts/delta88.h b/bfd/hosts/delta88.h index a7a038f..2e9f632 100644 --- a/bfd/hosts/delta88.h +++ b/bfd/hosts/delta88.h @@ -13,7 +13,7 @@ #define USE_UTIME -#ifndef DONTDECLARE_MALLOC +#ifndef DONTDECLARE_MALLOC extern PTR malloc PARAMS ((unsigned)); extern PTR realloc PARAMS ((PTR, unsigned)); #endif @@ -82,3 +82,8 @@ extern int unlink(); #include "fopen-same.h" + +/* From ANSI C , which we can't depend upon the existence of */ +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) +#endif diff --git a/bfd/hosts/dgux.h b/bfd/hosts/dgux.h index ff0573f..c424a50 100644 --- a/bfd/hosts/dgux.h +++ b/bfd/hosts/dgux.h @@ -12,7 +12,7 @@ #include -#ifndef DONTDECLARE_MALLOC +#ifndef DONTDECLARE_MALLOC extern PTR malloc PARAMS ((unsigned)); extern PTR realloc PARAMS ((PTR, unsigned)); #endif @@ -27,3 +27,8 @@ extern int strtol(); #include "fopen-same.h" + +/* From ANSI C , which we can't depend upon the existence of */ +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) +#endif diff --git a/bfd/hosts/dose.h b/bfd/hosts/dose.h index 5b2f24f..b01cc88 100644 --- a/bfd/hosts/dose.h +++ b/bfd/hosts/dose.h @@ -1,3 +1,4 @@ +#include #include #include #include @@ -6,7 +7,7 @@ #include #include #include -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif #define SEEK_SET 0 diff --git a/bfd/hosts/go32.h b/bfd/hosts/go32.h index 2c71b2e..7e1af18 100644 --- a/bfd/hosts/go32.h +++ b/bfd/hosts/go32.h @@ -1,3 +1,4 @@ +#include #include #include #include @@ -7,7 +8,7 @@ #include #include #include -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif #define SEEK_SET 0 diff --git a/bfd/hosts/harris.h b/bfd/hosts/harris.h index 26ab4a6..82750d4 100644 --- a/bfd/hosts/harris.h +++ b/bfd/hosts/harris.h @@ -11,7 +11,7 @@ #include -#ifndef DONTDECLARE_MALLOC +#ifndef DONTDECLARE_MALLOC extern PTR malloc PARAMS ((unsigned)); extern PTR realloc PARAMS ((PTR, unsigned)); #endif @@ -24,3 +24,8 @@ extern void bzero PARAMS ((char *, int)); extern int strtol(); #include "fopen-same.h" + +/* From ANSI C , which we can't depend upon the existence of */ +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) +#endif diff --git a/bfd/hosts/hp300.h b/bfd/hosts/hp300.h index 525ca8e..e1bbaa4 100644 --- a/bfd/hosts/hp300.h +++ b/bfd/hosts/hp300.h @@ -1,3 +1,4 @@ +#include #include #include #include @@ -6,7 +7,7 @@ #include #include #include -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif #define SEEK_SET 0 diff --git a/bfd/hosts/hppabsd.h b/bfd/hosts/hppabsd.h index ad9660e..4abc594 100644 --- a/bfd/hosts/hppabsd.h +++ b/bfd/hosts/hppabsd.h @@ -1,6 +1,7 @@ -#ifndef _HPPABSD_H +#ifndef _HPPABSD_H #define _HPPABSD_H +#include #include #include #include @@ -14,7 +15,7 @@ #define HOST_HPPABSD -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif diff --git a/bfd/hosts/hppahpux.h b/bfd/hosts/hppahpux.h index e36ed9b..a0cc696 100644 --- a/bfd/hosts/hppahpux.h +++ b/bfd/hosts/hppahpux.h @@ -1,6 +1,7 @@ -#ifndef _HPPAHPUX_H +#ifndef _HPPAHPUX_H #define _HPPAHPUX_H +#include #include #include #include @@ -16,13 +17,13 @@ void free(); -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif #define SEEK_SET 0 #define SEEK_CUR 1 -#ifndef __STDC__ +#ifndef __STDC__ #define NATIVE_HPPAHPUX_COMPILER #endif diff --git a/bfd/hosts/i386aix.h b/bfd/hosts/i386aix.h index 1566694..c09968a 100644 --- a/bfd/hosts/i386aix.h +++ b/bfd/hosts/i386aix.h @@ -12,7 +12,7 @@ #include #include -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif #define SEEK_SET 0 @@ -46,3 +46,8 @@ extern int fputc(); extern int unlink(); #include "fopen-same.h" + +/* From ANSI C , which we can't depend upon the existence of */ +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) +#endif diff --git a/bfd/hosts/i386lynx.h b/bfd/hosts/i386lynx.h index 971c39c..59adeff 100644 --- a/bfd/hosts/i386lynx.h +++ b/bfd/hosts/i386lynx.h @@ -1,6 +1,6 @@ /* Intel 386 running any BSD Unix */ -#ifndef hosts_i386bsd_H +#ifndef hosts_i386bsd_H #include #include #include @@ -11,7 +11,7 @@ #include #include -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif @@ -28,3 +28,8 @@ #define hosts_i386bsd_H #undef I386 /* Lynx defines this for some reason */ #endif + +/* From ANSI C , which we can't depend upon the existence of */ +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) +#endif diff --git a/bfd/hosts/i386v.h b/bfd/hosts/i386v.h index 2d2c8ee..5954a94 100644 --- a/bfd/hosts/i386v.h +++ b/bfd/hosts/i386v.h @@ -8,10 +8,10 @@ #include #include -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif -#ifndef SEEK_SET +#ifndef SEEK_SET #define SEEK_SET 0 #define SEEK_CUR 1 #endif @@ -28,10 +28,15 @@ #include -#ifndef DONTDECLARE_MALLOC +#ifndef DONTDECLARE_MALLOC extern PTR malloc PARAMS ((unsigned)); extern PTR realloc PARAMS ((PTR, unsigned)); extern void free PARAMS ((PTR)); #endif #include "fopen-same.h" + +/* From ANSI C , which we can't depend upon the existence of */ +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) +#endif diff --git a/bfd/hosts/i386v4.h b/bfd/hosts/i386v4.h index ad4c077..1f46db5 100644 --- a/bfd/hosts/i386v4.h +++ b/bfd/hosts/i386v4.h @@ -10,7 +10,7 @@ #include #include -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif #define SEEK_SET 0 @@ -48,3 +48,8 @@ extern int fputc(); extern int unlink(); #include "fopen-same.h" + +/* From ANSI C , which we can't depend upon the existence of */ +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) +#endif diff --git a/bfd/hosts/irix3.h b/bfd/hosts/irix3.h index caa7901..4672530 100644 --- a/bfd/hosts/irix3.h +++ b/bfd/hosts/irix3.h @@ -23,3 +23,8 @@ #endif #include "fopen-same.h" + +/* From ANSI C , which we can't depend upon the existence of */ +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) +#endif diff --git a/bfd/hosts/irix4.h b/bfd/hosts/irix4.h index 5da3636..f005fef 100644 --- a/bfd/hosts/irix4.h +++ b/bfd/hosts/irix4.h @@ -25,3 +25,8 @@ #endif #include "fopen-same.h" + +/* From ANSI C , which we can't depend upon the existence of */ +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) +#endif diff --git a/bfd/hosts/ncr3000.h b/bfd/hosts/ncr3000.h index ad4c077..1f46db5 100644 --- a/bfd/hosts/ncr3000.h +++ b/bfd/hosts/ncr3000.h @@ -10,7 +10,7 @@ #include #include -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif #define SEEK_SET 0 @@ -48,3 +48,8 @@ extern int fputc(); extern int unlink(); #include "fopen-same.h" + +/* From ANSI C , which we can't depend upon the existence of */ +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) +#endif diff --git a/bfd/hosts/rs6000.h b/bfd/hosts/rs6000.h index 5b20649..60f4f07 100644 --- a/bfd/hosts/rs6000.h +++ b/bfd/hosts/rs6000.h @@ -1,3 +1,4 @@ +#include #include #include #include @@ -8,7 +9,7 @@ #include #include /* for malloc() */ -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif #define SEEK_SET 0 diff --git a/bfd/hosts/rtbsd.h b/bfd/hosts/rtbsd.h index d4c3090..42f89de 100644 --- a/bfd/hosts/rtbsd.h +++ b/bfd/hosts/rtbsd.h @@ -7,7 +7,7 @@ #include #include -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif @@ -18,3 +18,8 @@ extern char *malloc(); extern void free(); #include "fopen-same.h" + +/* From ANSI C , which we can't depend upon the existence of */ +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) +#endif diff --git a/bfd/hosts/solaris2.h b/bfd/hosts/solaris2.h index d32b7a6..f423a1c 100644 --- a/bfd/hosts/solaris2.h +++ b/bfd/hosts/solaris2.h @@ -2,7 +2,7 @@ #include "hosts/sysv4.h" -#ifndef __GNUC__ +#ifndef __GNUC__ #include #endif /* That's all... */ diff --git a/bfd/hosts/sparc-ll.h b/bfd/hosts/sparc-ll.h index 06658e6..f2578d0 100644 --- a/bfd/hosts/sparc-ll.h +++ b/bfd/hosts/sparc-ll.h @@ -1,5 +1,6 @@ /* Host definition file for Sun-4 running with gcc, using "long long" for addresses, to handle 64-bit target systems. */ +#include #include #include #include @@ -10,7 +11,7 @@ #include #include #include -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif #define SEEK_SET 0 @@ -32,12 +33,12 @@ extern void bcopy PARAMS ((char*, char*, int)); extern int bcmp PARAMS ((char *, char *, int)); extern void bzero PARAMS ((char *, int)); extern PTR memset PARAMS ((PTR, int, unsigned int)); -#ifndef DONTDECLARE_MALLOC +#ifndef DONTDECLARE_MALLOC extern PTR malloc PARAMS ((unsigned)); extern PTR realloc PARAMS ((PTR, unsigned)); #endif -#ifndef __GNUC__ +#ifndef __GNUC__ PTR memcpy PARAMS ((PTR, CONST PTR, unsigned int)); #else /* char * memcpy PARAMS ((char *, CONST char *, unsigned int)); */ @@ -99,7 +100,7 @@ typedef struct { #endif #define BYTES_IN_PRINTF_INT 4 -#ifndef __GNUC__ +#ifndef __GNUC__ #define uint64_typeLOW(x) (unsigned long)(((x).low)) #define uint64_typeHIGH(x) (unsigned long)(((x).high)) #else diff --git a/bfd/hosts/std-host.h b/bfd/hosts/std-host.h index 6e97d8a..4e3d685 100644 --- a/bfd/hosts/std-host.h +++ b/bfd/hosts/std-host.h @@ -1,4 +1,4 @@ -#ifndef hosts_std_host_H +#ifndef hosts_std_host_H #include #include #include @@ -8,13 +8,13 @@ #include #include -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif -#ifndef SEEK_SET +#ifndef SEEK_SET #define SEEK_SET 0 #endif -#ifndef SEEK_CUR +#ifndef SEEK_CUR #define SEEK_CUR 1 #endif #ifdef STDC_HEADERS @@ -46,12 +46,12 @@ extern int getuid (); extern int getgid (); extern int rename (); extern void perror (); -#ifndef DONTDECLARE_MALLOC +#ifndef DONTDECLARE_MALLOC extern PTR malloc (); extern PTR realloc (); #endif -#ifndef __GNUC__ +#ifndef __GNUC__ extern PTR memcpy (); #else /* char * memcpy (); */ @@ -85,15 +85,23 @@ extern int fputc(); extern int unlink(); #endif /* STDC_HEADERS */ -#ifndef BYTES_IN_PRINTF_INT +#ifndef BYTES_IN_PRINTF_INT #define BYTES_IN_PRINTF_INT 4 #endif /* From ANSI C , which we can't depend upon the existence of */ -#ifndef offsetof +#ifndef offsetof #define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) #endif #include "fopen-same.h" #define hosts_std_host_H #endif + +#ifdef STDC_HEADERS +#include +#else +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) +#endif +#endif /* STDC_HEADERS */ diff --git a/bfd/hosts/stratus.h b/bfd/hosts/stratus.h index 5a02216..345480e 100644 --- a/bfd/hosts/stratus.h +++ b/bfd/hosts/stratus.h @@ -10,7 +10,7 @@ #include #include -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif #define SEEK_SET 0 @@ -48,3 +48,8 @@ extern int fputc(); extern int unlink(); #include "fopen-same.h" + +/* From ANSI C , which we can't depend upon the existence of */ +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) +#endif diff --git a/bfd/hosts/sun3.h b/bfd/hosts/sun3.h index bd8b2ab..dfb505c 100644 --- a/bfd/hosts/sun3.h +++ b/bfd/hosts/sun3.h @@ -7,7 +7,7 @@ #include #include #include -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif #define SEEK_SET 0 @@ -36,7 +36,7 @@ extern int chmod(); extern int fstat(); extern int stat(); extern int strtol(); -#ifndef DONTDECLARE_MALLOC +#ifndef DONTDECLARE_MALLOC extern PTR malloc PARAMS ((unsigned)); extern PTR realloc PARAMS ((PTR, unsigned)); #endif @@ -54,3 +54,8 @@ extern int unlink(); #include "fopen-same.h" + +/* From ANSI C , which we can't depend upon the existence of */ +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) +#endif diff --git a/bfd/hosts/sysv4.h b/bfd/hosts/sysv4.h index 73acc66..c26ed3b 100644 --- a/bfd/hosts/sysv4.h +++ b/bfd/hosts/sysv4.h @@ -1,5 +1,6 @@ /* System V Release 4 Unix host system */ +#include #include #include #include @@ -11,7 +12,7 @@ #include #include -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif #define SEEK_SET 0 diff --git a/bfd/hosts/ultra3.h b/bfd/hosts/ultra3.h index 7d9935b..fe3c960 100644 --- a/bfd/hosts/ultra3.h +++ b/bfd/hosts/ultra3.h @@ -10,7 +10,7 @@ #define SEEK_SET 0 #define SEEK_CUR 1 -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif @@ -18,3 +18,8 @@ extern char *malloc(); extern void free(); #include "fopen-same.h" + +/* From ANSI C , which we can't depend upon the existence of */ +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) +#endif diff --git a/bfd/hosts/we32k.h b/bfd/hosts/we32k.h index c4be619..a1791c1 100644 --- a/bfd/hosts/we32k.h +++ b/bfd/hosts/we32k.h @@ -9,11 +9,11 @@ #include #include #include -#ifndef O_ACCMODE +#ifndef O_ACCMODE #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) #endif -#ifndef DONTDECLARE_MALLOC +#ifndef DONTDECLARE_MALLOC extern PTR malloc PARAMS ((unsigned)); extern PTR realloc PARAMS ((PTR, unsigned)); #endif @@ -26,3 +26,8 @@ extern int strtol(); #define NO_STDARG 1 #include "fopen-same.h" + +/* From ANSI C , which we can't depend upon the existence of */ +#ifndef offsetof +#define offsetof(type,memb) ((size_t)&(((type *)0)->memb)) +#endif -- 2.7.4