diff options
author | Markus Armbruster <armbru@redhat.com> | 2019-09-13 22:13:44 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2019-09-24 14:07:22 +0200 |
commit | 398969fe1c6f696e19d0f317dd055c6b17e2cee6 (patch) | |
tree | 6e4c0639a119977828f97d4a63b2b5d879f1de5b /scripts | |
parent | 0ced9531f17c1c28fa4f29b352729c7f40c2ae30 (diff) |
qapi: Adjust frontend errors to say enum value, not member
For consistency with docs/devel/qapi-code-gen.txt.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190913201349.24332-12-armbru@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/qapi/common.py | 11 | ||||
-rw-r--r-- | scripts/qapi/events.py | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index 3393a049cc..a538d2f37c 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -1340,7 +1340,7 @@ class QAPISchemaEnumType(QAPISchemaType): def __init__(self, name, info, doc, ifcond, members, prefix): QAPISchemaType.__init__(self, name, info, doc, ifcond) for m in members: - assert isinstance(m, QAPISchemaMember) + assert isinstance(m, QAPISchemaEnumMember) m.set_owner(name) assert prefix is None or isinstance(prefix, str) self.members = members @@ -1551,6 +1551,10 @@ class QAPISchemaMember(object): return "'%s' %s" % (self.name, self._pretty_owner()) +class QAPISchemaEnumMember(QAPISchemaMember): + role = 'value' + + class QAPISchemaFeature(QAPISchemaMember): role = 'feature' @@ -1807,7 +1811,8 @@ class QAPISchema(object): return [QAPISchemaFeature(f['name'], f.get('if')) for f in features] def _make_enum_members(self, values): - return [QAPISchemaMember(v['name'], v.get('if')) for v in values] + return [QAPISchemaEnumMember(v['name'], v.get('if')) + for v in values] def _make_implicit_enum_type(self, name, info, ifcond, values): # See also QAPISchemaObjectTypeMember._pretty_owner() @@ -2223,7 +2228,7 @@ const QEnumLookup %(c_name)s_lookup = { def gen_enum(name, members, prefix=None): # append automatically generated _MAX value - enum_members = members + [QAPISchemaMember('_MAX')] + enum_members = members + [QAPISchemaEnumMember('_MAX')] ret = mcgen(''' diff --git a/scripts/qapi/events.py b/scripts/qapi/events.py index e0abfef7b0..7062553cf3 100644 --- a/scripts/qapi/events.py +++ b/scripts/qapi/events.py @@ -194,7 +194,7 @@ void %(event_emit)s(%(event_enum)s event, QDict *qdict); self._event_emit_name)) # Note: we generate the enum member regardless of @ifcond, to # keep the enumeration usable in target-independent code. - self._event_enum_members.append(QAPISchemaMember(name)) + self._event_enum_members.append(QAPISchemaEnumMember(name)) def gen_events(schema, output_dir, prefix): |