summary refs log tree commit diff stats
path: root/scripts/qapi-types.py
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-02-26 12:16:46 +0000
committerPeter Maydell <peter.maydell@linaro.org>2015-02-26 12:16:46 +0000
commit041ccc922ee474693a2869d4e3b59e920c739bc0 (patch)
tree36b046a650b26079b3cbf634ee9ae8fe19384319 /scripts/qapi-types.py
parent2559db069628981bfdc90637fac5bf1b4f4e8ef5 (diff)
parent912ae9c88669d0a0cbae1f20b8c80dde8e526251 (diff)
downloadfocaccia-qemu-041ccc922ee474693a2869d4e3b59e920c739bc0.tar.gz
focaccia-qemu-041ccc922ee474693a2869d4e3b59e920c739bc0.zip
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
* remotes/qmp-unstable/queue/qmp:
  qapi-types: add C99 index names to arrays
  monitor: Fix missing err = NULL in client_migrate_info()
  balloon: Fix typo
  hmp: Fix warning from smatch (wrong argument in function call)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'scripts/qapi-types.py')
-rw-r--r--scripts/qapi-types.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py
index 1eb272dd26..db872180c6 100644
--- a/scripts/qapi-types.py
+++ b/scripts/qapi-types.py
@@ -123,16 +123,19 @@ const char *%(name)s_lookup[] = {
                          name=name)
     i = 0
     for value in values:
+        index = generate_enum_full_value(name, value)
         ret += mcgen('''
-    "%(value)s",
+    [%(index)s] = "%(value)s",
 ''',
-                     value=value)
+                     index = index, value = value)
 
+    max_index = generate_enum_full_value(name, 'MAX')
     ret += mcgen('''
-    NULL,
+    [%(max_index)s] = NULL,
 };
 
-''')
+''',
+        max_index=max_index)
     return ret
 
 def generate_enum(name, values):