emacs-devel
[Top][All Lists]
Advanced

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

Re: New warnings on emacs-26 branch with gcc 8.2.0


From: Eli Zaretskii
Subject: Re: New warnings on emacs-26 branch with gcc 8.2.0
Date: Fri, 17 Aug 2018 22:45:09 +0300

> From: Andy Moreton <address@hidden>
> Date: Fri, 17 Aug 2018 16:21:24 +0100
> 
> >> C:/emacs/git/emacs/master/src/w32fns.c: In function 'Fw32_read_registry':
> >> C:/emacs/git/emacs/master/src/w32fns.c:10142:21: warning: 'rootkey' may be 
> >> used uninitialized in this function [-Wmaybe-uninitialized]
> >>    Lisp_Object val = w32_read_registry (NILP (root)
> >>                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >>             ? HKEY_CURRENT_USER
> >>             ~~~~~~~~~~~~~~~~~~~
> >>             : rootkey,
> >>             ~~~~~~~~~~
> >>             key, name);
> >>             ~~~~~~~~~~
> >
> > Thanks, pushed to the master branch.  I just made the new function's
> > name a bit shorter.
> 
> Thanks. The warning shown above can be fixed with this patch:

Thanks, but I prefer using UNINIT only where no better solution is at
hand.  In this case, there is; please try the patch below:

diff --git a/src/w32fns.c b/src/w32fns.c
index c32868f..b587677 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -10125,7 +10125,7 @@ to be converted to forward slashes by the caller.  */)
   CHECK_STRING (key);
   CHECK_STRING (name);
 
-  HKEY rootkey;
+  HKEY rootkey = HKEY_CURRENT_USER;
   if (EQ (root, QHKCR))
     rootkey = HKEY_CLASSES_ROOT;
   else if (EQ (root, QHKCU))
@@ -10139,10 +10139,7 @@ to be converted to forward slashes by the caller.  */)
   else if (!NILP (root))
     error ("unknown root key: %s", SDATA (SYMBOL_NAME (root)));
 
-  Lisp_Object val = w32_read_registry (NILP (root)
-                                      ? HKEY_CURRENT_USER
-                                      : rootkey,
-                                      key, name);
+  Lisp_Object val = w32_read_registry (rootkey, key, name);
   if (NILP (val) && NILP (root))
     val = w32_read_registry (HKEY_LOCAL_MACHINE, key, name);
 



reply via email to

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