Hello!
On Tue, Nov 11, 2008 at 12:43:54AM +0300, Igor Sysoev wrote:
On Tue, Nov 11, 2008 at 12:35:40AM +0300, Maxim Dounin wrote:
[...]
More details here:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509
However I don't think it's a good idea to use stub variables.
Probably something like
if (ngx_write_fd(...) == NGX_FILE_ERROR) {
/* void */
}
would be better.
p.s. Actually I think that it's glibc's bug. But we probably have
to live with it, at least for some time.
I believe this is gcc bug because I explictly says that I do not need
the function result using (void) case.
It can't be gcc bug - warn_unused_result was explicitly coded to
produce warning unavoidable by (void) cast. I agree that it's
a misfeature though.
Anyway, there are many handwaving about this at the url I posted
(and in other places as well). I don't think we want to repeat it
here. :)
Dummy result checking as well as stub variable are security/reliabilty
profanation.
With [dummy] result checking we have some good place where we can
write reason why we can't do anything with the result,
so it looks better for me than stub variable. Of course both
aren't ideal.
The (void) cast should be compact way to do the same.
It should, but it isn't. The question now is how to live with it
with minimal impact on decent systems. Probably the best solution
would be just to omit -Werror on such systems.