From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Michael Heerdegen <michael_heerdegen@web.de>, 47080-done@debbugs.gnu.org
Subject: bug#47080: 28.0.50; Spurious variable left uninitialized compiler warning
Date: Thu, 11 Mar 2021 22:29:08 -0500 [thread overview]
Message-ID: <jwv7dmdhxd8.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87lfatul18.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 12 Mar 2021 04:07:47 +0100")
Lars Ingebrigtsen [2021-03-12 04:07:47] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> 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).
>
> Oh, is that what the warning means. :-) It's not immediately
> obvious -- could it be changed to something like... er... "Variable
> bound to constant value and not changed"?
Indeed, the warning could even be generalized to other trivial constant
values like `t`, but I think what we have already gives enough false
positives ;-)
[ Still, I'm quite happy with the warning in that it pointed me to a few
actual problems in the code. The average usefulness rating of each
of the warnings that I fixed after adding this warning was not too bad. ]
As for changing the wording, feel free: I'm not too happy with the
current one either (after all, the variables are initialized to nil in
any case, so there's no such thing as an uninitialized variable),
tho I'm not very fond of the one you suggest.
In any case I installed the patch below which should fix the immediate offenders.
Stefan
diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el
index ca641a2ef0..cfb0168a6e 100644
--- a/lisp/emacs-lisp/cconv.el
+++ b/lisp/emacs-lisp/cconv.el
@@ -602,7 +602,8 @@ cconv--analyze-use
(byte-compile-warn
"%s `%S' not left unused" varkind var))
((and (let (or 'let* 'let) (car form))
- `(,(or `(,var) `(,var nil)) t nil ,_ ,_))
+ `(,`(,var) ;; (or `(,var nil) : Too many false positives: bug#47080
+ t nil ,_ ,_))
;; FIXME: Convert this warning to use `macroexp--warn-wrap'
;; so as to give better position information.
(unless (not (intern-soft var))
next prev parent reply other threads:[~2021-03-12 3:29 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
2021-03-12 3:07 ` Lars Ingebrigtsen
2021-03-12 3:29 ` Stefan Monnier [this message]
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=jwv7dmdhxd8.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=47080-done@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).