qapi: add 'if' to top-level expressions
Accept 'if' key in top-level elements, accepted as string or list of string type. The following patches will modify the test visitor to check the value is correctly saved, and generate #if/#endif code (as a single #if/endif line or a series for a list). Example of 'if' key: { 'struct': 'TestIfStruct', 'data': { 'foo': 'int' }, 'if': 'defined(TEST_IF_STRUCT)' } The generated code is for now *unconditional*. Later patches generate the conditionals. Signed-off-by:Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Message-Id: <20180703155648.11933-2-marcandre.lureau@redhat.com> [Commit message and Documentation improved] Signed-off-by:
Markus Armbruster <armbru@redhat.com>
Showing
- docs/devel/qapi-code-gen.txt 29 additions, 0 deletionsdocs/devel/qapi-code-gen.txt
- scripts/qapi/common.py 29 additions, 6 deletionsscripts/qapi/common.py
- tests/Makefile.include 4 additions, 0 deletionstests/Makefile.include
- tests/qapi-schema/bad-if-empty-list.err 1 addition, 0 deletionstests/qapi-schema/bad-if-empty-list.err
- tests/qapi-schema/bad-if-empty-list.exit 1 addition, 0 deletionstests/qapi-schema/bad-if-empty-list.exit
- tests/qapi-schema/bad-if-empty-list.json 3 additions, 0 deletionstests/qapi-schema/bad-if-empty-list.json
- tests/qapi-schema/bad-if-empty-list.out 0 additions, 0 deletionstests/qapi-schema/bad-if-empty-list.out
- tests/qapi-schema/bad-if-empty.err 1 addition, 0 deletionstests/qapi-schema/bad-if-empty.err
- tests/qapi-schema/bad-if-empty.exit 1 addition, 0 deletionstests/qapi-schema/bad-if-empty.exit
- tests/qapi-schema/bad-if-empty.json 3 additions, 0 deletionstests/qapi-schema/bad-if-empty.json
- tests/qapi-schema/bad-if-empty.out 0 additions, 0 deletionstests/qapi-schema/bad-if-empty.out
- tests/qapi-schema/bad-if-list.err 1 addition, 0 deletionstests/qapi-schema/bad-if-list.err
- tests/qapi-schema/bad-if-list.exit 1 addition, 0 deletionstests/qapi-schema/bad-if-list.exit
- tests/qapi-schema/bad-if-list.json 3 additions, 0 deletionstests/qapi-schema/bad-if-list.json
- tests/qapi-schema/bad-if-list.out 0 additions, 0 deletionstests/qapi-schema/bad-if-list.out
- tests/qapi-schema/bad-if.err 1 addition, 0 deletionstests/qapi-schema/bad-if.err
- tests/qapi-schema/bad-if.exit 1 addition, 0 deletionstests/qapi-schema/bad-if.exit
- tests/qapi-schema/bad-if.json 3 additions, 0 deletionstests/qapi-schema/bad-if.json
- tests/qapi-schema/bad-if.out 0 additions, 0 deletionstests/qapi-schema/bad-if.out
- tests/qapi-schema/qapi-schema-test.json 26 additions, 0 deletionstests/qapi-schema/qapi-schema-test.json
Loading
Please register or sign in to comment