On 04/27/2018 11:15 AM, Eric Blake wrote:
On 04/27/2018 02:20 AM, gaosheng cui wrote:
> Hi,using ignore_value in libvirt source code
> to do function return value processing,but I
> can’t understand about it,can you give me some tips?thanks very much!
Is your question about what ignore_value() does?
Or, if your question is "Where is ignore_value defined", the answer is
that libvirt uses gnulib, and gnulib's "ignore-value.h" (imported during
./bootstrap if you are building from git; if you are building a release
tarball then it was already part of the tarball under lib/) contains
this definition:
/* Normally casting an expression to void discards its value, but GCC
versions 3.4 and newer have __attribute__ ((__warn_unused_result__))
which may cause unwanted diagnostics in that case. Use __typeof__
and __extension__ to work around the problem, if the workaround is
known to be needed. */
#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
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization:
qemu.org |
libvirt.org