From bec8474a453757aed9a38f4786325b7144c246e9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 1 Aug 2022 00:38:34 -0700 Subject: [PATCH] Improve GCC pacification in xterm.c * src/xterm.c (x_dnd_free_toplevels, x_composite_image): Use UNINIT for initialization needed only to pacify GCC. (x_dnd_free_toplevels): Add an eassume to pacify GCC 12.1 x86-64 -Wanalyzer-null-dereference. 2022-07-31 Paul Eggert --- src/xterm.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index 986973eb788..bf6061d30eb 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -2837,8 +2837,8 @@ x_dnd_free_toplevels (bool display_alive) struct x_client_list_window *last; struct x_client_list_window *tem = x_dnd_toplevels; ptrdiff_t n_windows, i, buffer_size; - Window *destroy_windows; - unsigned long *prev_masks; + Window *destroy_windows UNINIT; + unsigned long *prev_masks UNINIT; specpdl_ref count; Display *dpy; struct x_display_info *dpyinfo; @@ -2847,10 +2847,6 @@ x_dnd_free_toplevels (bool display_alive) /* Probably called inside an IO error handler. */ return; - /* Pacify GCC. */ - prev_masks = NULL; - destroy_windows = NULL; - if (display_alive) { buffer_size = 1024; @@ -2913,6 +2909,7 @@ x_dnd_free_toplevels (bool display_alive) if (n_windows) { + eassume (dpyinfo); x_ignore_errors_for_next_request (dpyinfo); for (i = 0; i < n_windows; ++i) @@ -9311,9 +9308,7 @@ x_composite_image (struct glyph_string *s, Pixmap dest, { Picture destination; XRenderPictFormat *default_format; - XRenderPictureAttributes attr; - /* Pacify GCC. */ - memset (&attr, 0, sizeof attr); + XRenderPictureAttributes attr UNINIT; default_format = FRAME_X_PICTURE_FORMAT (s->f); destination = XRenderCreatePicture (display, dest, -- 2.39.2