aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi-event.py1
-rw-r--r--scripts/qapi-types.py4
-rw-r--r--scripts/qapi.py3
3 files changed, 8 insertions, 0 deletions
diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py
index bcbef1035f..07b4b70199 100644
--- a/scripts/qapi-event.py
+++ b/scripts/qapi-event.py
@@ -217,6 +217,7 @@ fdef.write(mcgen('''
fdecl.write(mcgen('''
#include "qapi/error.h"
+#include "qapi/util.h"
#include "qapi/qmp/qdict.h"
#include "%(prefix)sqapi-types.h"
diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py
index b45e7b5634..7e3051dbb9 100644
--- a/scripts/qapi-types.py
+++ b/scripts/qapi-types.py
@@ -292,6 +292,10 @@ fdef.write(mcgen('''
''',
prefix=prefix))
+fdecl.write(mcgen('''
+#include "qapi/util.h"
+'''))
+
schema = QAPISchema(input_file)
gen = QAPISchemaGenTypeVisitor()
schema.visit(gen)
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 3693b520da..8736b9c786 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))