[Spice-devel] [PATCH v2] tests: Fix compilation error

Frediano Ziglio fziglio at redhat.com
Tue Jan 3 13:18:54 UTC 2017


> 
> 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 | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/server/tests/test-display-base.c
> b/server/tests/test-display-base.c
> index 8167df5..bf8ac10 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)
>              {

Better to avoid this.

> @@ -574,6 +574,7 @@ static void produce_command(Test *test)
>                          command->solid.bbox, command->solid.color);
>                  break;
>              default: /* Just to shut up GCC warning (-Wswitch) */
> +                    g_assert_not_reached();
>                  break;
>              }
>              push_command(&update->ext);

This should be enough.

Frediano


More information about the Spice-devel mailing list