This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] fix warnings with -D_FORTIFY_SOURCE and -Wformat-security


Gerald Pfeifer schrieb:
> 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.)

No, unfortunately this warning cannot be avoid by the (void) cast.

  Matthias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]