On Aug 28, 4:33 pm, "Jonathan Schmidt" <
j...@jschmidt.ca> wrote:
> Does gcc care that zfs-fuse ignores the return value from printf?
No. It complains about write() 5 times, and once each for ftruncate,
chdir, and daemon.
This is definitely on purpose. Line 333 of my /usr/include/unistd.h
reads:
extern ssize_t write (int __fd, __const void *__buf, size_t __n)
__wur;
"__wur" is the attribute "warn_unused_result".
> Why only flag it for the call to write()?
Probably because the return value from write() can tell you something
important in some circumstances. Like if you dump some data down a
socket and only some of it gets written, the return value from write()
will not match the buffer length passed in. I was a bit surprised
when I saw the ZFS source ignoring the return value from write()--but
then I figured, these guys know wtf they are doing, and ZFS clearly
works.
FWIW, I tried "-Werror -Wno-error=unused-value" and "-Werror -Wno-
error=unused", and neither of those helped. There doesn't appear to
be a command-line flag that lets you fiddle with warnings on unused
results. So far I can only build if I remove "-Werror".
And, yeah, I think it's a gcc bug too.
/larry/