mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 03:30:19 +01:00
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:
parent
6955752b95
commit
c23d028300
1 changed files with 2 additions and 0 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue