qemu-e2k/scripts/qapi
Marc-André Lureau ded9fc28b5 qapi: add #if/#endif helpers
Add helpers to wrap generated code with #if/#endif lines.

A later patch wants to use QAPIGen for generating C snippets rather
than full C files with copyright headers etc.  Splice in class
QAPIGenCCode between QAPIGen and QAPIGenC.

Add a 'with' statement context manager that will be used to wrap
generator visitor methods.  The manager will check if code was
generated before adding #if/#endif lines on QAPIGenCSnippet
objects. Used in the following patches.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20180703155648.11933-7-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-07-03 18:38:53 +02:00
..
__init__.py
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: add 'ifcond' to visitor methods 2018-07-03 18:38:53 +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