From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#47080: 28.0.50; Spurious variable left uninitialized compiler warning Date: Thu, 11 Mar 2021 21:58:51 -0500 Message-ID: References: <87tuph6xvl.fsf@web.de> <875z1xz0d6.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12149"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Michael Heerdegen , 47080@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 12 04:00:11 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lKY26-00035A-T9 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Mar 2021 04:00:11 +0100 Original-Received: from localhost ([::1]:50274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKY26-0006WO-0l for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 Mar 2021 22:00:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKY1y-0006WB-GU for bug-gnu-emacs@gnu.org; Thu, 11 Mar 2021 22:00:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44193) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lKY1y-0004lS-8Z for bug-gnu-emacs@gnu.org; Thu, 11 Mar 2021 22:00:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lKY1y-0006cN-6I for bug-gnu-emacs@gnu.org; Thu, 11 Mar 2021 22:00:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Mar 2021 03:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47080 X-GNU-PR-Package: emacs Original-Received: via spool by 47080-submit@debbugs.gnu.org id=B47080.161551794225351 (code B ref 47080); Fri, 12 Mar 2021 03:00:02 +0000 Original-Received: (at 47080) by debbugs.gnu.org; 12 Mar 2021 02:59:02 +0000 Original-Received: from localhost ([127.0.0.1]:55739 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lKY10-0006ap-6I for submit@debbugs.gnu.org; Thu, 11 Mar 2021 21:59:02 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:17768) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lKY0y-0006aK-8V for 47080@debbugs.gnu.org; Thu, 11 Mar 2021 21:59:00 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 7AAA080B6D; Thu, 11 Mar 2021 21:58:54 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id EC448803F1; Thu, 11 Mar 2021 21:58:52 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1615517932; bh=ES6odzK4YvJeABY4Bl5Gcpa6eTAq9yOEvpflvyNcoNM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=httm6JiRNZRxDMGtwyDiWoghyqR+HN9mfLl9lm3dv9wVXHQKxU28yLOvxWnZPt6Bt 7SNCuaLYlndqUKgWkpySElFZP+feaN2FuWPW+42ktUKlW/WjAwk+mI1ivGCz8w2n9r xDlRe+/b3SE3i9CKOGYn77YQ9oHNeQI4vFfB6QHZI7tcFT21rt7FKqKiOqFsZLDKW+ vitRKx3KRzb98wZKFejmapvduomP968/0ODnnv1pu9iybmUSPz7rcyvA3pNc0MGRZ7 N6oSux5ZPcLW3F/PzuWkaH95gR/Ib6b7ofPY73XCNKnB0yivlfrwZH4eqgWmH9Rh/w iWBWkxsc1u24A== Original-Received: from alfajor (unknown [216.154.43.249]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B347C120264; Thu, 11 Mar 2021 21:58:52 -0500 (EST) In-Reply-To: <875z1xz0d6.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 12 Mar 2021 01:23:01 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:202133 Archived-At: Lars Ingebrigtsen [2021-03-12 01:23:01] wrote: > Michael Heerdegen writes: >> Compiling gives me: >> | compile-test.el:6:1: Warning: Variable `file' left uninitialized >> | compile-test.el:6:1: Warning: Variable `file' left uninitialized > > This is perhaps the same problem that's causing this warning on the > current Emacs trunk? Indeed. > In toplevel form: > progmodes/sh-script.el:1050:1: Warning: Variable `syntax' left uninitialized I just fixed this one. > I was just looking at this, and it looks like a spurious warning, if I > read the syntax-propertize-rules correctly. The warning complains when you initially bind a lexical var to nil (either by not giving a value or by giving an explicit nil) and then never set it to any other value. Indeed, it's a useless binding: you could just use nil instead wherever you use that var, so the warning is working as intended. And indeed, it found a few places where we bound a var to nil and then just returned its value (and it's thanks to this warning that I discovered that those var needed to be declared as dynamically scoped). But the above `pcase` and `syntax-propertize-rules` show that it can be quite inconvenient. I can probably fix `pcase` to work around the issue, but ... it's probably better to tone down the warning so it's only issued if the nil binding is implicit rather than explicit. Stefan