On 08/30/2010 02:48 PM, Paul Eggert wrote:
On 08/30/10 12:52, Jim Meyering wrote:
However, for the vast majority of the functions marked with this
attribute, ignoring the return value really is a bug in all but a
very small fraction of the use cases.
That may well be, but that's not the issue. The issue is whether
the cost of using -Wunused-result exceeds its benefits. The cost
accrues in the cases where it's not a bug to ignore
the returned value, possibly because it's a function like
fwrite or strtod that should never have been marked with
__attribute__ ((__warn_unused_result__)). The benefit accrues
in the cases where using -Wunused-result catches significant bugs
that would not be caught otherwise.
Which takes us back to the argument that if a function is poorly marked,
it should be easy to override that poor marking, so that the rest of the
code using that function does not have to mark it with ignore_value,
while not crippling the remaining functions where it makes sense.
I'm leaning even more heavily towards a patch to gnulib's stdio.in.h
that undoes the poor glibc marking on fwrite.
--
Eric Blake ebl...@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org