Submitted By: Robert Connolly (ashes) Date: 2007-06-11 Initial Package Version: 2.5 Upstream Status: From Upstream Origin: http://sourceware.org/ml/glibc-cvs/2006-q4/msg00118.html http://sourceware.org/cgi-bin/cvsweb.cgi/libc/libio/ stdio.h.diff?cvsroot=glibc&r2=1.88&r1=1.87&f=u Description: This patch adds __attribute_warn_unused_result__ to additional functions. 2006-10-13 Ulrich Drepper * libio/stdio.h: Add more __wur attributes. diff -Naur glibc-2.5.orig/libio/stdio.h glibc-2.5/libio/stdio.h --- glibc-2.5.orig/libio/stdio.h 2006-09-27 15:55:23.000000000 +0000 +++ glibc-2.5/libio/stdio.h 2007-06-11 20:13:00.000000000 +0000 @@ -166,27 +166,27 @@ This function is a possible cancellation points and therefore not marked with __THROW. */ #ifndef __USE_FILE_OFFSET64 -extern FILE *tmpfile (void); +extern FILE *tmpfile (void) __wur; #else # ifdef __REDIRECT -extern FILE *__REDIRECT (tmpfile, (void), tmpfile64); +extern FILE *__REDIRECT (tmpfile, (void), tmpfile64) __wur; # else # define tmpfile tmpfile64 # endif #endif #ifdef __USE_LARGEFILE64 -extern FILE *tmpfile64 (void); +extern FILE *tmpfile64 (void) __wur; #endif /* Generate a temporary filename. */ -extern char *tmpnam (char *__s) __THROW; +extern char *tmpnam (char *__s) __THROW __wur; __END_NAMESPACE_STD #ifdef __USE_MISC /* This is the reentrant variant of `tmpnam'. The only difference is that it does not allow S to be NULL. */ -extern char *tmpnam_r (char *__s) __THROW; +extern char *tmpnam_r (char *__s) __THROW __wur; #endif @@ -199,7 +199,7 @@ P_tmpdir is tried and finally "/tmp". The storage for the filename is allocated by `malloc'. */ extern char *tempnam (__const char *__dir, __const char *__pfx) - __THROW __attribute_malloc__; + __THROW __attribute_malloc__ __wur; #endif @@ -244,21 +244,23 @@ This function is a possible cancellation point and therefore not marked with __THROW. */ extern FILE *fopen (__const char *__restrict __filename, - __const char *__restrict __modes); + __const char *__restrict __modes) __wur; /* Open a file, replacing an existing stream with it. This function is a possible cancellation point and therefore not marked with __THROW. */ extern FILE *freopen (__const char *__restrict __filename, __const char *__restrict __modes, - FILE *__restrict __stream); + FILE *__restrict __stream) __wur; #else # ifdef __REDIRECT extern FILE *__REDIRECT (fopen, (__const char *__restrict __filename, - __const char *__restrict __modes), fopen64); + __const char *__restrict __modes), fopen64) + __wur; extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename, __const char *__restrict __modes, - FILE *__restrict __stream), freopen64); + FILE *__restrict __stream), freopen64) + __wur; # else # define fopen fopen64 # define freopen freopen64 @@ -267,15 +269,15 @@ __END_NAMESPACE_STD #ifdef __USE_LARGEFILE64 extern FILE *fopen64 (__const char *__restrict __filename, - __const char *__restrict __modes); + __const char *__restrict __modes) __wur; extern FILE *freopen64 (__const char *__restrict __filename, __const char *__restrict __modes, - FILE *__restrict __stream); + FILE *__restrict __stream) __wur; #endif #ifdef __USE_POSIX /* Create a new stream that refers to an existing system file descriptor. */ -extern FILE *fdopen (int __fd, __const char *__modes) __THROW; +extern FILE *fdopen (int __fd, __const char *__modes) __THROW __wur; #endif #ifdef __USE_GNU @@ -283,15 +285,16 @@ and uses the given functions for input and output. */ extern FILE *fopencookie (void *__restrict __magic_cookie, __const char *__restrict __modes, - _IO_cookie_io_functions_t __io_funcs) __THROW; + _IO_cookie_io_functions_t __io_funcs) __THROW __wur; /* Create a new stream that refers to a memory buffer. */ -extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) __THROW; +extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) + __THROW __wur; /* Open a stream that writes into a malloc'd buffer that is expanded as necessary. *BUFLOC and *SIZELOC are updated with the buffer's location and the number of characters written on fflush or fclose. */ -extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW; +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW __wur; #endif @@ -367,13 +370,13 @@ Store the address of the string in *PTR. */ extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f, _G_va_list __arg) - __THROW __attribute__ ((__format__ (__printf__, 2, 0))); + __THROW __attribute__ ((__format__ (__printf__, 2, 0))) __wur; extern int __asprintf (char **__restrict __ptr, __const char *__restrict __fmt, ...) - __THROW __attribute__ ((__format__ (__printf__, 2, 3))); + __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur; extern int asprintf (char **__restrict __ptr, __const char *__restrict __fmt, ...) - __THROW __attribute__ ((__format__ (__printf__, 2, 3))); + __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur; /* Write formatted output to a file descriptor.