On Sun, 7 Apr 2019, Hal Murray wrote:

Does a simple void cast work?  E.g.:
        (void) strerror_r(...)

I haven't found the magic using that approach.

../../ntpd/nts.c:214:16: warning: ignoring return value of ???strerror_r???,
declared with attribute warn_unused_result [-Wunused-result]
        (void) strerror_r(errno, errbuf, sizeof(errbuf));
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

That's too bad; so you need to fix it the "hard way" after all.

It seems like a compiler bug to warn in that case. Presumably the intent of the warning is to let you know that you're *unintentionally* ignoring
a result.  The void cast makes it clear that it's intentional.

Fred Wright
_______________________________________________
devel mailing list
devel@ntpsec.org
http://lists.ntpsec.org/mailman/listinfo/devel

Reply via email to