This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

BZ #11959: stdio.h: remove fwrite's __wur attribute


Jim has provided the following patch. 

Explanation from bugzilla:
"The use of the warn_unused_result attribute in the declaration of fwrite is
undesirable, since it is perfectly legitimate to use fwrite without inspecting
its return value.  In that case, one can still detect failure via ferror.
That libc declares fwrite with this attribute causes inordinate trouble for
those who try to avoid gcc warnings about this attribute."

I've tested this on Linux/x86-64.

Ok to commit?

Andreas

2012-04-11  Jim Meyering  <meyering@redhat.com>

            [BZ #11959]
            * libio/stdio.h (fwrite, fwrite_unlocked): Remove __wur.
            It is not necessarily an error to ignore fwrite's return
            value.  One can reliably use ferror to test for errors after
            the fact.

---
 libio/stdio.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libio/stdio.h b/libio/stdio.h
index bf16b3f..3a314be 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -706,7 +706,7 @@ extern size_t fread (void *__restrict __ptr, size_t __size,
    This function is a possible cancellation points and therefore not
    marked with __THROW.  */
 extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
-		      size_t __n, FILE *__restrict __s) __wur;
+		      size_t __n, FILE *__restrict __s);
 __END_NAMESPACE_STD

 #ifdef __USE_GNU
@@ -730,7 +730,7 @@ extern int fputs_unlocked (__const char *__restrict __s,
 extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
 			      size_t __n, FILE *__restrict __stream) __wur;
 extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
-			       size_t __n, FILE *__restrict __stream) __wur;
+			       size_t __n, FILE *__restrict __stream);
 #endif


-- 
1.7.2.2.510.g7180a


-- 
 Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
  SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 NÃrnberg, Germany
   GF: Jeff Hawn,Jennifer Guild,Felix ImendÃrffer,HRB16746 (AG NÃrnberg)
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126


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