diff options
author | Markus Armbruster <armbru@redhat.com> | 2021-03-23 10:40:24 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2021-03-23 22:31:43 +0100 |
commit | 407efbf9e776ade8e8d09b778851834f91b225a1 (patch) | |
tree | 23a217b66c410f7f7827060106dba5dc24ef8109 /scripts/qapi | |
parent | 5aceeac04de50e3a9d5c2a965379324659a94be0 (diff) |
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/qapi')
-rw-r--r-- | scripts/qapi/expr.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py index ba9f7ad350..d968609c48 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) |