"x-" is marked experimental, and may be withdrawn or changed
incompatibly in a future release.
+Pragma 'name-case-whitelist' lets you violate the rules on use of
+upper and lower case. Use for new code is strongly discouraged.
+
In the rest of this document, usage lines are given for each
expression type, with literal strings written in lower case and
placeholders written in capitals. If a literal string includes a
Pragma 'returns-whitelist' takes a list of command names that may
violate the rules on permitted return types. Default is none.
+Pragma 'name-case-whitelist' takes a list of names that may violate
+rules on use of upper- vs. lower-case letters. Default is none.
+
=== Struct types ===
'query-migrate-cache-size',
'query-tpm-models',
'query-tpm-types',
- 'ringbuf-read' ] } }
+ 'ringbuf-read' ],
+ 'name-case-whitelist': [
+ 'ACPISlotType', # DIMM, visible through query-acpi-ospm-status
+ 'CpuInfoMIPS', # PC, visible through query-cpu
+ 'CpuInfoTricore', # PC, visible through query-cpu
+ 'QapiErrorClass', # all members, visible through errors
+ 'UuidInfo', # UUID, visible through query-uuid
+ 'X86CPURegister32', # all members, visible indirectly through qom-get
+ 'q_obj_CpuInfo-base' # CPU, visible through query-cpu
+ ] } }
# QAPI common definitions
{ 'include': 'qapi/common.json' }
returns_whitelist = []
# Whitelist of entities allowed to violate case conventions
-case_whitelist = [
- # From QMP:
- 'ACPISlotType', # DIMM, visible through query-acpi-ospm-status
- 'CpuInfoMIPS', # PC, visible through query-cpu
- 'CpuInfoTricore', # PC, visible through query-cpu
- 'QapiErrorClass', # all members, visible through errors
- 'UuidInfo', # UUID, visible through query-uuid
- 'X86CPURegister32', # all members, visible indirectly through qom-get
- 'q_obj_CpuInfo-base', # CPU, visible through query-cpu
-]
+name_case_whitelist = []
enum_types = []
struct_types = []
self.docs.extend(exprs_include.docs)
def _pragma(self, name, value, info):
- global doc_required, returns_whitelist
+ global doc_required, returns_whitelist, name_case_whitelist
if name == 'doc-required':
if not isinstance(value, bool):
raise QAPISemError(info,
"Pragma returns-whitelist must be"
" a list of strings")
returns_whitelist = value
+ elif name == 'name-case-whitelist':
+ if (not isinstance(value, list)
+ or any([not isinstance(elt, str) for elt in value])):
+ raise QAPISemError(info,
+ "Pragma name-case-whitelist must be"
+ " a list of strings")
+ name_case_whitelist = value
else:
raise QAPISemError(info, "Unknown pragma '%s'" % name)
def check_clash(self, info, seen):
cname = c_name(self.name)
- if cname.lower() != cname and self.owner not in case_whitelist:
+ if cname.lower() != cname and self.owner not in name_case_whitelist:
raise QAPISemError(info,
"%s should not use uppercase" % self.describe())
if cname in seen: