The libvirt folks reported[1] a link error of multiple rpl_fwrite
definitions that hits only when optimization and FORTIFY_SOURCE
are both enabled, due to improper use of inline. But since that
particular use of rpl_fwrite exists only to work around a spurious
gcc warning on some versions of glibc, we can use gcc extensions
to acheive the same effect without using inline. This approach
copies from ignore-value.h.
[1] https://lists.gnu.org/archive/html/bug-gnulib/2013-01/msg00014.html
* lib/stdio.in.h (fwrite): Limit warn_unused_result workaround to
just gcc, and in a way that avoids inline issues.
* modules/stdio (Depends-on): Drop extern-inline.
Signed-off-by: Eric Blake <eblake@redhat.com>
+2013-01-03 Eric Blake <eblake@redhat.com>
+
+ fwrite: silence __wur without using inline
+ * lib/stdio.in.h (fwrite): Limit warn_unused_result workaround to
+ just gcc, and in a way that avoids inline issues.
+ * modules/stdio (Depends-on): Drop extern-inline.
+
2013-01-03 Jim Meyering <jim@meyering.net>
update-copyright: avoid copyright notice date corruption
2013-01-03 Jim Meyering <jim@meyering.net>
update-copyright: avoid copyright notice date corruption
#ifndef _@GUARD_PREFIX@_STDIO_H
#define _@GUARD_PREFIX@_STDIO_H
#ifndef _@GUARD_PREFIX@_STDIO_H
#define _@GUARD_PREFIX@_STDIO_H
-_GL_INLINE_HEADER_BEGIN
-#ifndef _GL_STDIO_INLINE
-# define _GL_STDIO_INLINE _GL_INLINE
-#endif
-
/* Get va_list. Needed on many systems, including glibc 2.8. */
#include <stdarg.h>
/* Get va_list. Needed on many systems, including glibc 2.8. */
#include <stdarg.h>
/* Work around glibc bug 11959
<http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>,
which sometimes causes an unwanted diagnostic for fwrite calls.
/* Work around glibc bug 11959
<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, so it's not
- needed for C++. */
-# if !defined __cplusplus && 0 < __USE_FORTIFY_LEVEL
-_GL_STDIO_INLINE size_t _GL_ARG_NONNULL ((1, 4))
-rpl_fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
-{
- size_t r = fwrite (ptr, s, n, stream);
- (void) r;
- return r;
-}
+ 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__))
-# define fwrite rpl_fwrite
+# define fwrite(a, b, c, d) ({size_t __r = fwrite (a, b, c, d); __r; })
# endif
# endif
_GL_CXXALIASWARN (fwrite);
# endif
# endif
_GL_CXXALIASWARN (fwrite);
"POSIX compliance");
#endif
"POSIX compliance");
#endif
#endif /* _@GUARD_PREFIX@_STDIO_H */
#endif /* _@GUARD_PREFIX@_STDIO_H */
#endif
#endif /* _@GUARD_PREFIX@_STDIO_H */
#endif /* _@GUARD_PREFIX@_STDIO_H */
#endif
m4/stdio_h.m4
Depends-on:
m4/stdio_h.m4
Depends-on:
include_next
snippet/arg-nonnull
snippet/c++defs
include_next
snippet/arg-nonnull
snippet/c++defs