[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-commits] [qemu/qemu] 967c88: qapi: add 'if' to top-level expressio
From: |
GitHub |
Subject: |
[Qemu-commits] [qemu/qemu] 967c88: qapi: add 'if' to top-level expressions |
Date: |
Thu, 05 Jul 2018 03:24:44 -0700 |
Branch: refs/heads/master
Home: https://github.com/qemu/qemu
Commit: 967c885108f18e5065744719f7959ba5ea0a5b0d
https://github.com/qemu/qemu/commit/967c885108f18e5065744719f7959ba5ea0a5b0d
Author: Marc-André Lureau <address@hidden>
Date: 2018-07-03 (Tue, 03 Jul 2018)
Changed paths:
M docs/devel/qapi-code-gen.txt
M scripts/qapi/common.py
M tests/Makefile.include
A tests/qapi-schema/bad-if-empty-list.err
A tests/qapi-schema/bad-if-empty-list.exit
A tests/qapi-schema/bad-if-empty-list.json
A tests/qapi-schema/bad-if-empty-list.out
A tests/qapi-schema/bad-if-empty.err
A tests/qapi-schema/bad-if-empty.exit
A tests/qapi-schema/bad-if-empty.json
A tests/qapi-schema/bad-if-empty.out
A tests/qapi-schema/bad-if-list.err
A tests/qapi-schema/bad-if-list.exit
A tests/qapi-schema/bad-if-list.json
A tests/qapi-schema/bad-if-list.out
A tests/qapi-schema/bad-if.err
A tests/qapi-schema/bad-if.exit
A tests/qapi-schema/bad-if.json
A tests/qapi-schema/bad-if.out
M tests/qapi-schema/qapi-schema-test.json
M tests/qapi-schema/qapi-schema-test.out
M tests/test-qmp-cmds.c
Log Message:
-----------
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 <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
[Commit message and Documentation improved]
Signed-off-by: Markus Armbruster <address@hidden>
Commit: 2cbc94376e718448699036be7f6e29ab75312b70
https://github.com/qemu/qemu/commit/2cbc94376e718448699036be7f6e29ab75312b70
Author: Marc-André Lureau <address@hidden>
Date: 2018-07-03 (Tue, 03 Jul 2018)
Changed paths:
M scripts/qapi/common.py
Log Message:
-----------
qapi: pass 'if' condition into QAPISchemaEntity objects
Built-in objects remain unconditional. Explicitly defined objects use
the condition specified in the schema. Implicitly defined objects
inherit their condition from their users. For most of them, there is
exactly one user, so the condition to use is obvious. The exception
is wrapped types generated for simple union variants, which can be
shared by any number of simple unions. The tight condition would be
the disjunction of the conditions of these simple unions. For now,
use the wrapped type's condition instead. Much simpler and good
enough for now.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Commit: 4fca21c1b043cb1ef2e197ef15e7474ba668d925
https://github.com/qemu/qemu/commit/4fca21c1b043cb1ef2e197ef15e7474ba668d925
Author: Marc-André Lureau <address@hidden>
Date: 2018-07-03 (Tue, 03 Jul 2018)
Changed paths:
M scripts/qapi/common.py
Log Message:
-----------
qapi: leave the ifcond attribute undefined until check()
We commonly initialize attributes to None in .init(), then set their
real value in .check(). Accessing the attribute before .check()
yields None. If we're lucky, the code that accesses the attribute
prematurely chokes on None.
It won't for .ifcond, because None is a legitimate value.
Leave the ifcond attribute undefined until check().
Suggested-by: Markus Armbruster <address@hidden>
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Commit: fbf09a2fa4d9460033023e56cc1b195be053b353
https://github.com/qemu/qemu/commit/fbf09a2fa4d9460033023e56cc1b195be053b353
Author: Marc-André Lureau <address@hidden>
Date: 2018-07-03 (Tue, 03 Jul 2018)
Changed paths:
M scripts/qapi/commands.py
M scripts/qapi/common.py
M scripts/qapi/doc.py
M scripts/qapi/events.py
M scripts/qapi/introspect.py
M scripts/qapi/types.py
M scripts/qapi/visit.py
M tests/qapi-schema/qapi-schema-test.out
M tests/qapi-schema/test-qapi.py
Log Message:
-----------
qapi: add 'ifcond' to visitor methods
Modify the test visitor to check correct passing of values.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
[Accidental change to roms/seabios dropped]
Signed-off-by: Markus Armbruster <address@hidden>
Commit: 485d948ce86f5a096dc848ec31b70cd66452d40d
https://github.com/qemu/qemu/commit/485d948ce86f5a096dc848ec31b70cd66452d40d
Author: Marc-André Lureau <address@hidden>
Date: 2018-07-03 (Tue, 03 Jul 2018)
Changed paths:
M scripts/qapi/common.py
Log Message:
-----------
qapi: mcgen() shouldn't indent # lines
Skip preprocessor lines when adding indentation, since that would
likely result in invalid code.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Commit: ded9fc28b5a07213f3e5e8ac7ea0494b85813de1
https://github.com/qemu/qemu/commit/ded9fc28b5a07213f3e5e8ac7ea0494b85813de1
Author: Marc-André Lureau <address@hidden>
Date: 2018-07-03 (Tue, 03 Jul 2018)
Changed paths:
M scripts/qapi/common.py
Log Message:
-----------
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 <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Commit: 40bb13766af789ae468a848aec7b45742497e5a9
https://github.com/qemu/qemu/commit/40bb13766af789ae468a848aec7b45742497e5a9
Author: Marc-André Lureau <address@hidden>
Date: 2018-07-03 (Tue, 03 Jul 2018)
Changed paths:
M scripts/qapi/introspect.py
Log Message:
-----------
qapi-introspect: modify to_qlit() to append ',' on level > 0
The following patch is going to break list entries with #if/#endif, so
they should have the trailing ',' as suffix.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Commit: d626b6c1ae7c811d0cfd5f8dc042426dcd1bcf90
https://github.com/qemu/qemu/commit/d626b6c1ae7c811d0cfd5f8dc042426dcd1bcf90
Author: Marc-André Lureau <address@hidden>
Date: 2018-07-03 (Tue, 03 Jul 2018)
Changed paths:
M scripts/qapi/introspect.py
Log Message:
-----------
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 <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Commit: 1f7b9f3181ee137101cca66461c47e718b853240
https://github.com/qemu/qemu/commit/1f7b9f3181ee137101cca66461c47e718b853240
Author: Marc-André Lureau <address@hidden>
Date: 2018-07-03 (Tue, 03 Jul 2018)
Changed paths:
M scripts/qapi/commands.py
M tests/test-qmp-cmds.c
Log Message:
-----------
qapi/commands: add #if conditions to commands
Wrap generated code with #if/#endif using an 'ifcontext' on
QAPIGenCSnippet objects.
Signed-off-by: Marc-André Lureau <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
[Line breaks tweaked]
Signed-off-by: Markus Armbruster <address@hidden>
Commit: c3cd6aa0201c126eda8dc71b60e7aa259a3e79b9
https://github.com/qemu/qemu/commit/c3cd6aa0201c126eda8dc71b60e7aa259a3e79b9
Author: Marc-André Lureau <address@hidden>
Date: 2018-07-03 (Tue, 03 Jul 2018)
Changed paths:
M scripts/qapi/events.py
Log Message:
-----------
qapi/events: add #if conditions to events
Wrap generated code with #if/#endif using an 'ifcontext' on
QAPIGenCSnippet objects.
This makes a conditional event's qapi_event_send_FOO() compile-time
conditional, but its enum QAPIEvent member remains unconditional for
now. A follow up patch "qapi-event: add 'if' condition to implicit
event enum" will improve this.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Commit: 9f88c66211342714b06c051140fd64ffd338dbe1
https://github.com/qemu/qemu/commit/9f88c66211342714b06c051140fd64ffd338dbe1
Author: Markus Armbruster <address@hidden>
Date: 2018-07-03 (Tue, 03 Jul 2018)
Changed paths:
M scripts/qapi/types.py
M scripts/qapi/visit.py
Log Message:
-----------
qapi-types: add #if conditions to types & visitors
Types & visitors are coupled and must be handled together to avoid
temporary build regression.
Wrap generated types/visitor code with #if/#endif using the context
helpers. Derived from a patch by Marc-André.
Signed-off-by: Marc-André Lureau <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Commit: 901a34a400a0dd5bf5056b6b9ecce48ab8eb02ac
https://github.com/qemu/qemu/commit/901a34a400a0dd5bf5056b6b9ecce48ab8eb02ac
Author: Marc-André Lureau <address@hidden>
Date: 2018-07-03 (Tue, 03 Jul 2018)
Changed paths:
M scripts/qapi/doc.py
M tests/qapi-schema/doc-good.json
M tests/qapi-schema/doc-good.out
M tests/qapi-schema/doc-good.texi
Log Message:
-----------
qapi: add 'If:' section to generated documentation
The documentation is generated only once, and doesn't know C
pre-conditions. Add 'If:' sections for top-level entities.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Commit: 05eb4a25aea245575503b03bc882a64ae70fcaad
https://github.com/qemu/qemu/commit/05eb4a25aea245575503b03bc882a64ae70fcaad
Author: Marc-André Lureau <address@hidden>
Date: 2018-07-03 (Tue, 03 Jul 2018)
Changed paths:
M hmp-commands-info.hx
M hmp.c
M qapi/ui.json
M qmp.c
M ui/vnc.h
Log Message:
-----------
qapi: add conditions to VNC type/commands/events on the schema
Add #if defined(CONFIG_VNC) in generated code, and adjust the
qmp/hmp code accordingly.
query-qmp-schema no longer reports the command/events etc as
available when disabled at compile.
Commands made conditional:
* query-vnc, query-vnc-servers, change-vnc-password
Before the patch, the commands for !CONFIG_VNC are stubs that fail
like this:
{"error": {"class": "GenericError",
"desc": "The feature 'vnc' is not enabled"}}
Afterwards, they fail like this:
{"error": {"class": "CommandNotFound",
"desc": "The command FOO has not been found"}}
I call that an improvement, because it lets clients distinguish
between command unavailable (class CommandNotFound) and command failed
(class GenericError).
Events made conditional:
* VNC_CONNECTED, VNC_INITIALIZED, VNC_DISCONNECTED
HMP change:
* info vnc
Will return "unknown command: 'info vnc'" when VNC is compiled
out (same as error for spice when --disable-spice)
Occurrences of VNC (case insensitive) in the schema that aren't
covered by this change:
* add_client
Command has other uses, including "socket bases character devices".
These are unconditional as far as I can tell.
* set_password, expire_password
In theory, these commands could be used for managing any service's
password. In practice, they're used for VNC and SPICE services.
They're documented for "remote display session" / "remote display
server".
The service is selected by argument @protocol. The code special-cases
protocol-specific argument checking, then calls a protocol-specific
function to do the work. If it fails, the command fails with "Could
not set password". It does when the service isn't compiled in (it's a
stub then).
We could make these commands conditional on the conjunction of all
services [currently: defined(CONFIG_VNC) || defined(CONFIG_SPICE)],
but I doubt it's worthwhile.
* change
Command has other uses, namely changing media.
This patch inlines a stub; no functional change.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Gerd Hoffmann <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Commit: 514337c142f9522f6ab89c3d2f964f446ebeb1cd
https://github.com/qemu/qemu/commit/514337c142f9522f6ab89c3d2f964f446ebeb1cd
Author: Marc-André Lureau <address@hidden>
Date: 2018-07-03 (Tue, 03 Jul 2018)
Changed paths:
M monitor.c
M qapi/char.json
M qapi/ui.json
M qmp.c
Log Message:
-----------
qapi: add conditions to SPICE type/commands/events on the schema
Add #if defined(CONFIG_SPICE) in generated code, and adjust the
qmp/hmp code accordingly.
query-qmp-schema no longer reports the command/events etc as
available when disabled at compile time.
Commands made conditional:
* query-spice
Before the patch, the command for !CONFIG_SPICE is unregistered. It
will fail with the same error.
Events made conditional:
* SPICE_CONNECTED, SPICE_INITIALIZED, SPICE_DISCONNECTED,
SPICE_MIGRATE_COMPLETED
Add TODO for conditional SPICE chardevs, delayed until the supports
for conditional members lands.
No HMP change, the code was already conditional.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Gerd Hoffmann <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Commit: 5dafaf4fbceeb4c5d204039045b50b2f37443ff4
https://github.com/qemu/qemu/commit/5dafaf4fbceeb4c5d204039045b50b2f37443ff4
Author: Peter Maydell <address@hidden>
Date: 2018-07-05 (Thu, 05 Jul 2018)
Changed paths:
M docs/devel/qapi-code-gen.txt
M hmp-commands-info.hx
M hmp.c
M monitor.c
M qapi/char.json
M qapi/ui.json
M qmp.c
M scripts/qapi/commands.py
M scripts/qapi/common.py
M scripts/qapi/doc.py
M scripts/qapi/events.py
M scripts/qapi/introspect.py
M scripts/qapi/types.py
M scripts/qapi/visit.py
M tests/Makefile.include
A tests/qapi-schema/bad-if-empty-list.err
A tests/qapi-schema/bad-if-empty-list.exit
A tests/qapi-schema/bad-if-empty-list.json
A tests/qapi-schema/bad-if-empty-list.out
A tests/qapi-schema/bad-if-empty.err
A tests/qapi-schema/bad-if-empty.exit
A tests/qapi-schema/bad-if-empty.json
A tests/qapi-schema/bad-if-empty.out
A tests/qapi-schema/bad-if-list.err
A tests/qapi-schema/bad-if-list.exit
A tests/qapi-schema/bad-if-list.json
A tests/qapi-schema/bad-if-list.out
A tests/qapi-schema/bad-if.err
A tests/qapi-schema/bad-if.exit
A tests/qapi-schema/bad-if.json
A tests/qapi-schema/bad-if.out
M tests/qapi-schema/doc-good.json
M tests/qapi-schema/doc-good.out
M tests/qapi-schema/doc-good.texi
M tests/qapi-schema/qapi-schema-test.json
M tests/qapi-schema/qapi-schema-test.out
M tests/qapi-schema/test-qapi.py
M tests/test-qmp-cmds.c
M ui/vnc.h
Log Message:
-----------
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2018-07-03' into
staging
QAPI patches for 2018-07-03
# gpg: Signature made Tue 03 Jul 2018 21:52:55 BST
# gpg: using RSA key 3870B400EB918653
# gpg: Good signature from "Markus Armbruster <address@hidden>"
# gpg: aka "Markus Armbruster <address@hidden>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653
* remotes/armbru/tags/pull-qapi-2018-07-03:
qapi: add conditions to SPICE type/commands/events on the schema
qapi: add conditions to VNC type/commands/events on the schema
qapi: add 'If:' section to generated documentation
qapi-types: add #if conditions to types & visitors
qapi/events: add #if conditions to events
qapi/commands: add #if conditions to commands
qapi-introspect: add preprocessor conditions to generated QLit
qapi-introspect: modify to_qlit() to append ',' on level > 0
qapi: add #if/#endif helpers
qapi: mcgen() shouldn't indent # lines
qapi: add 'ifcond' to visitor methods
qapi: leave the ifcond attribute undefined until check()
qapi: pass 'if' condition into QAPISchemaEntity objects
qapi: add 'if' to top-level expressions
Signed-off-by: Peter Maydell <address@hidden>
Compare: https://github.com/qemu/qemu/compare/8beb8cc64da2...5dafaf4fbcee
**NOTE:** This service been marked for deprecation:
https://developer.github.com/changes/2018-04-25-github-services-deprecation/
Functionality will be removed from GitHub.com on January 31st, 2019.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-commits] [qemu/qemu] 967c88: qapi: add 'if' to top-level expressions,
GitHub <=