aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2021-03-23 10:40:24 +0100
committerMarkus Armbruster <armbru@redhat.com>2021-03-23 22:31:43 +0100
commit407efbf9e776ade8e8d09b778851834f91b225a1 (patch)
tree23a217b66c410f7f7827060106dba5dc24ef8109 /scripts
parent5aceeac04de50e3a9d5c2a965379324659a94be0 (diff)
downloadqemu-407efbf9e776ade8e8d09b778851834f91b225a1.zip
qemu-407efbf9e776ade8e8d09b778851834f91b225a1.tar.gz
qemu-407efbf9e776ade8e8d09b778851834f91b225a1.tar.bz2
qapi: Enforce enum member naming rules
Enum members should use '-', not '_'. Enforce this. Fix the fixable offenders (all in tests/), and add the remainder to pragma member-name-exceptions. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20210323094025.3569441-28-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi/expr.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index ba9f7ad..d968609 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -229,7 +229,7 @@ def check_enum(expr, info):
if prefix is not None and not isinstance(prefix, str):
raise QAPISemError(info, "'prefix' must be a string")
- permit_upper = name in info.pragma.member_name_exceptions
+ permissive = name in info.pragma.member_name_exceptions
members[:] = [m if isinstance(m, dict) else {'name': m}
for m in members]
@@ -243,7 +243,8 @@ def check_enum(expr, info):
if member_name[0].isdigit():
member_name = 'd' + member_name # Hack: hide the digit
check_name_lower(member_name, info, source,
- permit_upper, permit_underscore=True)
+ permit_upper=permissive,
+ permit_underscore=permissive)
check_if(member, info, source)