From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: New warnings on emacs-26 branch with gcc 8.2.0 Date: Fri, 17 Aug 2018 22:45:09 +0300 Message-ID: <83va88g4l6.fsf@gnu.org> References: <86a7q0ai2z.fsf@gmail.com> <6d36dc4c-1e14-b6c8-e2f0-911d08f759e1@cs.ucla.edu> <83in4os01j.fsf@gnu.org> <16f2754a-b40e-4bc4-f95a-9bada460d5a4@cs.ucla.edu> <83bma9mh3z.fsf@gnu.org> <86eff52njj.fsf@gmail.com> <83wosxkwfz.fsf@gnu.org> <864lg1rlp0.fsf@gmail.com> <83mutslt8f.fsf@gnu.org> <86in4gixg3.fsf@gmail.com> <83d0uolpxt.fsf@gnu.org> <86600giwct.fsf@gmail.com> <861sb4iv2d.fsf@gmail.com> <838t5clnxk.fsf@gnu.org> <838t55gj2q.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1534535039 3408 195.159.176.226 (17 Aug 2018 19:43:59 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 17 Aug 2018 19:43:59 +0000 (UTC) Cc: emacs-devel@gnu.org To: Andy Moreton Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 17 21:43:55 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqkf4-0000kO-VY for ged-emacs-devel@m.gmane.org; Fri, 17 Aug 2018 21:43:55 +0200 Original-Received: from localhost ([::1]:36191 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqkhB-0005m6-F8 for ged-emacs-devel@m.gmane.org; Fri, 17 Aug 2018 15:46:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqkgV-0005kM-DP for emacs-devel@gnu.org; Fri, 17 Aug 2018 15:45:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fqkgR-0003jk-Dl for emacs-devel@gnu.org; Fri, 17 Aug 2018 15:45:23 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:46743) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqkgR-0003je-91; Fri, 17 Aug 2018 15:45:19 -0400 Original-Received: from [176.228.60.248] (port=3010 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fqkgQ-0008Fu-PP; Fri, 17 Aug 2018 15:45:19 -0400 In-reply-to: (message from Andy Moreton on Fri, 17 Aug 2018 16:21:24 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:228647 Archived-At: > From: Andy Moreton > 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);