#
5aa05d3f |
| 28-Jun-2015 |
Markus Armbruster <armbru@redhat.com> |
qapi: Drop unused and useless parameters and variables
gen_sync_call()'s parameter indent is useless: gen_sync_call() uses it only as optional argument for push_indent() and pop_indent(), their defa
qapi: Drop unused and useless parameters and variables
gen_sync_call()'s parameter indent is useless: gen_sync_call() uses it only as optional argument for push_indent() and pop_indent(), their default is four, and gen_sync_call()'s only caller passes four. Drop the parameter.
gen_visitor_input_containers_decl()'s parameter obj is always "QOBJECT(args)". Use that, and drop the parameter.
Drop unused parameters of gen_marshal_output(), gen_marshal_input_decl(), generate_visit_struct_body(), generate_visit_list(), generate_visit_enum(), generate_declaration(), generate_enum_declaration(), generate_decl_enum().
Drop unused variables in generate_event_enum_lookup(), generate_enum_lookup(), generate_visit_struct_fields(), check_event().
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
show more ...
|
#
12f8e1b9 |
| 02-Apr-2015 |
Markus Armbruster <armbru@redhat.com> |
qapi: Factor open_output(), close_output() out of generators
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
|
#
2114f5a9 |
| 02-Apr-2015 |
Markus Armbruster <armbru@redhat.com> |
qapi: Factor parse_command_line() out of the generators
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
|
#
d1f07c86 |
| 14-May-2015 |
Eric Blake <eblake@redhat.com> |
qapi: Support downstream alternates
Enhance the testsuite to cover downstream alternates, including whether the branch name or type is downstream. Update the generator to mangle alternate names in
qapi: Support downstream alternates
Enhance the testsuite to cover downstream alternates, including whether the branch name or type is downstream. Update the generator to mangle alternate names in the appropriate places.
Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
857af5f0 |
| 14-May-2015 |
Eric Blake <eblake@redhat.com> |
qapi: Support downstream flat unions
Enhance the testsuite to cover downstream flat unions, including the base type, discriminator name and type, and branch name and type. Update the generator to m
qapi: Support downstream flat unions
Enhance the testsuite to cover downstream flat unions, including the base type, discriminator name and type, and branch name and type. Update the generator to mangle the union names in the appropriate places.
Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
bb337290 |
| 14-May-2015 |
Eric Blake <eblake@redhat.com> |
qapi: Support downstream simple unions
Enhance the testsuite to cover downstream simple unions, including when a union branch is a downstream name. Update the generator to mangle the union names in
qapi: Support downstream simple unions
Enhance the testsuite to cover downstream simple unions, including when a union branch is a downstream name. Update the generator to mangle the union names in the appropriate places.
Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
83a02706 |
| 14-May-2015 |
Eric Blake <eblake@redhat.com> |
qapi: Support downstream structs
Enhance the testsuite to cover downstream structs, including struct members and base structs. Update the generator to mangle the struct names in the appropriate pla
qapi: Support downstream structs
Enhance the testsuite to cover downstream structs, including struct members and base structs. Update the generator to mangle the struct names in the appropriate places.
Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
fce384b8 |
| 14-May-2015 |
Eric Blake <eblake@redhat.com> |
qapi: Support downstream enums
Enhance the testsuite to cover a downstream enum type and enum string. Update the generator to mangle the enum name in the appropriate places.
Signed-off-by: Eric Bl
qapi: Support downstream enums
Enhance the testsuite to cover a downstream enum type and enum string. Update the generator to mangle the enum name in the appropriate places.
Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
7c81c61f |
| 14-May-2015 |
Markus Armbruster <armbru@redhat.com> |
qapi: Rename generate_enum_full_value() to c_enum_const()
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com>
|
#
18df515e |
| 14-May-2015 |
Eric Blake <eblake@redhat.com> |
qapi: Rename identical c_fun()/c_var() into c_name()
Now that the two functions are identical, we only need one of them, and we might as well give it a more descriptive name. Basically, the functio
qapi: Rename identical c_fun()/c_var() into c_name()
Now that the two functions are identical, we only need one of them, and we might as well give it a more descriptive name. Basically, the function serves as the translation from a QAPI name into a (portion of a) C identifier, without regards to whether it is a variable or function name.
Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
a82b982e |
| 04-May-2015 |
Eric Blake <eblake@redhat.com> |
qapi: Drop dead visitor code related to nested structs
Now that we no longer have nested structs to visit, the use of prefix strings is no longer required. Remove the code that is no longer reachab
qapi: Drop dead visitor code related to nested structs
Now that we no longer have nested structs to visit, the use of prefix strings is no longer required. Remove the code that is no longer reachable.
Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
6b5abc7d |
| 04-May-2015 |
Eric Blake <eblake@redhat.com> |
qapi: Drop support for inline nested types
A future patch will be using a 'name':{dictionary} entry in the QAPI schema to specify a default value for an optional argument (see previous commit messag
qapi: Drop support for inline nested types
A future patch will be using a 'name':{dictionary} entry in the QAPI schema to specify a default value for an optional argument (see previous commit messages for more details why); but existing use of inline nested structs conflicts with that goal. Now that all commands have been changed to avoid inline nested structs, nuke support for them, and turn it into a hard error. Update the testsuite to reflect tighter parsing rules.
Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
fd41dd4e |
| 04-May-2015 |
Eric Blake <eblake@redhat.com> |
qapi: Prefer 'struct' over 'type' in generator
Referring to "type" as both a meta-type (built-in, enum, union, alternate, or struct) and a specific type (the name that the schema uses for declaring
qapi: Prefer 'struct' over 'type' in generator
Referring to "type" as both a meta-type (built-in, enum, union, alternate, or struct) and a specific type (the name that the schema uses for declaring structs) is confusing. The confusion is only made worse by the fact that the generator mostly already refers to struct even when dealing with expr['type']. This commit changes the generator to consistently refer to it as struct everywhere, plus a single back-compat tweak that allows accepting the existing .json files as-is, so that the meat of this change is separate from the mindless churn of that change.
Fix the testsuite fallout for error messages that change, and in some cases, become more legible. Improve comments to better match our intentions where a struct (rather than any complex type) is required. Note that in some cases, an error message now refers to 'struct' while the schema still refers to 'type'; that will be cleaned up in the later commit to the schema.
Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
ab916fad |
| 04-May-2015 |
Eric Blake <eblake@redhat.com> |
qapi: Use 'alternate' to replace anonymous union
Previous patches have led up to the point where I create the new meta-type "'alternate':'Foo'". See the previous patches for documentation; I intent
qapi: Use 'alternate' to replace anonymous union
Previous patches have led up to the point where I create the new meta-type "'alternate':'Foo'". See the previous patches for documentation; I intentionally split as much work into earlier patches to minimize the size of this patch, but a lot of it is churn due to testsuite fallout after updating to the new type.
Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
811d04fd |
| 04-May-2015 |
Eric Blake <eblake@redhat.com> |
qapi: Segregate anonymous unions into alternates in generator
Special-casing 'discriminator == {}' for handling anonymous unions is getting awkward; since this particular type is not always a dictio
qapi: Segregate anonymous unions into alternates in generator
Special-casing 'discriminator == {}' for handling anonymous unions is getting awkward; since this particular type is not always a dictionary on the wire, it is easier to treat it as a completely different class of type, "alternate", so that if a type is listed in the union_types array, we know it is not an anonymous union.
This patch just further segregates union handling, to make sure that anonymous unions are not stored in union_types, and splitting up check_union() into separate functions. A future patch will change the qapi grammar, and having the segregation already in place will make it easier to deal with the distinct meta-type.
Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
a8d4a2e4 |
| 04-May-2015 |
Eric Blake <eblake@redhat.com> |
qapi: Forbid base without discriminator in unions
None of the existing QMP or QGA interfaces uses a union with a base type but no discriminator; it is easier to avoid this in the generator to save r
qapi: Forbid base without discriminator in unions
None of the existing QMP or QGA interfaces uses a union with a base type but no discriminator; it is easier to avoid this in the generator to save room for other future extensions more likely to be useful. An earlier commit added a union-base-no-discriminator test to ensure that we eventually give a decent error message; likewise, removing UserDefUnion outright is okay, because we moved all the tests we wish to keep into the tests of the simple union UserDefNativeListUnion in the previous commit. Now is the time to actually forbid simple union with base, and remove the last vestiges from the testsuite.
Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
b52c4b9c |
| 04-May-2015 |
Eric Blake <eblake@redhat.com> |
qapi: Simplify builtin type handling
There was some redundancy between builtin_types[] and builtin_type_qtypes{}. Merge them into one.
Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Ma
qapi: Simplify builtin type handling
There was some redundancy between builtin_types[] and builtin_type_qtypes{}. Merge them into one.
Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
6540e9f3 |
| 10-Apr-2015 |
Eric Blake <eblake@redhat.com> |
qapi: Drop dead genlist parameter
Defaulting a parameter to True, then having all callers omit or pass an explicit True for that parameter, is pointless. Looks like it has been dead since introducti
qapi: Drop dead genlist parameter
Defaulting a parameter to True, then having all callers omit or pass an explicit True for that parameter, is pointless. Looks like it has been dead since introduction in commit 06d64c6, more than 4 years ago.
Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
#
cee2dedb |
| 18-Sep-2014 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
qapi: add visit_start_union and visit_end_union
In some cases an input visitor might bail out on filling out a struct for various reasons, such as missing fields when running in strict mode. In the
qapi: add visit_start_union and visit_end_union
In some cases an input visitor might bail out on filling out a struct for various reasons, such as missing fields when running in strict mode. In the case of a QAPI Union type, this may lead to cases where the .kind field which encodes the union type is uninitialized. Subsequently, other visitors, such as the dealloc visitor, may use this .kind value as if it were initialized, leading to assumptions about the union type which in this case may lead to segfaults. For example, freeing an integer value.
However, we can generally rely on the fact that the always-present .data void * field that we generate for these union types will always be NULL in cases where .kind is uninitialized (at least, there shouldn't be a reason where we'd do this purposefully).
So pass this information on to Visitor implementation via these optional start_union/end_union interfaces so this information can be used to guard against the situation above. We will make use of this information in a subsequent patch for the dealloc visitor.
Cc: qemu-stable@nongnu.org Reported-by: Fam Zheng <famz@redhat.com> Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
#
e775ba77 |
| 20-Aug-2014 |
Max Reitz <mreitz@redhat.com> |
qapi: Allow enums in anonymous unions
Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1408557576-14574-3-git-send-email-mreitz@redhat.com Signed-
qapi: Allow enums in anonymous unions
Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1408557576-14574-3-git-send-email-mreitz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
#
638ca8ad |
| 10-Jun-2014 |
Amos Kong <akong@redhat.com> |
qapi: fix coding style in parameters list
A space after * when declaring a pointer type is redundant.
Signed-off-by: Amos Kong <akong@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewe
qapi: fix coding style in parameters list
A space after * when declaring a pointer type is redundant.
Signed-off-by: Amos Kong <akong@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
#
297a3646 |
| 07-May-2014 |
Markus Armbruster <armbru@redhat.com> |
qapi: Replace uncommon use of the error API by the common one
We commonly use the error API like this:
err = NULL; foo(..., &err); if (err) { goto out; } bar(..., &err);
qapi: Replace uncommon use of the error API by the common one
We commonly use the error API like this:
err = NULL; foo(..., &err); if (err) { goto out; } bar(..., &err);
Every error source is checked separately. The second function is only called when the first one succeeds. Both functions are free to pass their argument to error_set(). Because error_set() asserts no error has been set, this effectively means they must not be called with an error set.
The qapi-generated code uses the error API differently:
// *errp was initialized to NULL somewhere up the call chain frob(..., errp); gnat(..., errp);
Errors accumulate in *errp: first error wins, subsequent errors get dropped. To make this work, the second function does nothing when called with an error set. Requires non-null errp, or else the second function can't see the first one fail.
This usage has also bled into visitor tests, and two device model object property getters rtc_get_date() and balloon_stats_get_all().
With the "accumulate" technique, you need fewer error checks in callers, and buy that with an error check in every callee. Can be nice.
However, mixing the two techniques is confusing. You can't use the "accumulate" technique with functions designed for the "check separately" technique. You can use the "check separately" technique with functions designed for the "accumulate" technique, but then error_set() can't catch you setting an error more than once.
Standardize on the "check separately" technique for now, because it's overwhelmingly prevalent.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
#
be3c7717 |
| 07-May-2014 |
Markus Armbruster <armbru@redhat.com> |
qapi: Un-inline visit of implicit struct
In preparation of error handling changes. Bonus: generates less duplicated code.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Bla
qapi: Un-inline visit of implicit struct
In preparation of error handling changes. Bonus: generates less duplicated code.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
#
192cca60 |
| 07-May-2014 |
Markus Armbruster <armbru@redhat.com> |
qapi-visit.py: Clean up a sloppy use of field prefix
generate_visit_struct_fields() generates the base type's struct member name both with and without the field prefix. Harmless, because the field
qapi-visit.py: Clean up a sloppy use of field prefix
generate_visit_struct_fields() generates the base type's struct member name both with and without the field prefix. Harmless, because the field prefix is always empty there: only unboxed complex members have a prefix, and those can't have a base type.
Clean it up anyway.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
#
4fa953f2 |
| 07-May-2014 |
Markus Armbruster <armbru@redhat.com> |
qapi: Clean up shadowing of parameters and locals in inner scopes
By un-inlining the visit of nested complex types.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <ebl
qapi: Clean up shadowing of parameters and locals in inner scopes
By un-inlining the visit of nested complex types.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|