This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix binutils build with recent glibcs


Hi!

Recent glibcs define pread as a function-like macro (which is something
POSIX permits).  The solutions are either #undef pread, or prevent it
from being expanded as function-like macro.  That is IMHO preferrable
and done in the patch below.  close ATM is not a function-like macro,
but it is allowed to be a function-like macro too, so I've changed that
too.

2005-03-07  Jakub Jelinek  <jakub@redhat.com>

	* opncls.c (opncls_bread, opncls_bclose): Fix if pread resp.
	close is a function like macro in system headers.

--- bfd/opncls.c.jj	2004-11-22 15:33:31.000000000 -0500
+++ bfd/opncls.c	2005-03-06 08:30:16.000000000 -0500
@@ -405,7 +405,7 @@ static file_ptr
 opncls_bread (struct bfd *abfd, void *buf, file_ptr nbytes)
 {
   struct opncls *vec = abfd->iostream;
-  file_ptr nread = vec->pread (abfd, vec->stream, buf, nbytes, vec->where);
+  file_ptr nread = (vec->pread) (abfd, vec->stream, buf, nbytes, vec->where);
   if (nread < 0)
     return nread;
   vec->where += nread;
@@ -428,7 +428,7 @@ opncls_bclose (struct bfd *abfd)
      free it.  */
   int status = 0;
   if (vec->close != NULL)
-    status = vec->close (abfd, vec->stream);
+    status = (vec->close) (abfd, vec->stream);
   abfd->iostream = NULL;
   return status;
 }

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]