| 9b4416bf | 13-Sep-2019 |
Markus Armbruster <armbru@redhat.com> |
qapi: Drop support for escape sequences other than \\
Since the previous commit restricted strings to printable ASCII, \uXXXX's only use is obfuscation. Drop it.
This leaves \\, \/, \', and \". S
qapi: Drop support for escape sequences other than \\
Since the previous commit restricted strings to printable ASCII, \uXXXX's only use is obfuscation. Drop it.
This leaves \\, \/, \', and \". Since QAPI schema strings are all names, and names are restricted to ASCII letters, digits, hyphen, and underscore, none of them is useful.
The latter three have no test coverage. Drop them.
Keep \\ to avoid (more) gratuitous incompatibility with JSON.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20190913201349.24332-8-armbru@redhat.com>
show more ...
|
| 56a8caff | 13-Sep-2019 |
Markus Armbruster <armbru@redhat.com> |
qapi: Restrict strings to printable ASCII
RFC 8259 on string contents:
All Unicode characters may be placed within the quotation marks, except for the characters that MUST be escaped: quotati
qapi: Restrict strings to printable ASCII
RFC 8259 on string contents:
All Unicode characters may be placed within the quotation marks, except for the characters that MUST be escaped: quotation mark, reverse solidus, and the control characters (U+0000 through U+001F).
The QAPI schema parser accepts both less and more than JSON: it accepts only ASCII with \u (less), and accepts control characters other than LF (new line) unescaped. How it treats unescaped non-ASCII input differs between Python 2 and Python 3.
Make it accept strictly less: require printable ASCII. Drop support for \b, \f, \n, \r, \t.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20190913201349.24332-7-armbru@redhat.com>
show more ...
|
| b22e8658 | 13-Sep-2019 |
Markus Armbruster <armbru@redhat.com> |
qapi: Drop support for boxed alternate arguments
Commands and events can define their argument type inline (default) or by referring to another type ('boxed': true, since commit c818408e44 "qapi: Im
qapi: Drop support for boxed alternate arguments
Commands and events can define their argument type inline (default) or by referring to another type ('boxed': true, since commit c818408e44 "qapi: Implement boxed types for commands/events", v2.7.0). The unboxed inline definition is an (anonymous) struct type. The boxed type may be a struct, union, or alternate type.
The latter is problematic: docs/interop/qemu-spec.txt requires the value of the 'data' key to be a json-object, but any non-degenerate alternate type has at least one branch that isn't.
Fortunately, we haven't made use of alternates in this context outside tests/. Drop support for them.
QAPISchemaAlternateType.is_empty() is now unused. Drop it, too.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20190913201349.24332-4-armbru@redhat.com>
show more ...
|
| 157dd363 | 06-Jun-2019 |
Markus Armbruster <armbru@redhat.com> |
qapi: Simplify how QAPIDoc implements its state machine
QAPIDoc uses a state machine to for processing of documentation lines. Its state is encoded as an enum QAPIDoc._state (well, as enum-like clas
qapi: Simplify how QAPIDoc implements its state machine
QAPIDoc uses a state machine to for processing of documentation lines. Its state is encoded as an enum QAPIDoc._state (well, as enum-like class actually, thanks to our infatuation with Python 2).
All we ever do with the state is calling the state's function to process a line of documentation. The enum values effectively serve as handles for the functions.
Eliminate the rather wordy indirection: store the function to call in QAPIDoc._append_line. Update and improve comments.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20190606153803.5278-8-armbru@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> [Commit message typo fixed]
show more ...
|
| f3ed93d5 | 06-Jun-2019 |
Kevin Wolf <kwolf@redhat.com> |
qapi: Allow documentation for features
Features will be documented in a new part introduced by a "Features:" line, after arguments and before named sections.
Signed-off-by: Kevin Wolf <kwolf@redhat
qapi: Allow documentation for features
Features will be documented in a new part introduced by a "Features:" line, after arguments and before named sections.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20190606153803.5278-6-armbru@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
| 03bf06bd | 06-Jun-2019 |
Kevin Wolf <kwolf@redhat.com> |
qapi: Disentangle QAPIDoc code
Documentation comments follow a certain structure: First, we have a text with a general description (called QAPIDoc.body). After this, descriptions of the arguments fo
qapi: Disentangle QAPIDoc code
Documentation comments follow a certain structure: First, we have a text with a general description (called QAPIDoc.body). After this, descriptions of the arguments follow. Finally, we have a part that contains various named sections.
The code doesn't show this structure, but just checks various attributes that indicate indirectly which part is being processed, so it happens to do the right set of things in the right phase. This is hard to follow, and adding support for documentation of features would be even harder.
This patch restructures the code so that the three parts are clearly separated. The code becomes a bit longer, but easier to follow. The resulting output remains unchanged.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20190606153803.5278-5-armbru@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
| 56a46895 | 01-Mar-2019 |
Markus Armbruster <armbru@redhat.com> |
qapi: Fix array first used in a different module
We generally put implicitly defined types in whatever module triggered their definition. This is wrong for array types, as the included test case de
qapi: Fix array first used in a different module
We generally put implicitly defined types in whatever module triggered their definition. This is wrong for array types, as the included test case demonstrates. Let's have a closer look at it.
Type 'Status' is defined sub-sub-module.json. Array type ['Status'] occurs in main module qapi-schema-test.json and in include/sub-module.json. The main module's use is first, so the array type gets put into the main module.
The generated C headers define StatusList in qapi-types.h. But include/qapi-types-sub-module.h uses it without including qapi-types.h. Oops.
To fix that, put the array type into its element type's module.
Now StatusList gets generated into qapi-types-sub-module.h, which all its users include.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20190301154051.23317-8-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
show more ...
|
| 709395f8 | 01-Mar-2019 |
Markus Armbruster <armbru@redhat.com> |
qapi: Fix code generation for sub-modules in other directories
The #include directives to pull in sub-modules use file names relative to the main module. Works only when all modules are in the same
qapi: Fix code generation for sub-modules in other directories
The #include directives to pull in sub-modules use file names relative to the main module. Works only when all modules are in the same directory, or the main module's output directory is in the compiler's include path. Use relative file names instead.
The dummy variable we generate to avoid empty .o files has an invalid name for sub-modules in other directories. Fix that.
Both messed up in commit 252dc3105fc "qapi: Generate separate .h, .c for each module". Escaped testing because tests/qapi-schema-test.json doesn't cover sub-modules in other directories, only tests/qapi-schema/include-relpath.json does, and we generate and compile C code only for the former, not the latter. Fold the latter into the former. This would have caught the mistakes fixed in this commit.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20190301154051.23317-5-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
show more ...
|
| 5d75648b | 14-Feb-2019 |
Markus Armbruster <armbru@redhat.com> |
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 conditiona
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>
show more ...
|
| c2e196a9 | 14-Feb-2019 |
Markus Armbruster <armbru@redhat.com> |
qapi: Prepare for system modules other than 'builtin'
The next commit wants to generate qapi-emit-events.{c.h}. To enable that, extend QAPISchemaModularCVisitor to support additional "system module
qapi: Prepare for system modules other than 'builtin'
The next commit wants to generate qapi-emit-events.{c.h}. To enable that, extend QAPISchemaModularCVisitor to support additional "system modules", i.e. modules that don't correspond to a (user-defined) QAPI schema module.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20190214152251.2073-5-armbru@redhat.com>
show more ...
|
| a35c9bf8 | 13-Dec-2018 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
qapi: add 'If:' condition to enum values documentation
Use a common function to generate the "If:..." line.
While at it, get rid of the existing \n\n (no idea why it was there). Use a line-break in
qapi: add 'If:' condition to enum values documentation
Use a common function to generate the "If:..." line.
While at it, get rid of the existing \n\n (no idea why it was there). Use a line-break in member description, this seems to look slightly better in the plaintext version.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20181213123724.4866-19-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
| 8ee06f61 | 13-Dec-2018 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
qapi: Add #if conditions to generated code members
Wrap generated enum and struct members and their supporting code with #if/#endif, using the .ifcond members added in the previous patches.
We do e
qapi: Add #if conditions to generated code members
Wrap generated enum and struct members and their supporting code with #if/#endif, using the .ifcond members added in the previous patches.
We do enum and struct in a single patch because union tag enum and the associated variants tie them together, and dealing with that to split the patch doesn't seem worthwhile.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20181213123724.4866-18-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
| 3e270dca | 13-Dec-2018 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
qapi: add 'if' to alternate members
Add 'if' key to alternate members:
{ 'alternate': 'TestIfAlternate', 'data': { 'alt': { 'type': 'TestStruct', 'if': 'COND' } } }
Generated code is not changed
qapi: add 'if' to alternate members
Add 'if' key to alternate members:
{ 'alternate': 'TestIfAlternate', 'data': { 'alt': { 'type': 'TestStruct', 'if': 'COND' } } }
Generated code is not changed by this patch but with "qapi: add #if conditions to generated code".
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20181213123724.4866-17-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
| a2724280 | 13-Dec-2018 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
qapi: add 'if' to union members
Add 'if' key to union members:
{ 'union': 'TestIfUnion', 'data': 'mem': { 'type': 'str', 'if': 'COND'} }
The generated code remains unconditional for now. Later
qapi: add 'if' to union members
Add 'if' key to union members:
{ 'union': 'TestIfUnion', 'data': 'mem': { 'type': 'str', 'if': 'COND'} }
The generated code remains unconditional for now. Later patches generate the conditionals.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20181213123724.4866-16-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|