qapi machine: Elide redundant has_FOO in generated C

The has_FOO for pointer-valued FOO are redundant, except for arrays.
They are also a nuisance to work with.  Recent commit "qapi: Start to
elide redundant has_FOO in generated C" provided the means to elide
them step by step.  This is the step for qapi/machine*.json.

Said commit explains the transformation in more detail.  The invariant
violations mentioned there do not occur here.

Cc: Eduardo Habkost <eduardo@habkost.net>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
Cc: Yanan Wang <wangyanan55@huawei.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20221104160712.3005652-16-armbru@redhat.com>
This commit is contained in:
Markus Armbruster 2022-11-04 17:06:57 +01:00
parent 107111bf6f
commit fe8ac1fa49
13 changed files with 15 additions and 34 deletions

View file

@ -684,7 +684,6 @@ HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine)
cpu = machine->possible_cpus->cpus[i].cpu;
if (cpu) {
cpu_item->has_qom_path = true;
cpu_item->qom_path = object_get_canonical_path(cpu);
}
QAPI_LIST_PREPEND(head, cpu_item);
@ -873,8 +872,7 @@ static void machine_copy_boot_config(MachineState *ms, BootConfiguration *config
machine_free_boot_config(ms);
ms->boot_config = *config;
if (!config->has_order) {
ms->boot_config.has_order = true;
if (!config->order) {
ms->boot_config.order = g_strdup(machine_class->default_boot_order);
}
}
@ -889,13 +887,13 @@ static void machine_set_boot(Object *obj, Visitor *v, const char *name,
if (!visit_type_BootConfiguration(v, name, &config, errp)) {
return;
}
if (config->has_order) {
if (config->order) {
validate_bootdevices(config->order, errp);
if (*errp) {
goto out_free;
}
}
if (config->has_once) {
if (config->once) {
validate_bootdevices(config->once, errp);
if (*errp) {
goto out_free;
@ -1424,7 +1422,7 @@ void qdev_machine_creation_done(void)
{
cpu_synchronize_all_post_init();
if (current_machine->boot_config.has_once) {
if (current_machine->boot_config.once) {
qemu_boot_set(current_machine->boot_config.once, &error_fatal);
qemu_register_reset(restore_boot_order, g_strdup(current_machine->boot_config.order));
}