From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Michael Heerdegen <michael_heerdegen@web.de>, 47080@debbugs.gnu.org
Subject: bug#47080: 28.0.50; Spurious variable left uninitialized compiler warning
Date: Thu, 11 Mar 2021 21:58:51 -0500 [thread overview]
Message-ID: <jwvim5xhylp.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <875z1xz0d6.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 12 Mar 2021 01:23:01 +0100")
Lars Ingebrigtsen [2021-03-12 01:23:01] wrote:
> Michael Heerdegen <michael_heerdegen@web.de> 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
next prev parent reply other threads:[~2021-03-12 2:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-12 0:04 bug#47080: 28.0.50; Spurious variable left uninitialized compiler warning Michael Heerdegen
2021-03-12 0:23 ` Lars Ingebrigtsen
2021-03-12 0:39 ` Michael Heerdegen
2021-03-12 2:58 ` Stefan Monnier [this message]
2021-03-12 3:07 ` Lars Ingebrigtsen
2021-03-12 3:29 ` Stefan Monnier
2021-03-13 0:13 ` Michael Heerdegen
2021-03-13 0:37 ` Stefan Monnier
2021-03-13 0:44 ` Michael Heerdegen
2021-03-13 0:58 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvim5xhylp.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=47080@debbugs.gnu.org \
--cc=larsi@gnus.org \
--cc=michael_heerdegen@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).