qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Anthony Liguori" <anthony@codemonkey.ws>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH] qom: helper macro for adding read-only properties
Date: Sun, 15 Sep 2013 23:06:20 +0300	[thread overview]
Message-ID: <20130915200620.GA7526@redhat.com> (raw)
In-Reply-To: <CAFEAcA8NivyOvMRHjSQJR+Z--J0agGp1qCeWPY-vb8U+UvKBjw@mail.gmail.com>

On Sun, Sep 15, 2013 at 06:54:35PM +0100, Peter Maydell wrote:
> On 15 September 2013 18:23, Michael S. Tsirkin <mst@redhat.com> wrote:
> > +/* Add a property that is an integer constant. */
> > +#define OBJECT_ADD_PROP_CONST(obj, name, value)                      \
> > +    do {                                                                    \
> > +        void OBJECT_ADD_PROP_GET(Object *OBJECT_ADD_PROP_OBJ,               \
> > +                                 struct Visitor *OBJECT_ADD_PROP_VISITOR,   \
> > +                                 void *OBJECT_ADD_PROP_OPAQUE,              \
> > +                                 const char *OBJECT_ADD_PROP_NAME,          \
> > +                                 struct Error **OBJECT_ADD_PROP_VALUE_ERR)  \
> > +        {                                                                   \
> > +            int64_t OBJECT_ADD_PROP_VALUE = value;                          \
> > +                                                                            \
> > +            visit_type_int64(OBJECT_ADD_PROP_VISITOR,                       \
> > +                             &OBJECT_ADD_PROP_VALUE,                        \
> > +                             OBJECT_ADD_PROP_NAME,                          \
> > +                             OBJECT_ADD_PROP_VALUE_ERR);                    \
> > +        }                                                                   \
> > +        object_property_add(obj, name, "int", OBJECT_ADD_PROP_GET,          \
> > +                            NULL, NULL, NULL, NULL);                        \
> > +    } while (0)
> 
> This won't compile in clang, because it doesn't support nested
> functions. Clang is our primary compiler for MacOS hosts and
> is useful for various testing scenarios too (like its "integer sanitizing"
> compile options) so I'd rather we didn't break it...
> 
> thanks
> -- PMM

Hmm nasty.
I guess we can get by using static variables.

  reply	other threads:[~2013-09-15 20:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-15 17:23 [Qemu-devel] [PATCH] qom: helper macro for adding read-only properties Michael S. Tsirkin
2013-09-15 17:54 ` Peter Maydell
2013-09-15 20:06   ` Michael S. Tsirkin [this message]
2013-09-16  6:32 ` Andreas Färber
2013-09-16 12:33   ` Michael S. Tsirkin
2013-09-16 15:24     ` Andreas Färber
2013-09-16 15:41       ` Paolo Bonzini
2013-09-16 15:48       ` Michael S. Tsirkin
2013-09-16 15:56         ` Paolo Bonzini
2013-09-16 16:01           ` Michael S. Tsirkin
2013-09-16 16:07             ` Paolo Bonzini
2013-09-16 16:51               ` Michael S. Tsirkin
2013-09-16 17:03                 ` Paolo Bonzini
2013-09-16 16:07   ` Michael S. Tsirkin

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=20130915200620.GA7526@redhat.com \
    --to=mst@redhat.com \
    --cc=afaerber@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).