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

2017-01-11 Thread Christophe Fergeau
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  wrote:
> 
> Hello,
> 
> > Hi Michal,
> > 
> > On Fri, 2017-01-06 at 14:25 +0100, Michal Suchanek wrote:
> > > Signed-off-by: Michal Suchanek 
> > > ---
> > >  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


signature.asc
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


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

2017-01-09 Thread Michal Suchánek
On Mon, 09 Jan 2017 10:51:34 +0100
Pavel Grunt  wrote:

Hello,

> Hi Michal,
> 
> On Fri, 2017-01-06 at 14:25 +0100, Michal Suchanek wrote:
> > Signed-off-by: Michal Suchanek 
> > ---
> >  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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


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

2017-01-09 Thread Pavel Grunt
Hi Michal,

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

Pavel

>  }
>  
>  conn = g_hash_table_lookup(active_xfers, GUINT_TO_POINTER(id));
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH v2 2/2] Quiet uninitialized variable warning.

2017-01-06 Thread Michal Suchanek
Signed-off-by: Michal Suchanek 
---
 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 */
 }
 
 conn = g_hash_table_lookup(active_xfers, GUINT_TO_POINTER(id));
-- 
2.10.2

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