This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] fix warnings with -D_FORTIFY_SOURCE and -Wformat-security
- From: Gerald Pfeifer <gerald at pfeifer dot com>
- To: Matthias Klose <doko at ubuntu dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, fortran at gcc dot gnu dot org
- Date: Sun, 15 Mar 2009 23:47:13 +0100 (CET)
- Subject: Re: [patch] fix warnings with -D_FORTIFY_SOURCE and -Wformat-security
- References: <49BD8445.6070705@ubuntu.com>
Matthias,
On Sun, 15 Mar 2009, Matthias Klose wrote:
> when GCC is built with a compiler which has some hardening options
> turned on by default, the build fails when configured without
> --disable-werror. This patch fixes all these warnings
I believe
+ size_t rv_neverused ATTRIBUTE_UNUSED;
print.src_line += lines;
- fwrite (buf, 1, size, print.outf);
+ rv_neverused = fwrite (buf, 1, size, print.outf);
could also bee written as
(void) fwrite (buf, 1, size, print.outf);
which looks simpler and expresses the same in a more straightforward
manner. (If it doesn't work, that may be something to address.)
Gerald