On Thu, Jan 7, 2016 at 4:39 PM, Tony Mechelynck
<[email protected]> wrote:
> On Thu, Jan 7, 2016 at 10:08 PM, Charles Campbell
> <[email protected]> wrote:
>> Hello:
>>
>> I just noticed that there's a warning when compiling with gcc under
>> scientific linux:
>>
>> misc2.c: In function 'put_time':
>> misc2.c:6312: warning: ignoring return value of 'fwrite', declared with
>> attribute warn_unused_result
>>
>> In grep'ing through the patches, I see this one must have creeped in
>> back with patch#649, which in turn was trying to get rid of an annoying
>> compiler message for whatever compiler Michael Jarvis used.  The
>> solution was to use (void)fwrite(...) in the put_time() function, but
>> gcc v4.4.7 gets grumpy even when explicitly told not to worry by the
>> (void) cast.  IMHO gcc should let explicitly specified ignored values go
>> unmentioned, but there it is.
>>
>> Presumably, given the optimization and fortify settings, the function is
>> prototyped with __attribute_warn_unused_result__ .
>>
>> There are two solutions:
>>
>> * apply given patch: this removes the warning using gcc at the price of
>> a "silly" variable assignment.  I'm afraid that I wouldn't be surprised
>> if some compiler out there flags silly as an unused variable, though.
>> * specify either -U_FORTIFY_SOURCE or -D_FORTIFY_SOURCE=0 .  Probably
>> won't want to do that, I'd guess.
>>
>> I didn't see any -W... settings to turn this message off, btw.
>>
>> Regards,
>> Chip Campbell
>
>
> Since the compiler handles only one source file at a time, it would
> probably not complain for an assignment to a silly _global_ variable


There is already a global called `ignored` that is used to silence
such warnings.


Justin M. Keyes

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui