changeset 17264:66e6219b0ff0

fwrite: silence __wur only for older glibc versions * lib/stdio.in.h (fwrite): Limit workaround to glibc 2.4 through 2.15. This will help us remove this workaround some time in the far future.
author Paul Eggert <eggert@cs.ucla.edu>
date Thu, 03 Jan 2013 10:11:25 -0800
parents 283c189edcab
children b3f19d3d0811
files ChangeLog lib/stdio.in.h
diffstat 2 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-01-03  Paul Eggert  <eggert@cs.ucla.edu>
+
+	fwrite: silence __wur only for older glibc versions
+	* lib/stdio.in.h (fwrite): Limit workaround to glibc 2.4 through 2.15.
+	This will help us remove this workaround some time in the far future.
+
 2013-01-03  Eric Blake  <eblake@redhat.com>
 
 	fwrite: silence __wur without using inline
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -575,13 +575,15 @@
 _GL_CXXALIAS_SYS (fwrite, size_t,
                   (const void *ptr, size_t s, size_t n, FILE *stream));
 
-/* Work around glibc bug 11959
+/* Work around bug 11959 when fortifying glibc 2.4 through 2.15
    <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>,
    which sometimes causes an unwanted diagnostic for fwrite calls.
    This affects only function declaration attributes under certain
    versions of gcc, and is not needed for C++.  */
-#  if !defined __cplusplus && 0 < __USE_FORTIFY_LEVEL \
-  && 3 < (__GNUC__ + (4 <= __GNUC_MINOR__))
+#  if (0 < __USE_FORTIFY_LEVEL                                          \
+       && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \
+       && 3 < __GNUC__ + (4 <= __GNUC_MINOR__)                          \
+       && !defined __cplusplus)
 #   undef fwrite
 #   define fwrite(a, b, c, d) ({size_t __r = fwrite (a, b, c, d); __r; })
 #  endif