From c23d028300edd260be2565187845e7d77bfc60fa Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Tue, 16 Dec 2025 13:03:41 +0200 Subject: [PATCH] libweston: fix false-positive uninitialized variables sx, sy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GCC 14.2 with debugoptimized build complained: ../../git/weston/libweston/input.c: In function ‘weston_pointer_set_focus’: ../../git/weston/libweston/input.c:1988:29: error: ‘sx’ may be used uninitialized [-Werror=maybe-uninitialized] 1988 | pointer->sx = sx; | ~~~~~~~~~~~~^~~~ ../../git/weston/libweston/input.c:1913:20: note: ‘sx’ was declared here 1913 | wl_fixed_t sx, sy; | ^~ ../../git/weston/libweston/input.c:1989:29: error: ‘sy’ may be used uninitialized [-Werror=maybe-uninitialized] 1989 | pointer->sy = sy; | ~~~~~~~~~~~~^~~~ ../../git/weston/libweston/input.c:1913:24: note: ‘sy’ was declared here 1913 | wl_fixed_t sx, sy; | ^~ Initialize with an arbitrary value to avoid the warning. This value should never make it outside of this function. The debug build did not complain. Signed-off-by: Pekka Paalanen --- libweston/input.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libweston/input.c b/libweston/input.c index 3cacc798e..f96510066 100644 --- a/libweston/input.c +++ b/libweston/input.c @@ -1983,6 +1983,8 @@ weston_pointer_set_focus(struct weston_pointer *pointer, int refocus = 0; wl_fixed_t sx, sy; + sx = sy = wl_fixed_from_int(-999999); /* poison */ + if (view) { struct weston_coord_surface surf_pos;