From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zr5AM-0001G5-8j for qemu-devel@nongnu.org; Tue, 27 Oct 2015 10:24:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zr5AI-0004T6-7w for qemu-devel@nongnu.org; Tue, 27 Oct 2015 10:23:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36244) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zr5AI-0004Sx-09 for qemu-devel@nongnu.org; Tue, 27 Oct 2015 10:23:54 -0400 References: <1445898903-12082-1-git-send-email-eblake@redhat.com> <1445898903-12082-24-git-send-email-eblake@redhat.com> <87mvv4iux6.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <562F88F8.4060508@redhat.com> Date: Tue, 27 Oct 2015 08:23:52 -0600 MIME-Version: 1.0 In-Reply-To: <87mvv4iux6.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="0qiqcOB7L9Man1p6GFLbsvMSiCPwps1Dg" Subject: Re: [Qemu-devel] [PATCH v11 23/24] qapi: Reserve 'u' member name List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --0qiqcOB7L9Man1p6GFLbsvMSiCPwps1Dg Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/27/2015 02:21 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> Now that we have separated union tag values from colliding with >> non-variant C names, by naming the union 'u', we should reserve >> this name for our use. Note that we want to forbid 'u' even in >> a struct with no variants, because it is possible for a future >> qemu release to extend QMP in a backwards-compatible manner while >> converting from a struct to a flat union. Fortunately, no >> existing clients were using this member name. If we ever find >> the need for QMP to have a member 'u', we could at that time >> relax things, perhaps by having c_name() munge the QMP member to >> 'q_u'. >> >> Note that we cannot forbid 'u' everywhere (by adding the >> rejection code to check_name()), because the existing QKeyCode >> enum already uses it; therefore we only reserve it as a struct >> type member name. >> >> Signed-off-by: Eric Blake >> >> --- >> v11: commit message tweaks, use c_name(), tweak test names >> - if c_name(key).startswith('has_'): >> + if c_name(key, False) =3D=3D 'u' or c_name(key).startswith('h= as_'): >=20 > Slightly odd: new c_name() has protect=3DFalse, the existing one doesn'= t. > While we don't really need protect=3DFalse, it feels a bit cleaner. If= > you like, I can add it to the existing one when it gets added in PATCH > 05. You're right - either both places need it, or neither place does. Argument _for_ using c_name(, False): that's what we do in check_name() when looking for 'q_', because we have to (if we use the default c_name(, True), then the name gets munged and starts with q_ even though the original did not). So even though we don't munge 'u' or 'has_' now, if c_name() starts munging them in the future, consistently using c_name(, False) here will protect us. So yes, make the change in patch 5= =2E --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --0qiqcOB7L9Man1p6GFLbsvMSiCPwps1Dg Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWL4j4AAoJEKeha0olJ0NqOEoH/0pcChrwCIOEDl1FqEtwzwnc 1KfMBowSjt83LB2Cy8pTaubB1+NrwzervvSGUPE3nmH1ffkGZ3ZFNpnrVPASUoZr 4Szf4uvWT1LV3+VA1XiPI/UojWYsMROCylao9HkMB8obbfjf2SZ1OnV1rr4+/geb HbGD0eQ69xsA9MyJC67HsEuYqSkbmAJpd6sCIhomt+2oP2Dvgp873nnVbqs/3tGK b5pchMBpeOB7drPHXjeeFApe2FQNc4JPfGE3jq9/dAU+ImwDZNLe2VA+HSTbJgyG D7Rk/LarKAaEEyuz0W/sfkNv/15FFQJGiIcZxyqaifys+7EmZ0AJ7x8lJps5OqQ= =39oI -----END PGP SIGNATURE----- --0qiqcOB7L9Man1p6GFLbsvMSiCPwps1Dg--