[libvirt] [PATCH] fwrite: silence __wur without using inline

Paul Eggert eggert at cs.ucla.edu
Thu Jan 3 18:16:18 UTC 2013


Thanks for fixing that.  I'm still puzzled about
why the problem happened with libvirt.  It's better now that
stdio doesn't depend on extern-inline, but I worry that whatever
bug the libvirt folks were having with stdio and extern inline
might crop up when extern inline is used in other include files.

One minor improvement is that we can limit the workaround to
glibc versions that have the problem, so I pushed this further
change.

---
 ChangeLog      | 6 ++++++
 lib/stdio.in.h | 8 +++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0bae990..714ee4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-01-03  Paul Eggert  <eggert at 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 at redhat.com>
 
 	fwrite: silence __wur without using inline
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index f9765d1..c345499 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -575,13 +575,15 @@ _GL_CXXALIAS_RPL (fwrite, size_t,
 _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
-- 
1.7.11.7





More information about the libvir-list mailing list