From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41359) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLIYR-0001Ld-3a for qemu-devel@nongnu.org; Sun, 15 Sep 2013 16:04:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLIYL-0001qs-BJ for qemu-devel@nongnu.org; Sun, 15 Sep 2013 16:04:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56009) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLIYK-0001pw-RB for qemu-devel@nongnu.org; Sun, 15 Sep 2013 16:04:17 -0400 Date: Sun, 15 Sep 2013 23:06:20 +0300 From: "Michael S. Tsirkin" Message-ID: <20130915200620.GA7526@redhat.com> References: <20130915172331.GA2821@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH] qom: helper macro for adding read-only properties List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Anthony Liguori , Paolo Bonzini , QEMU Developers , Stefan Hajnoczi , Andreas =?iso-8859-1?Q?F=E4rber?= On Sun, Sep 15, 2013 at 06:54:35PM +0100, Peter Maydell wrote: > On 15 September 2013 18:23, Michael S. Tsirkin 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.