|
| From: | Manos Pitsidianakis |
| Subject: | Re: [PATCH 2/2] Add warn_unused_result attr to AUD_register_card |
| Date: | Fri, 10 Nov 2023 13:25:56 +0200 |
| User-agent: | meli 0.8.2 |
On Fri, 10 Nov 2023 13:20, "Daniel P. Berrangé" <berrange@redhat.com> wrote:
Your approach to the problem:
if (!AUD_register_card("OMAP EAC", &s->codec.card, &error_fatal)) {
exit(1);
}
is adding dead-code because the exit(1) will never be reachable. So while
it lets you squelch the unused result warning, it is verbose and misleading
to anyone who sees it.
Perhaps a more viable option is to pull in gnulib's ignore_value macro
#define ignore_value(x) \
(__extension__ ({ __typeof__ (x) __x = (x); (void) __x; }))
and then we would have just this:
ignore_value(AUD_register_card("OMAP EAC", &s->codec.card, &error_fatal));
Good suggestion, thanks!And to be fair, I did put a comment directly above that line to explain the unreachable code path. :)
+ /*+ * We pass error_fatal so on error QEMU will exit(). But we check the + * return value to make the warn_unused_result compiler warning go away.
+ */
| [Prev in Thread] | Current Thread | [Next in Thread] |