Commit a1e0868f authored by Paul Eggert's avatar Paul Eggert

Pacify gcc -Og -Wuninitialized

This addresses the -Og uninitialized variable warnings I ran
into on Fedora 28, which uses 8.1.1 20180712 (Red Hat 8.1.1-5).
It also changes some explicit initializations to UNINIT
when the variable does not actually need to be initialized.
* src/process.c (connect_network_socket):
* src/sysdep.c (system_process_attributes):
* src/xfns.c (x_real_pos_and_offsets):
* src/xterm.c (get_current_wm_state) [USE_XCB]:
Add UNINIT.
* src/editfns.c (tzlookup):
* src/fns.c (Fnconc):
* src/font.c (font_parse_fcname):
* src/frame.c (x_set_frame_parameters):
Prefer UNINIT to explicit initialization.
parent ca100118
...@@ -174,7 +174,7 @@ tzlookup (Lisp_Object zone, bool settz) ...@@ -174,7 +174,7 @@ tzlookup (Lisp_Object zone, bool settz)
else if (plain_integer || (CONSP (zone) && FIXNUMP (XCAR (zone)) else if (plain_integer || (CONSP (zone) && FIXNUMP (XCAR (zone))
&& CONSP (XCDR (zone)))) && CONSP (XCDR (zone))))
{ {
Lisp_Object abbr = Qnil; Lisp_Object abbr UNINIT;
if (!plain_integer) if (!plain_integer)
{ {
abbr = XCAR (XCDR (zone)); abbr = XCAR (XCDR (zone));
......
...@@ -2522,7 +2522,7 @@ usage: (nconc &rest LISTS) */) ...@@ -2522,7 +2522,7 @@ usage: (nconc &rest LISTS) */)
CHECK_CONS (tem); CHECK_CONS (tem);
Lisp_Object tail = Qnil; Lisp_Object tail UNINIT;
FOR_EACH_TAIL (tem) FOR_EACH_TAIL (tem)
tail = tem; tail = tem;
......
...@@ -1468,7 +1468,7 @@ font_parse_fcname (char *name, ptrdiff_t len, Lisp_Object font) ...@@ -1468,7 +1468,7 @@ font_parse_fcname (char *name, ptrdiff_t len, Lisp_Object font)
else else
{ {
/* KEY=VAL pairs */ /* KEY=VAL pairs */
Lisp_Object key = Qnil; Lisp_Object key UNINIT;
int prop; int prop;
if (q - p == 10 && memcmp (p + 1, "pixelsize", 9) == 0) if (q - p == 10 && memcmp (p + 1, "pixelsize", 9) == 0)
......
...@@ -3798,7 +3798,7 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) ...@@ -3798,7 +3798,7 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist)
Lisp_Object icon_left, icon_top; Lisp_Object icon_left, icon_top;
/* And with this. */ /* And with this. */
Lisp_Object fullscreen = Qnil; Lisp_Object fullscreen UNINIT;
bool fullscreen_change = false; bool fullscreen_change = false;
/* Record in these vectors all the parms specified. */ /* Record in these vectors all the parms specified. */
......
...@@ -3336,7 +3336,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos, ...@@ -3336,7 +3336,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
int family; int family;
struct sockaddr *sa = NULL; struct sockaddr *sa = NULL;
int ret; int ret;
ptrdiff_t addrlen; ptrdiff_t addrlen UNINIT;
struct Lisp_Process *p = XPROCESS (proc); struct Lisp_Process *p = XPROCESS (proc);
Lisp_Object contact = p->childp; Lisp_Object contact = p->childp;
int optbits = 0; int optbits = 0;
......
...@@ -3239,7 +3239,7 @@ system_process_attributes (Lisp_Object pid) ...@@ -3239,7 +3239,7 @@ system_process_attributes (Lisp_Object pid)
struct group *gr; struct group *gr;
long clocks_per_sec; long clocks_per_sec;
char *procfn_end; char *procfn_end;
char procbuf[1025], *p, *q; char procbuf[1025], *p, *q UNINIT;
int fd; int fd;
ssize_t nread; ssize_t nread;
static char const default_cmd[] = "???"; static char const default_cmd[] = "???";
......
...@@ -274,7 +274,7 @@ x_real_pos_and_offsets (struct frame *f, ...@@ -274,7 +274,7 @@ x_real_pos_and_offsets (struct frame *f,
should be the outer WM window. */ should be the outer WM window. */
for (;;) for (;;)
{ {
Window wm_window, rootw; Window wm_window UNINIT, rootw UNINIT;
#ifdef USE_XCB #ifdef USE_XCB
xcb_query_tree_cookie_t query_tree_cookie; xcb_query_tree_cookie_t query_tree_cookie;
......
...@@ -10637,7 +10637,7 @@ get_current_wm_state (struct frame *f, ...@@ -10637,7 +10637,7 @@ get_current_wm_state (struct frame *f,
#ifdef USE_XCB #ifdef USE_XCB
xcb_get_property_cookie_t prop_cookie; xcb_get_property_cookie_t prop_cookie;
xcb_get_property_reply_t *prop; xcb_get_property_reply_t *prop;
xcb_atom_t *reply_data; xcb_atom_t *reply_data UNINIT;
#else #else
Display *dpy = FRAME_X_DISPLAY (f); Display *dpy = FRAME_X_DISPLAY (f);
unsigned long bytes_remaining; unsigned long bytes_remaining;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment