qemu-e2k/qobject
Murilo Opsfelder Araujo 79854b9544 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>
2022-03-21 15:44:44 +01:00
..
block-qdict.c block-qdict: Fix -Werror=maybe-uninitialized build failure 2022-03-21 15:44:44 +01:00
json-lexer.c json: Fix off-by-one assert check in next_state() 2019-03-26 08:10:11 +01:00
json-parser-int.h json: Eliminate lexer state IN_WHITESPACE, pseudo-token JSON_SKIP 2018-09-24 18:08:07 +02:00
json-parser.c qobject: open brace '{' following struct go on the same line 2021-02-04 13:20:28 +01:00
json-streamer.c json: Fix check for unbalanced right curly brace 2020-04-07 13:10:11 +02:00
json-writer.c qobject: Factor JSON writer out of qobject_to_json() 2020-12-19 10:39:16 +01:00
meson.build qobject: Factor JSON writer out of qobject_to_json() 2020-12-19 10:39:16 +01:00
qbool.c qobject: Move internals to qobject-internal.h 2020-12-19 10:38:43 +01:00
qdict.c qobject: braces {} are necessary for all arms of this statement 2021-02-04 13:20:29 +01:00
qjson.c qobject: open brace '{' following struct go on the same line 2021-02-04 13:20:28 +01:00
qlist.c qobject: Move internals to qobject-internal.h 2020-12-19 10:38:43 +01:00
qlit.c qapi: Replace qobject_to_X(o) by qobject_to(X, o) 2018-03-19 14:58:36 -05:00
qnull.c qobject: Move internals to qobject-internal.h 2020-12-19 10:38:43 +01:00
qnum.c qobject: Factor JSON writer out of qobject_to_json() 2020-12-19 10:39:16 +01:00
qobject-internal.h qobject: Move internals to qobject-internal.h 2020-12-19 10:38:43 +01:00
qobject.c qobject: Move internals to qobject-internal.h 2020-12-19 10:38:43 +01:00
qstring.c qobject: Make QString immutable 2020-12-19 10:39:41 +01:00