aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi/expr.py5
-rw-r--r--scripts/qapi/parser.py3
-rw-r--r--scripts/qapi/source.py2
3 files changed, 8 insertions, 2 deletions
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index d778107c18..9193e68763 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -70,8 +70,9 @@ def check_defn_name_str(name, info, meta):
if meta == 'event':
check_name_upper(name, info, meta)
elif meta == 'command':
- check_name_lower(name, info, meta,
- permit_upper=True, permit_underscore=True)
+ check_name_lower(
+ name, info, meta,
+ permit_underscore=name in info.pragma.command_name_exceptions)
else:
check_name_camel(name, info, meta)
if name.endswith('Kind') or name.endswith('List'):
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index c16b8b6995..58267c3db9 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -132,6 +132,9 @@ class QAPISchemaParser:
raise QAPISemError(info,
"pragma 'doc-required' must be boolean")
info.pragma.doc_required = value
+ elif name == 'command-name-exceptions':
+ self._check_pragma_list_of_str(name, value, info)
+ info.pragma.command_name_exceptions = value
elif name == 'command-returns-exceptions':
self._check_pragma_list_of_str(name, value, info)
info.pragma.command_returns_exceptions = value
diff --git a/scripts/qapi/source.py b/scripts/qapi/source.py
index d8f9ec377f..03b6ede082 100644
--- a/scripts/qapi/source.py
+++ b/scripts/qapi/source.py
@@ -21,6 +21,8 @@ class QAPISchemaPragma:
def __init__(self) -> None:
# Are documentation comments required?
self.doc_required = False
+ # Commands whose names may use '_'
+ self.command_name_exceptions: List[str] = []
# Commands allowed to return a non-dictionary
self.command_returns_exceptions: List[str] = []
# Types whose member names may violate case conventions