qemu-e2k/scripts/qapi
Marc-André Lureau d626b6c1ae qapi-introspect: add preprocessor conditions to generated QLit
This commit adds 'ifcond' conditions to top-level QLit objects.
Future work will add them to object and enum type members, i.e. within
QLit objects.

Extend the QLit generator to_qlit() to accept (@obj, @cond) tuples in
addition to just @obj.  The tuple causes the QLit generated for
objects for @obj with #if/#endif conditions for @cond.

See generated tests/test-qmp-introspect.c. Example diff after this
patch:

    --- before	2018-01-08 11:55:24.757083654 +0100
    +++ tests/test-qmp-introspect.c	2018-01-08 13:08:44.477641629 +0100
    @@ -51,6 +51,8 @@
             { "name", QLIT_QSTR("EVENT_F"), },
             {}
         })),
    +#if defined(TEST_IF_CMD)
    +#if defined(TEST_IF_STRUCT)
         QLIT_QDICT(((QLitDictEntry[]) {
             { "arg-type", QLIT_QSTR("5"), },
             { "meta-type", QLIT_QSTR("command"), },
    @@ -58,12 +60,16 @@
             { "ret-type", QLIT_QSTR("0"), },
             {}
         })),
    +#endif /* defined(TEST_IF_STRUCT) */
    +#endif /* defined(TEST_IF_CMD) */

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20180703155648.11933-9-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-07-03 18:38:54 +02:00
..
__init__.py qapi-gen: New common driver for code and doc generators 2018-03-02 13:14:09 -06:00
commands.py qapi: add 'ifcond' to visitor methods 2018-07-03 18:38:53 +02:00
common.py qapi: add #if/#endif helpers 2018-07-03 18:38:53 +02:00
doc.py qapi: add 'ifcond' to visitor methods 2018-07-03 18:38:53 +02:00
events.py qapi: add 'ifcond' to visitor methods 2018-07-03 18:38:53 +02:00
introspect.py qapi-introspect: add preprocessor conditions to generated QLit 2018-07-03 18:38:54 +02:00
types.py qapi: add 'ifcond' to visitor methods 2018-07-03 18:38:53 +02:00
visit.py qapi: add 'ifcond' to visitor methods 2018-07-03 18:38:53 +02:00