[PATCH weston v2 4/8] libweston: Silence tautological-compare warning

Giulio Camuffo giuliocamuffo at gmail.com
Mon Aug 8 10:20:51 UTC 2016


Hi,

Reviewed-by: Giulio Camuffo <giuliocamuffo at gmail.com>

2016-07-10 11:00 GMT+02:00 Quentin Glidic <sardemff7+wayland at sardemff7.net>:
> From: Quentin Glidic <sardemff7+git at sardemff7.net>
>
> libweston/compositor.c:5023:14: warning: comparison of unsigned enum
> expression < 0 is always false [-Wtautological-compare]
>         if (backend < 0 || backend >= ARRAY_LENGTH(backend_map))
>                     ~~~~~~~ ^ ~
>
> Warning produced by Clang 3.8.
>
> Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
> ---
>  libweston/compositor.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libweston/compositor.c b/libweston/compositor.c
> index 771f1c9..2da29ca 100644
> --- a/libweston/compositor.c
> +++ b/libweston/compositor.c
> @@ -5020,7 +5020,7 @@ weston_compositor_load_backend(struct weston_compositor *compositor,
>         int (*backend_init)(struct weston_compositor *c,
>                             struct weston_backend_config *config_base);
>
> -       if (backend < 0 || backend >= ARRAY_LENGTH(backend_map))
> +       if (backend >= ARRAY_LENGTH(backend_map))
>                 return -1;
>
>         backend_init = weston_load_module(backend_map[backend], "backend_init");
> --
> 2.9.0
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list