[I have been distracted by Things Other Than Quagga and am way behind on
quagga-dev mail.  I happened to look at a few messages that seemed like
I could actually reply to.]


Donald Sharp <sha...@cumulusnetworks.com> writes:

> +/*
> + * write_wrapper
> + *
> + * glibc has declared that the return value from write *must* not be
> + * ignored.
> + * gcc see's this problem and issues a warning for the line.
> + *
> + * Why is this a big deal you say?  Because both of them are right
> + * and if you have -Werror enabled then all calls to write
> + * generate a build error and the build stops.
> + *
> + * clang has helpfully allowed this construct:
> + * (void)write(...)
> + * to tell the compiler yeah I know it has a return value
> + * I don't care about it at this time.
> + * gcc doesn't have this ability.
> + *
> + * This code was written such that it didn't care about the
> + * return value from write.  At this time do I want
> + * to go through and fix and test this code for correctness.
> + * So just wrapper the bad behavior and move on.
> + */
> +static void write_wrapper (int fd, const void *buf, size_t count)
> +{
> +  if (write (fd, buf, count) <= 0)
> +    return;
> +
> +  return;
> +}

This feels like catering to broken warnings, vs fixing something that is
really wrong.   Why doesn't casting write to void (if we really do mean
to ignore the return value) work with the gcc in Debian Jessie?  Isn't
that a bug in gcc?  What does C99 say?

Couldn't configure add a -Wno-blah-blah to disable just this warning, if
it detects gcc?

This gcc behavior seems like it will be breaking vast amounts of legit
code.  How long has this been going on?  What's the reaction in the
debian/gcc lists about it?


It also seems like this kind of workaround could be done as a macro, to
avoid changing the source in many places.

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to