From: John Gilmore Date: Fri, 17 Sep 1993 09:08:00 +0000 (+0000) Subject: Make sure that "offsetof" is defined on all hosts, now that archive.c uses it. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c5652bffcbe441880474a8f6c01bccd4d5b0d577;p=binutils-gdb.git Make sure that "offsetof" is defined on all hosts, now that archive.c uses it. --- diff --git a/bfd/hosts/alphaosf.h b/bfd/hosts/alphaosf.h index ab6687352ef..cbb5ac203cf 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 16d2bfe8bea..a2b072e7108 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 eb14ad893dc..f644986a4f9 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 3c4c6d97d65..27580ea1384 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 a7a038f1310..2e9f63268c7 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 ff0573f7be6..c424a5011f3 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 5b2f24f02da..b01cc88b02b 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 2c71b2e7d90..7e1af187b39 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 26ab4a61855..82750d48300 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 525ca8e2ce9..e1bbaa4f1a6 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 ad9660e7695..4abc5944db1 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 e36ed9bf888..a0cc6968a5a 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 156669445d6..c09968a9597 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 971c39ca22d..59adeffa505 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 2d2c8ee919c..5954a949422 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 ad4c077c73a..1f46db50cd2 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 caa7901dee8..4672530b692 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 5da363652c5..f005feff4c6 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 ad4c077c73a..1f46db50cd2 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 5b206490d90..60f4f0788f4 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 d4c309003bc..42f89def2d2 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 d32b7a67f77..f423a1c512f 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 06658e6531e..f2578d0cee7 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 6e97d8a0dc4..4e3d6852889 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 5a02216c58b..345480e21ec 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 bd8b2abcd62..dfb505c0cb9 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 73acc6640b7..c26ed3b17ca 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 7d9935be3b0..fe3c960a5cb 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 c4be61972df..a1791c181b0 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