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

Quentin Glidic sardemff7+wayland at sardemff7.net
Sun Jul 10 09:00:53 UTC 2016


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



More information about the wayland-devel mailing list