Re: [PATCH v2 2/2] Quiet uninitialized variable warning.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 09 Jan 2017 10:51:34 +0100
Pavel Grunt <pgrunt@xxxxxxxxxx> wrote:

Hello,

> Hi Michal,
> 
> On Fri, 2017-01-06 at 14:25 +0100, Michal Suchanek wrote:
> > Signed-off-by: Michal Suchanek <msuchanek@xxxxxxx>
> > ---
> >  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. 

If you want to use another style for the fix that's fine. I can drop
this one then.

Thanks

Michal
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]