From: Anthony Liguori <anthony@codemonkey.ws>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org, Paul Brook <paul@codesourcery.com>
Subject: Re: [Qemu-devel] [PATCH 2/7] add strify() macros.
Date: Mon, 13 Jul 2009 08:54:56 -0500 [thread overview]
Message-ID: <4A5B3CB0.7070604@codemonkey.ws> (raw)
In-Reply-To: <1247478048-17257-3-git-send-email-kraxel@redhat.com>
Gerd Hoffmann wrote:
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> osdep.h | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/osdep.h b/osdep.h
> index ffbf221..ac660c8 100644
> --- a/osdep.h
> +++ b/osdep.h
> @@ -27,6 +27,11 @@
> #define unlikely(x) __builtin_expect(!!(x), 0)
> #endif
>
> +#ifndef strify
> +#define strify_i(a) # a
> +#define strify(a) strify_i(a)
> +#endif
> +
>
Could get even fancier with something like:
#define strify_i(a) # a
#define strify(a) strify_i(a)
#define to_prop(a) __builtin_choose_expr( \
__builtin_types_compatible_p(typeof(a), const char []), \
(a), \
__builtin_choose_expr( \
__builtin_types_compatible_p(typeof(a), int) || \
__builtin_types_compatible_p(typeof(a), double), \
strify(a), \
(int *)0))
It should be possible to use to_prop() for any property initializer.
Regards,
Anthony Liguori
next prev parent reply other threads:[~2009-07-13 13:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-13 9:40 [Qemu-devel] [PATCH v2 0/7] qdev: compat properties Gerd Hoffmann
2009-07-13 9:40 ` [Qemu-devel] [PATCH 1/7] cleanup: drop unused struct elements from VirtIOPCIProxy Gerd Hoffmann
2009-07-13 9:40 ` [Qemu-devel] [PATCH 2/7] add strify() macros Gerd Hoffmann
2009-07-13 13:54 ` Anthony Liguori [this message]
2009-07-13 14:59 ` Blue Swirl
2009-07-13 15:08 ` Anthony Liguori
2009-07-13 15:15 ` Gerd Hoffmann
2009-07-13 15:18 ` [Qemu-devel] " Måns Rullgård
2009-07-13 15:19 ` [Qemu-devel] " Gerd Hoffmann
2009-07-13 9:40 ` [Qemu-devel] [PATCH 3/7] qdev/compat: compat property infrastructure Gerd Hoffmann
2009-07-13 9:40 ` [Qemu-devel] [PATCH 4/7] qdev/compat: add pc-0.10 machine type Gerd Hoffmann
2009-07-13 9:40 ` [Qemu-devel] [PATCH 5/7] qdev/compat: virtio-blk-pci 0.10 compatibility Gerd Hoffmann
2009-07-13 9:40 ` [Qemu-devel] [PATCH 6/7] qdev/compat: virtio-balloon-pci " Gerd Hoffmann
2009-07-13 9:40 ` [Qemu-devel] [PATCH 7/7] qdev/compat: virtio-net-pci " Gerd Hoffmann
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=4A5B3CB0.7070604@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=kraxel@redhat.com \
--cc=paul@codesourcery.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).