[Mesa-dev] [PATCH kmscube] cube-tex: Handle SMOOTH switch case

Eric Engestrom eric at engestrom.ch
Thu Mar 16 00:27:21 UTC 2017


On Wednesday, 2017-03-15 18:56:53 -0300, Fabio Estevam wrote:
> In kmscube.c there is the following logic:
> 
> 	if (mode == SMOOTH) {
> 		egl = init_cube_smooth(gbm);
> 	} else {
> 		egl = init_cube_tex(gbm, mode);
> 	}
> 
> ,which makes init_cube_tex() to be never called on the SMOOTH case.
> 
> Handle the SMOOTH switch case inside init_tex() to fix the following
> build warning:
> 
> cube-tex.c: In function 'init_tex':
> cube-tex.c:438:2: warning: enumeration value 'SMOOTH' not handled in switch [-Wswitch]
>   switch (mode) {
>   ^
> 
> Signed-off-by: Fabio Estevam <festevam at gmail.com>
> ---
>  cube-tex.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/cube-tex.c b/cube-tex.c
> index a543e83..8aab06c 100644
> --- a/cube-tex.c
> +++ b/cube-tex.c
> @@ -442,6 +442,9 @@ static int init_tex(enum mode mode)
>  		return init_tex_nv12_2img();
>  	case NV12_1IMG:
>  		return init_tex_nv12_1img();
> +	/* should never reach here */
> +	case SMOOTH:

I think adding an `assert(!"unreachable");` here would be a good idea,
but your patch is correct:
Reviewed-by: Eric Engestrom <eric at engestrom.ch>

I'll push it tomorrow (probably with the assert added) if nobody shouts.

> +		return -1;
>  	}
>  	return -1;
>  }
> -- 
> 2.7.4
> 


More information about the mesa-dev mailing list