[Spice-devel] [PATCH v7 1/3] vdagentd: Quiet uninitialized variable warning.
Michal Suchanek
msuchanek at suse.de
Fri Jan 27 17:53:38 UTC 2017
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
More information about the Spice-devel
mailing list