libweston: fix false-positive uninitialized variables sx, sy

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 <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2025-12-16 13:03:41 +02:00 committed by Marius Vlad
parent 6955752b95
commit c23d028300

View file

@ -1983,6 +1983,8 @@ weston_pointer_set_focus(struct weston_pointer *pointer,
int refocus = 0; int refocus = 0;
wl_fixed_t sx, sy; wl_fixed_t sx, sy;
sx = sy = wl_fixed_from_int(-999999); /* poison */
if (view) { if (view) {
struct weston_coord_surface surf_pos; struct weston_coord_surface surf_pos;