[Spice-devel] [PATCH v7 1/3] vdagentd: Quiet uninitialized variable warning.
Christophe Fergeau
cfergeau at redhat.com
Mon Jan 30 12:05:39 UTC 2017
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
On Fri, Jan 27, 2017 at 06:53:38PM +0100, Michal Suchanek wrote:
> With gcc 6.2.1 I cannot build vdagentd because gcc detects msg_type as
> potentially uninitialized and vdagentd is built with -Werror.
>
> gcc 4.8.5 does not detect the issue and gcc 7 should be able to tell
> that do_client_file_xfer is called only with values of
> message_header->type handled in the switch.
>
> Signed-off-by: Michal Suchanek <msuchanek at suse.de>
> ---
> v2:
> - use g_return_if_reached
> v7:
> - reword
> ---
> src/vdagentd/vdagentd.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/src/vdagentd/vdagentd.c b/src/vdagentd/vdagentd.c
> index e934f3f..5ca0106 100644
> --- a/src/vdagentd/vdagentd.c
> +++ b/src/vdagentd/vdagentd.c
> @@ -328,6 +328,8 @@ static void do_client_file_xfer(struct vdagent_virtio_port *vport,
> id = d->id;
> break;
> }
> + default:
> + g_return_if_reached(); /* quiet uninitialized variable warning */
> }
>
> conn = g_hash_table_lookup(active_xfers, GUINT_TO_POINTER(id));
> --
> 2.10.2
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- 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/20170130/9f7c1da7/attachment.sig>
More information about the Spice-devel
mailing list