]> git.eshelyaron.com Git - emacs.git/commitdiff
Pacify GCC 12 in x_get_current_wm_state
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 31 May 2022 08:19:32 +0000 (01:19 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 31 May 2022 08:26:47 +0000 (01:26 -0700)
* src/xterm.c (x_get_current_wm_state): When lint checking,
initialize reply_data to a non-null dummy value instead of to a
null one.  This pacifies GCC 12 -Wanalyzer-null-dereference.

src/xterm.c

index e9c38ae4847844b35c866a0fbc8d00cca55a5b19..0ebabdccafda441d2c3ede525a2978fa1e102564 100644 (file)
@@ -22468,15 +22468,20 @@ x_get_current_wm_state (struct frame *f,
 #ifdef USE_XCB
   xcb_get_property_cookie_t prop_cookie;
   xcb_get_property_reply_t *prop;
-  xcb_atom_t *reply_data UNINIT;
+  typedef xcb_atom_t reply_data_object;
 #else
   Display *dpy = FRAME_X_DISPLAY (f);
   unsigned long bytes_remaining;
   int rc, actual_format;
   Atom actual_type;
   unsigned char *tmp_data = NULL;
-  Atom *reply_data UNINIT;
+  typedef Atom reply_data_object;
 #endif
+  reply_data_object *reply_data;
+# if defined GCC_LINT || defined lint
+  reply_data_object reply_data_dummy;
+  reply_data = &reply_data_dummy;
+# endif
 
   *sticky = false;
   *size_state = FULLSCREEN_NONE;