This is the mail archive of the 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, libiberty: eliminate build warning

This patch eliminates a warning in pex-unix.c due to write(3) being
marked as warn_unused_result on some GNU/Linux distributions.  As the
coment in pex_child_error says, there is no alternative such as using

Okay for binutils and gcc trunk?

Thanks, Ben

2009-11-19  Ben Elliston  <>

	* pex-unix.c (pex_child_error): Define writeerr macro to avoid
	unused result warnings from write(3) calls.  Undefine writeerr
	after all uses.

Index: pex-unix.c
RCS file: /cvs/src/src/libiberty/pex-unix.c,v
retrieving revision 1.14
diff -u -p -r1.14 pex-unix.c
--- pex-unix.c	27 Jul 2009 19:01:17 -0000	1.14
+++ pex-unix.c	19 Nov 2009 10:09:16 -0000
@@ -368,7 +368,7 @@ static void
 pex_child_error (struct pex_obj *obj, const char *executable,
 		 const char *errmsg, int err)
-#define writeerr(s) (void) write (STDERR_FILE_NO, s, strlen (s))
+#define writeerr(s) if (write (STDERR_FILE_NO, s, strlen (s))) {}
   writeerr (obj->pname);
   writeerr (": error trying to exec '");
   writeerr (executable);
@@ -377,6 +377,7 @@ pex_child_error (struct pex_obj *obj, co
   writeerr (": ");
   writeerr (xstrerror (err));
   writeerr ("\n");
+#undef writeerr
   _exit (-1);

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