summary refs log tree commit diff stats
path: root/docs/devel/qapi-code-gen.txt
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2019-02-14 16:22:38 +0100
committerMarkus Armbruster <armbru@redhat.com>2019-02-18 14:44:04 +0100
commit5d75648b56e6e400eafaa1c2c8616ffc5ae6148e (patch)
tree726cd271079330d6fd489ba0f31d773e31f04cd2 /docs/devel/qapi-code-gen.txt
parentc2e196a9b41235a308fb6d1c516aa91ba0a807c8 (diff)
downloadfocaccia-qemu-5d75648b56e6e400eafaa1c2c8616ffc5ae6148e.tar.gz
focaccia-qemu-5d75648b56e6e400eafaa1c2c8616ffc5ae6148e.zip
qapi: Generate QAPIEvent stuff into separate files
Having to include qapi-events.h just for QAPIEvent is suboptimal, but
quite tolerable now.  It'll become problematic when we have events
conditional on the target, because then qapi-events.h won't be usable
from target-independent code anymore.  Avoid that by generating it
into separate files.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190214152251.2073-6-armbru@redhat.com>
Diffstat (limited to 'docs/devel/qapi-code-gen.txt')
-rw-r--r--docs/devel/qapi-code-gen.txt46
1 files changed, 31 insertions, 15 deletions
diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt
index c9ba8ddb2e..b517b0cfbf 100644
--- a/docs/devel/qapi-code-gen.txt
+++ b/docs/devel/qapi-code-gen.txt
@@ -1381,11 +1381,15 @@ qapi_event_send_EVENT().
 
 The following files are created:
 
-$(prefix)qapi-events.h - Function prototypes for each event type, plus an
-                        enumeration of all event names
+$(prefix)qapi-events.h - Function prototypes for each event type
 
 $(prefix)qapi-events.c - Implementation of functions to send an event
 
+$(prefix)qapi-emit-events.h - Enumeration of all event names, and
+                              common event code declarations
+
+$(prefix)qapi-emit-events.c - Common event code definitions
+
 Example:
 
     $ cat qapi-generated/example-qapi-events.h
@@ -1397,21 +1401,8 @@ Example:
     #include "qapi/util.h"
     #include "example-qapi-types.h"
 
-
     void qapi_event_send_my_event(void);
 
-    typedef enum example_QAPIEvent {
-        EXAMPLE_QAPI_EVENT_MY_EVENT,
-        EXAMPLE_QAPI_EVENT__MAX,
-    } example_QAPIEvent;
-
-    #define example_QAPIEvent_str(val) \
-        qapi_enum_lookup(&example_QAPIEvent_lookup, (val))
-
-    extern const QEnumLookup example_QAPIEvent_lookup;
-
-    void example_qapi_event_emit(example_QAPIEvent event, QDict *qdict);
-
     #endif /* EXAMPLE_QAPI_EVENTS_H */
     $ cat qapi-generated/example-qapi-events.c
 [Uninteresting stuff omitted...]
@@ -1427,6 +1418,31 @@ Example:
         qobject_unref(qmp);
     }
 
+[Uninteresting stuff omitted...]
+    $ cat qapi-generated/example-qapi-emit-events.h
+[Uninteresting stuff omitted...]
+
+    #ifndef EXAMPLE_QAPI_EMIT_EVENTS_H
+    #define EXAMPLE_QAPI_EMIT_EVENTS_H
+
+    #include "qapi/util.h"
+
+    typedef enum example_QAPIEvent {
+        EXAMPLE_QAPI_EVENT_MY_EVENT,
+        EXAMPLE_QAPI_EVENT__MAX,
+    } example_QAPIEvent;
+
+    #define example_QAPIEvent_str(val) \
+        qapi_enum_lookup(&example_QAPIEvent_lookup, (val))
+
+    extern const QEnumLookup example_QAPIEvent_lookup;
+
+    void example_qapi_event_emit(example_QAPIEvent event, QDict *qdict);
+
+    #endif /* EXAMPLE_QAPI_EMIT_EVENTS_H */
+    $ cat qapi-generated/example-qapi-emit-events.c
+[Uninteresting stuff omitted...]
+
     const QEnumLookup example_QAPIEvent_lookup = {
         .array = (const char *const[]) {
             [EXAMPLE_QAPI_EVENT_MY_EVENT] = "MY_EVENT",