From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TP8SB-0004KR-Uj for qemu-devel@nongnu.org; Fri, 19 Oct 2012 05:01:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TP8S3-0002AJ-KY for qemu-devel@nongnu.org; Fri, 19 Oct 2012 05:01:15 -0400 Received: from mx4-phx2.redhat.com ([209.132.183.25]:56660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TP8S3-0002AB-C8 for qemu-devel@nongnu.org; Fri, 19 Oct 2012 05:01:07 -0400 Date: Fri, 19 Oct 2012 05:01:03 -0400 (EDT) From: Paolo Bonzini Message-ID: <1902505708.13358217.1350637263113.JavaMail.root@redhat.com> In-Reply-To: <20121019030613.GX16157@illuin> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 24/26] qidl: add QAPI-based code generator List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Roth Cc: kwolf@redhat.com, peter maydell , aliguori@us.ibm.com, qemu-devel@nongnu.org, blauwirbel@gmail.com > > >> In general, if struct X is QIDL_DECLAREd and only has > > >> q_immutable > > >> fields, it can be taken as q_immutable. Hence for example the > > >> base > > >> class should not need any decoration; ISADevice will be seen as > > >> q_immutable, but PCIDevice will be seen as serialized. But even > > >> if a > > >> struct is not QIDL_DECLAREd, it should be possible to apply a > > >> tag to a > > >> typedef, and have it always applied to the members. > > > > Hmm, this wasn't the best choice of words. What I actually meant > > was "to apply a tag to a typedef, and have it always applied to members > > of that type in other structs". Like > > > > typedef struct Notifier Notifier q_immutable; > > This would be really nice, but the parser is gonna need more hardening > before we can remove it's "scan for lines beginning with QIDL_START* > and parse what we expect to come afterward" behavior. There's also > build time implications. An alternative I'm considering is: > > typedef struct Notifier Notifier; > > QIDL_DECLARE_PUBLIC(Notifier, q_immutable) { > ... > } > > This will make all the fields q_immutable by default (individual fields > can override it in the future when the need arises). Then we teach the > code generator to drop serialization for any struct fields who don't > have any serializeable fields (mainly to avoid a bunch of nil fields > in the serialized code (e.g. 'notifier1': {})). > > Seem reasonable? Optimal, no... reasonable, yes. :) Paolo