[Spice-devel] [PATCH v2 2/2] Quiet uninitialized variable warning.
Christophe Fergeau
cfergeau at redhat.com
Wed Jan 11 14:09:27 UTC 2017
On Mon, Jan 09, 2017 at 02:11:02PM +0100, Michal Suchánek wrote:
> On Mon, 09 Jan 2017 10:51:34 +0100
> Pavel Grunt <pgrunt at redhat.com> wrote:
>
> Hello,
>
> > Hi Michal,
> >
> > On Fri, 2017-01-06 at 14:25 +0100, Michal Suchanek wrote:
> > > Signed-off-by: Michal Suchanek <msuchanek at suse.de>
> > > ---
> > > src/vdagentd/vdagentd.c | 1 +
> > > 1 file changed, 1 insertion(+)
> > >
> > > diff --git a/src/vdagentd/vdagentd.c b/src/vdagentd/vdagentd.c
> > > index 991514e..60a866e 100644
> > > --- a/src/vdagentd/vdagentd.c
> > > +++ b/src/vdagentd/vdagentd.c
> > > @@ -334,6 +334,7 @@ static void do_client_file_xfer(struct
> > > vdagent_virtio_port *vport,
> > > id = d->id;
> > > break;
> > > }
> > > + default: return; /* quiet uninitialized variable warning */
> > I would go for 'g_return_if_reached' - it will log a warning, also it
> > should be on a new line. I can do the changes and push if you agree.
> >
>
> I use this locally to be able to build with gcc 6. gcc 4.8.5 does not
> detect the issue and gcc 7 should be able to detect that the function
> is called from a switch statement where only the values already tested
> above are allowed.
For what it's worth, I'm not seeing this warning with gcc6 (gcc (GCC)
6.3.1 20161221 (Red Hat 6.3.1-1))
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/20170111/287399f5/attachment.sig>
More information about the Spice-devel
mailing list