aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurilo Opsfelder Araujo <muriloo@linux.ibm.com>2022-03-11 19:16:34 -0300
committerMarkus Armbruster <armbru@redhat.com>2022-03-21 15:44:44 +0100
commit79854b95446396c8e7f397800c5d86c3d9a7540d (patch)
tree87b06986ba48d3da312b64b7d1fdab9545484943
parent2058fdbe81e2985c226a026851dd26b146d3395c (diff)
block-qdict: Fix -Werror=maybe-uninitialized build failure
Building QEMU on Fedora 37 (Rawhide Prerelease) ppc64le failed with the following error: $ ../configure --prefix=/usr/local/qemu-disabletcg --target-list=ppc-softmmu,ppc64-softmmu --disable-tcg --disable-linux-user ... $ make -j$(nproc) ... In file included from /root/qemu/include/qapi/qmp/qdict.h:16, from /root/qemu/include/block/qdict.h:13, from ../qobject/block-qdict.c:11: /root/qemu/include/qapi/qmp/qobject.h: In function ‘qdict_array_split’: /root/qemu/include/qapi/qmp/qobject.h:49:17: error: ‘subqdict’ may be used uninitialized [-Werror=maybe-uninitialized] 49 | typeof(obj) _obj = (obj); \ | ^~~~ ../qobject/block-qdict.c:227:16: note: ‘subqdict’ declared here 227 | QDict *subqdict; | ^~~~~~~~ cc1: all warnings being treated as errors Fix build failure by expanding the ternary operation. Tested with `make check-unit` (the check-block-qdict test passed). Signed-off-by: Murilo Opsfelder Araujo <muriloo@linux.ibm.com> Cc: Kevin Wolf <kwolf@redhat.com> Cc: Hanna Reitz <hreitz@redhat.com> Cc: Markus Armbruster <armbru@redhat.com> Message-Id: <20220311221634.58288-1-muriloo@linux.ibm.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
-rw-r--r--qobject/block-qdict.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/qobject/block-qdict.c b/qobject/block-qdict.c
index 1487cc5dd8..4a83bda2c3 100644
--- a/qobject/block-qdict.c
+++ b/qobject/block-qdict.c
@@ -251,12 +251,12 @@ void qdict_array_split(QDict *src, QList **dst)
if (is_subqdict) {
qdict_extract_subqdict(src, &subqdict, prefix);
assert(qdict_size(subqdict) > 0);
+ qlist_append_obj(*dst, QOBJECT(subqdict));
} else {
qobject_ref(subqobj);
qdict_del(src, indexstr);
+ qlist_append_obj(*dst, subqobj);
}
-
- qlist_append_obj(*dst, subqobj ?: QOBJECT(subqdict));
}
}