GNU bug report logs - #49749
26.3; 26.3 & 27.2: invalid byte compiler warning in short-circuited or form

Previous Next

Package: emacs;

Reported by: Pierre Rouleau <prouleau001 <at> gmail.com>

Date: Tue, 27 Jul 2021 18:55:02 UTC

Severity: wishlist

Tags: moreinfo, notabug

Found in version 26.3

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 49749 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Pierre Rouleau <prouleau001 <at> gmail.com>
Cc: 49749 <at> debbugs.gnu.org
Subject: Re: bug#49749: 26.3; 26.3 & 27.2: invalid byte compiler warning in
 short-circuited or form
Date: Wed, 28 Jul 2021 17:26:24 +0200
Pierre Rouleau <prouleau001 <at> gmail.com> writes:

> (defun f-or ()
>   "Use or."
>   (when (or (null (boundp 'foo))
>             (null foo))  ;=> ``Warning: reference to free variable ‘foo’``                          
>     (message "foo is not set")))

The message about invalid stuff is only discarded if Emacs is trivially
able to deduce that it'll never be evaluated -- and as you've found out,
it's easy to make that heuristic not be heeded (see
`byte-compile-maybe-guarded' for details).

So I'm not sure this is a bug -- Emacs can't determine all cases where
we won't be executing the code in question at compile time.

Anybody else think that this is something that should be improved?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 3 years and 356 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.