fix hotspot build failures with -D_FORTIFY_SOURCE=2 and -Wformat=1

Christian Thalinger twisti at
Wed Dec 3 06:20:50 PST 2008

On Wed, 2008-12-03 at 14:46 +0100, Matthias Klose wrote:
>           int fn () __attribute__ ((warn_unused_result));
>           int foo ()
>           {
>             if (fn () < 0) return -1;
>             (void) fn ();
>             return 0;
>           }
> gcc (4.3.x, 4.4) still warns about the unused return value.

I see the problem.  write is defined with __wur (which is most likely
__attribute__ ((warn_unused_result)), I did not check) in glibc-2.7, but
not in e.g. glibc-2.3.6, and GCC warns about it even when a (void) cast
is used.

I'd say this is a bug in GCC.  When I explicitly ask for ignoring the
return value, it should do it.

- Christian

More information about the distro-pkg-dev mailing list