[RFC xserver 2/3] xwayland: fix 'buffer' may be used uninitialized warning

Pekka Paalanen ppaalanen at gmail.com
Thu Nov 24 13:40:36 UTC 2016


From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

Fix the following warning due to --disable-glamor:

  CC       Xwayland-xwayland.o
In file included from /home/pq/local/include/wayland-client.h:40:0,
                 from xwayland.h:35,
                 from xwayland.c:26:
xwayland.c: In function ‘block_handler’:
/home/pq/local/include/wayland-client-protocol.h:3446:2: warning: ‘buffer’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  wl_proxy_marshal((struct wl_proxy *) wl_surface,
  ^
xwayland.c:466:23: note: ‘buffer’ was declared here
     struct wl_buffer *buffer;
                       ^

Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 hw/xwayland/xwayland.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index c2ac4b3..9d79554 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -474,8 +474,8 @@ xwl_window_post_damage(struct xwl_window *xwl_window)
 #if GLAMOR_HAS_GBM
     if (xwl_screen->glamor)
         buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap);
+    else
 #endif
-    if (!xwl_screen->glamor)
         buffer = xwl_shm_pixmap_get_wl_buffer(pixmap);
 
     wl_surface_attach(xwl_window->surface, buffer, 0, 0);
-- 
2.7.3



More information about the xorg-devel mailing list