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