diff options
author | Eric Blake <eblake@redhat.com> | 2016-03-17 16:48:29 -0600 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2016-03-18 10:29:25 +0100 |
commit | 7599697c66d22ff4c859ba6ccea30e6a9aae6b9b (patch) | |
tree | e0a7d31e085b801b539316abd455dda48c2b839d /docs/qapi-code-gen.txt | |
parent | 4040d995e49c5b818be79e50a18c1bf8d2354d12 (diff) | |
download | qemu-7599697c66d22ff4c859ba6ccea30e6a9aae6b9b.zip qemu-7599697c66d22ff4c859ba6ccea30e6a9aae6b9b.tar.gz qemu-7599697c66d22ff4c859ba6ccea30e6a9aae6b9b.tar.bz2 |
qapi: Adjust names of implicit types
The original choice of ':obj-' as the prefix for implicit types
made it obvious that we weren't going to clash with any user-defined
names, which cannot contain ':'. But now we want to create structs
for implicit types, to get rid of special cases in the generators,
and our use of ':' in implicit names needs a tweak to produce valid
C code.
We could transliterate ':' to '_', except that C99 mandates that
"identifiers that begin with an underscore are always reserved for
use as identifiers with file scope in both the ordinary and tag name
spaces". So it's time to change our naming convention: we can
instead use the 'q_' prefix that we reserved for ourselves back in
commit 9fb081e0. Technically, since we aren't planning on exposing
the empty type in generated code, we could keep the name ':empty',
but renaming it to 'q_empty' makes the check for startswith('q_')
cover all implicit types, whether or not code is generated for them.
As long as we don't declare 'empty' or 'obj' ticklish, it shouldn't
clash with c_name() prepending 'q_' to the user's ticklish names.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1458254921-17042-5-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'docs/qapi-code-gen.txt')
-rw-r--r-- | docs/qapi-code-gen.txt | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/docs/qapi-code-gen.txt b/docs/qapi-code-gen.txt index e0b2ef1..c648f76 100644 --- a/docs/qapi-code-gen.txt +++ b/docs/qapi-code-gen.txt @@ -575,9 +575,9 @@ names an object type without members. Example: the SchemaInfo for command query-qmp-schema { "name": "query-qmp-schema", "meta-type": "command", - "arg-type": ":empty", "ret-type": "SchemaInfoList" } + "arg-type": "q_empty", "ret-type": "SchemaInfoList" } - Type ":empty" is an object type without members, and type + Type "q_empty" is an automatic object type without members, and type "SchemaInfoList" is the array of SchemaInfo type. The SchemaInfo for an event has meta-type "event", and variant member @@ -594,9 +594,9 @@ QAPI schema implicitly defines an object type. Example: the SchemaInfo for EVENT_C from section Events { "name": "EVENT_C", "meta-type": "event", - "arg-type": ":obj-EVENT_C-arg" } + "arg-type": "q_obj-EVENT_C-arg" } - Type ":obj-EVENT_C-arg" is an implicitly defined object type with + Type "q_obj-EVENT_C-arg" is an implicitly defined object type with the two members from the event's definition. The SchemaInfo for struct and union types has meta-type "object". @@ -660,11 +660,11 @@ Union types { "name": "type", "type": "BlockdevOptionsKind" } ], "tag": "type", "variants": [ - { "case": "file", "type": ":obj-FileOptions-wrapper" }, - { "case": "qcow2", "type": ":obj-Qcow2Options-wrapper" } ] } + { "case": "file", "type": "q_obj-FileOptions-wrapper" }, + { "case": "qcow2", "type": "q_obj-Qcow2Options-wrapper" } ] } Enumeration type "BlockdevOptionsKind" and the object types - ":obj-FileOptions-wrapper", ":obj-Qcow2Options-wrapper" are + "q_obj-FileOptions-wrapper", "q_obj-Qcow2Options-wrapper" are implicitly defined. The SchemaInfo for an alternate type has meta-type "alternate", and |