qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Franciosi <felipe@nutanix.com>
To: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>,
	Eric Blake <eblake@redhat.com>,
	"Daniel P. Berrange" <berrange@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>,
	qemu-devel@nongnu.org, Felipe Franciosi <felipe@nutanix.com>
Subject: [Qemu-devel] [PATCH 1/2] compiler: add ignore_value() macro
Date: Wed, 21 Sep 2016 16:27:01 +0100	[thread overview]
Message-ID: <1474471622-12802-1-git-send-email-felipe@nutanix.com> (raw)

On GCC versions 3.4 and newer, simply using (void) in front of a
function that has been declared with WUR will no longer suppress a
compilation warning. This commit brings the ignore_value() macro from
GNULIB's ignore_value.h, licensed under the terms of LGPLv2+.

See the link below for the original author's comment:
https://lists.nongnu.org/archive/html/qemu-devel/2016-09/msg05148.html

Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
---
 include/qemu/compiler.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index 338d3a6..655d0c7 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -26,6 +26,14 @@
 #define QEMU_WARN_UNUSED_RESULT
 #endif
 
+/* The ignore_value() macro comes from GNULIB's LGPLv2+ ignore-value.h */
+#if QEMU_GNUC_PREREQ(3, 4)
+# define ignore_value(x) \
+         (__extension__ ({ __typeof__ (x) __x = (x); (void) __x; }))
+#else
+# define ignore_value(x) ((void) (x))
+#endif
+
 #if QEMU_GNUC_PREREQ(4, 0)
 #define QEMU_SENTINEL __attribute__((sentinel))
 #else
-- 
1.9.5

             reply	other threads:[~2016-09-21 15:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21 15:27 Felipe Franciosi [this message]
2016-09-21 15:27 ` [Qemu-devel] [PATCH 2/2] replay: Ignore the return value of fwrite() Felipe Franciosi
2016-09-21 18:17   ` Eric Blake
2016-09-21 18:43     ` Felipe Franciosi
2016-09-21 18:15 ` [Qemu-devel] [PATCH 1/2] compiler: add ignore_value() macro Eric Blake
2016-10-12 17:20   ` Felipe Franciosi
2016-10-25 15:21     ` Felipe Franciosi
2016-11-18 21:09       ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1474471622-12802-1-git-send-email-felipe@nutanix.com \
    --to=felipe@nutanix.com \
    --cc=Pavel.Dovgaluk@ispras.ru \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).