* offsetof
@ 2001-08-19 16:43 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2001-08-19 16:43 UTC (permalink / raw)
To: binutils
Move defines for offsetof into sysdep.h
bfd/ChangeLog
* archive.c (offsetof): Remove define.
* elf.c: Likewise.
* oasys.c: Likewise
* sysdep.h (offsetof): Define.
--
Alan Modra
Index: bfd/archive.c
===================================================================
RCS file: /cvs/src/src/bfd/archive.c,v
retrieving revision 1.15
diff -u -p -r1.15 archive.c
--- archive.c 2001/08/17 03:19:01 1.15
+++ archive.c 2001/08/19 23:31:29
@@ -142,12 +142,6 @@ extern int errno;
#define BFD_GNU960_ARMAG(abfd) (BFD_COFF_FILE_P((abfd)) ? ARMAG : ARMAGB)
#endif
-/* Define offsetof for those systems which lack it */
-
-#ifndef offsetof
-#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
-#endif
-
/* We keep a cache of archive filepointers to archive elements to
speed up searching the archive by filepos. We only add an entry to
the cache when we actually read one. We also don't sort the cache;
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.80
diff -u -p -r1.80 elf.c
--- elf.c 2001/08/11 16:48:15 1.80
+++ elf.c 2001/08/19 23:31:45
@@ -5341,12 +5341,6 @@ _bfd_elf_rel_vtable_reloc_fn (abfd, re,
#ifdef HAVE_SYS_PROCFS_H
# include <sys/procfs.h>
-#endif
-
-/* Define offsetof for those systems which lack it. */
-
-#ifndef offsetof
-# define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
#endif
/* FIXME: this is kinda wrong, but it's what gdb wants. */
Index: bfd/oasys.c
===================================================================
RCS file: /cvs/src/src/bfd/oasys.c,v
retrieving revision 1.7
diff -u -p -r1.7 oasys.c
--- oasys.c 2001/05/11 12:23:47 1.7
+++ oasys.c 2001/08/19 23:31:50
@@ -27,14 +27,6 @@ Foundation, Inc., 59 Temple Place - Suit
#include "oasys.h"
#include "liboasys.h"
-/* XXX - FIXME. offsetof belongs in the system-specific files in
- ../include/sys. */
-/* Define offsetof for those systems which lack it */
-
-#ifndef offsetof
-#define offsetof(type, identifier) (size_t) &(((type *) 0)->identifier)
-#endif
-
static boolean oasys_read_record PARAMS ((bfd *,
oasys_record_union_type *));
static boolean oasys_write_sections PARAMS ((bfd *));
Index: bfd/sysdep.h
===================================================================
RCS file: /cvs/src/src/bfd/sysdep.h,v
retrieving revision 1.5
diff -u -p -r1.5 sysdep.h
--- sysdep.h 2001/03/08 21:04:02 1.5
+++ sysdep.h 2001/08/19 23:31:55
@@ -125,6 +125,12 @@ extern void free ();
extern char *getenv ();
#endif
+/* Define offsetof for those systems which lack it */
+
+#ifndef offsetof
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
+
#ifdef ENABLE_NLS
#include <libintl.h>
/* Note the use of dgetext() and PACKAGE here, rather than gettext().
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-08-19 16:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-19 16:43 offsetof Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).