qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qom: helper macro for adding read-only properti


From: Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH] qom: helper macro for adding read-only properties
Date: Sun, 15 Sep 2013 23:06:20 +0300

On Sun, Sep 15, 2013 at 06:54:35PM +0100, Peter Maydell wrote:
> On 15 September 2013 18:23, Michael S. Tsirkin <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]