[Spice-devel] [PATCH spice-gtk] Use designated struct initializer

Daniel P. Berrange berrange at redhat.com
Wed Jul 26 11:37:35 UTC 2017


On Fri, Jul 07, 2017 at 04:26:33PM +0200, Pavel Grunt wrote:
> Silence -Wmissing-field-initializers warnings.

This doesn't make sense for many of these cases you've changed

> diff --git a/src/channel-main.c b/src/channel-main.c
> index 4edd575..104b18a 100644
> --- a/src/channel-main.c
> +++ b/src/channel-main.c
> @@ -1275,7 +1275,7 @@ static void agent_sync_audio_record(SpiceMainChannel *main_channel)
>  static void agent_display_config(SpiceMainChannel *channel)
>  {
>      SpiceMainChannelPrivate *c = channel->priv;
> -    VDAgentDisplayConfig config = { 0, };
> +    VDAgentDisplayConfig config = { .flags = 0, .depth = 0};

eg "{ 0 }" is explicitly defined in the C spec as meaning initialize every
field to all zeros. 

GCC would complain about { 1 }, but should never complain about { 0 }, even
with -Wmissing-field-initializers.



Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


More information about the Spice-devel mailing list