From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MQLzk-00024W-LQ for qemu-devel@nongnu.org; Mon, 13 Jul 2009 09:55:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MQLzf-0001rq-AZ for qemu-devel@nongnu.org; Mon, 13 Jul 2009 09:55:03 -0400 Received: from [199.232.76.173] (port=40997 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MQLze-0001rO-U8 for qemu-devel@nongnu.org; Mon, 13 Jul 2009 09:54:59 -0400 Received: from mail-gx0-f220.google.com ([209.85.217.220]:59695) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MQLze-0005w0-Hm for qemu-devel@nongnu.org; Mon, 13 Jul 2009 09:54:58 -0400 Received: by gxk20 with SMTP id 20so13644707gxk.10 for ; Mon, 13 Jul 2009 06:54:58 -0700 (PDT) Message-ID: <4A5B3CB0.7070604@codemonkey.ws> Date: Mon, 13 Jul 2009 08:54:56 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 2/7] add strify() macros. References: <1247478048-17257-1-git-send-email-kraxel@redhat.com> <1247478048-17257-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1247478048-17257-3-git-send-email-kraxel@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org, Paul Brook Gerd Hoffmann wrote: > Signed-off-by: Gerd Hoffmann > --- > 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