emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master bec8474a45 16/16: Improve GCC pacification in xterm.c


From: Paul Eggert
Subject: master bec8474a45 16/16: Improve GCC pacification in xterm.c
Date: Mon, 1 Aug 2022 04:17:29 -0400 (EDT)

branch: master
commit bec8474a453757aed9a38f4786325b7144c246e9
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    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  <eggert@cs.ucla.edu>
---
 src/xterm.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 986973eb78..bf6061d30e 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,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]