[Spice-devel] [PATCH] tests: Fix compilation error
Christophe Fergeau
cfergeau at redhat.com
Mon Jan 2 16:48:20 UTC 2017
On Mon, Jan 02, 2017 at 06:24:43PM +0200, Snir Sheriber wrote:
> Fix compilation error due to -Werror=maybe-uninitialized:
>
> CC test-display-base.o
> test-display-base.c: In function 'do_wakeup':
> test-display-base.c:579:13: error: 'update' may be used uninitialized...
> push_command(&update->ext);
>
> Signed-off-by: Snir Sheriber <ssheribe at redhat.com>
> ---
> server/tests/test-display-base.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/server/tests/test-display-base.c b/server/tests/test-display-base.c
> index 8167df5..4053ae6 100644
> --- a/server/tests/test-display-base.c
> +++ b/server/tests/test-display-base.c
> @@ -546,7 +546,7 @@ static void produce_command(Test *test)
> case SIMPLE_DRAW_SOLID:
> case SIMPLE_DRAW_BITMAP:
> case SIMPLE_DRAW: {
> - SimpleSpiceUpdate *update;
> + SimpleSpiceUpdate *update = NULL;
>
> if (has_automated_tests)
> {
> @@ -576,7 +576,8 @@ static void produce_command(Test *test)
> default: /* Just to shut up GCC warning (-Wswitch) */
> break;
> }
> - push_command(&update->ext);
> + if(update)
> + push_command(&update->ext);
Is it expected in this test that we get to the 'default:' case which is
the only one not setting 'update'? If it's not expected, we should fail
the test if this happens, ie have a g_assert_not_reached() or similar
there rather than silently ignoring the unexpected command->command
value.
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170102/088d85d4/attachment.sig>
More information about the Spice-devel
mailing list