This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: silence libiberty warning
- From: Ben Elliston <bje at au1 dot ibm dot com>
- To: binutils at sourceware dot org, gcc-patches at gcc dot gnu dot org
- Cc: iant at google dot com
- Date: Fri, 12 Jan 2007 09:50:37 +1100
- Subject: PATCH: silence libiberty warning
On systems that declare various C library functions with attribute
warn_unused_result, libiberty produces the following warning:
libiberty/choose-temp.c:68: warning: ignoring return value of âmktempâ, declared with attribute warn_unused_result
The following patch fixes it. Okay for the trunk?
2007-01-12 Ben Elliston <bje@au.ibm.com>
* choose-temp.c (choose_temp_base): Check the result of call to
mktemp rather than testing the length of the modified string.
Index: choose-temp.c
===================================================================
RCS file: /cvs/src/src/libiberty/choose-temp.c,v
retrieving revision 1.10
diff -u -p -r1.10 choose-temp.c
--- choose-temp.c 24 May 2005 21:01:30 -0000 1.10
+++ choose-temp.c 11 Jan 2007 22:49:54 -0000
@@ -65,8 +65,7 @@ choose_temp_base (void)
strcpy (temp_filename, base);
strcpy (temp_filename + len, TEMP_FILE);
- mktemp (temp_filename);
- if (strlen (temp_filename) == 0)
+ if (mktemp (temp_filename) == 0)
abort ();
return temp_filename;
}