[PATCH libdrm 1/1] tests/exynos: Fix warnings

Jan Vesely jan.vesely at rutgers.edu
Wed Mar 18 12:41:56 PDT 2015


On Wed, 2015-03-18 at 20:23 +0100, Tobias Jakobi wrote:
> Hello Jan,
> 
> Jan Vesely wrote:
> > Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> > ---
> >  tests/exynos/exynos_fimg2d_test.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c
> > index e7d9b72..dfb34ac 100644
> > --- a/tests/exynos/exynos_fimg2d_test.c
> > +++ b/tests/exynos/exynos_fimg2d_test.c
> > @@ -183,7 +183,7 @@ static struct exynos_bo *exynos_create_buffer(struct exynos_device *dev,
> >  
> >  /* Allocate buffer and fill it with checkerboard pattern, where the tiles *
> >   * have a random color. The caller has to free the buffer.                */
> > -void *create_checkerboard_pattern(unsigned int num_tiles_x,
> > +static void *create_checkerboard_pattern(unsigned int num_tiles_x,
> >  						unsigned int num_tiles_y, unsigned int tile_size)
> >  {
> >  	unsigned int *buf;
> Good catch with the missing static!
> 
> 
> > @@ -573,6 +573,7 @@ static int g2d_checkerboard_test(struct exynos_device *dev,
> >  		src_img.user_ptr[0].userptr = (unsigned long)checkerboard;
> >  		src_img.user_ptr[0].size = img_w * img_h * 4;
> >  		break;
> > +	case G2D_IMGBUF_COLOR:
> >  	default:
> >  		ret = -EFAULT;
> >  		goto fail;
> > 
> Hmm, I don't see the reason why this label should be added to the switch
> statement?

This is mostly to appease the compiler. -Wswitch-enum warns about
missing enumeration cases even if default is present. On the other hand
it also warns against branches that use values outside of the
enumeration (which might be useful).

Emil, any thoughts about possibly dropping this warning? I think more
people will scratch their heads if unused enumeration values need to be
added to default branch.


jan

> 
> With best wishes,
> Tobias
> 

-- 
Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150318/55227cc4/attachment.sig>


More information about the dri-devel mailing list