Received: from eggs.gnu.org ([2001:4830:134:3::10]:49376) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXrsD-00048d-Mo for qemu-devel@nongnu.org; Fri, 04 Sep 2015 10:21:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXrsC-0001Rr-UE for qemu-devel@nongnu.org; Fri, 04 Sep 2015 10:21:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49788) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXrsC-0001RV-JH for qemu-devel@nongnu.org; Fri, 04 Sep 2015 10:21:48 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 2DA5CC0AB675 for ; Fri, 4 Sep 2015 14:21:48 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t84ELkM0028381 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 4 Sep 2015 10:21:47 -0400 From: Markus Armbruster Date: Fri, 4 Sep 2015 16:21:23 +0200 Message-Id: <1441376500-14784-17-git-send-email-armbru@redhat.com> In-Reply-To: <1441376500-14784-1-git-send-email-armbru@redhat.com> References: <1441376500-14784-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PULL 16/33] qapi: Document flaws in checking of names List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org We don't actually enforce our "other than downstream extensions [...], all names should begin with a letter" rule. Add a FIXME. We should reject names that differ only in '_' vs. '.' vs. '-', because they're liable to clash in generated C. Add a FIXME. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- scripts/qapi.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/qapi.py b/scripts/qapi.py index e7c814d..4879982 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -341,6 +341,8 @@ def discriminator_find_enum_define(expr): return find_enum(discriminator_type) +# FIXME should enforce "other than downstream extensions [...], all +# names should begin with a letter". valid_name = re.compile('^[a-zA-Z_][a-zA-Z0-9_.-]*$') def check_name(expr_info, source, name, allow_optional = False, enum_member = False): @@ -367,6 +369,8 @@ def check_name(expr_info, source, name, allow_optional = False, def add_name(name, info, meta, implicit = False): global all_names check_name(info, "'%s'" % meta, name) + # FIXME should reject names that differ only in '_' vs. '.' + # vs. '-', because they're liable to clash in generated C. if name in all_names: raise QAPIExprError(info, "%s '%s' is already defined" -- 2.4.3