summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2013-09-09 10:02:28 +0100
committerDaniel P. Berrange <berrange@redhat.com>2013-11-12 18:02:07 +0000
commite4f29984fa6662af4f0a7dea18dc68199248ce11 (patch)
tree941efcc99343f42bb3bc1f9a2a7b6e4f8c68cead
parenta825a495cd7ba38edd5d085db51780a861ae6a0d (diff)
downloadlibvirt-python-v6-e4f29984fa6662af4f0a7dea18dc68199248ce11.tar.gz
libvirt-python-v6-e4f29984fa6662af4f0a7dea18dc68199248ce11.tar.xz
libvirt-python-v6-e4f29984fa6662af4f0a7dea18dc68199248ce11.zip
Import gnulib's ignore_value macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
-rw-r--r--libvirt-utils.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/libvirt-utils.h b/libvirt-utils.h
index 05c1135..a62db2b 100644
--- a/libvirt-utils.h
+++ b/libvirt-utils.h
@@ -43,4 +43,15 @@
#define xalloc_oversized(n, s) \
((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n))
+
+/* The __attribute__((__warn_unused_result__)) feature
+ is available in gcc versions 3.4 and newer,
+ while the typeof feature has been available since 2.7 at least. */
+#if 3 < __GNUC__ + (4 <= __GNUC_MINOR__)
+# define ignore_value(x) \
+ (__extension__ ({ __typeof__ (x) __x = (x); (void) __x; }))
+#else
+# define ignore_value(x) ((void) (x))
+#endif
+
#endif /* __LIBVIRT_UTILS_H__ */