aboutsummaryrefslogtreecommitdiff
path: root/scripts/qapi.py
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-08-24 10:46:07 +0200
committerMarkus Armbruster <armbru@redhat.com>2017-09-04 13:09:13 +0200
commit5b5f825d44306b18509cd10ba9ac6983e90d6e0f (patch)
tree4eaa8543ba0c568929b6879ff239b70ddfcef056 /scripts/qapi.py
parent1c236ba5319d6141964fddb38f1d942cebcaed05 (diff)
downloadqemu-5b5f825d44306b18509cd10ba9ac6983e90d6e0f.zip
qemu-5b5f825d44306b18509cd10ba9ac6983e90d6e0f.tar.gz
qemu-5b5f825d44306b18509cd10ba9ac6983e90d6e0f.tar.bz2
qapi: Generate FOO_str() macro for QAPI enum FOO
The next commit will put it to use. May look pointless now, but we're going to change the FOO_lookup's type, and then it'll help. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1503564371-26090-13-git-send-email-armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Diffstat (limited to 'scripts/qapi.py')
-rw-r--r--scripts/qapi.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 3693b52..8736b9c 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -1894,6 +1894,9 @@ typedef enum %(c_name)s {
ret += mcgen('''
+#define %(c_name)s_str(val) \\
+ qapi_enum_lookup(%(c_name)s_lookup, (val))
+
extern const char *const %(c_name)s_lookup[];
''',
c_name=c_name(name))