GNU bug report logs -
#21963
Spurious byte compile message: "Warning: the function `bar' might not be defined at runtime."
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Fri, 20 Nov 2015 10:50:03 UTC
Severity: minor
Fixed in version 25.1
Done: Stefan Kangas <stefan <at> marxist.se>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 21963 in the body.
You can then email your comments to 21963 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21963
; Package
emacs
.
(Fri, 20 Nov 2015 10:50:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Alan Mackenzie <acm <at> muc.de>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 20 Nov 2015 10:50:04 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello Emacs.
Using the latest from the emacs-25 branch:
This bug is a variant of bug #11918, which hasn't yet been resolved.
1. Create two Emacs Lisp source files, ~/warnings-bar.el and
~/warnings-foo.el with the following contents:
;;;;;;;; warnings-bar.el ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun bar ()
"Doc string"
"bar")
(provide 'warning-bar)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;; warnings-foo.el ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(eval-when-compile (require 'warning-bar))
(require 'warning-bar)
(defun foo ()
(bar))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2. (Optional) byte compile warnings-bar.el.
3. Byte compile warnings-foo.el with:
emacs -Q -batch -L ~ -f batch-byte-compile warning-foo.el
. This produces the spurious warning message:
warning-foo.el:6:1:Warning: the function `bar' might not be defined
at runtime.
.
N.B. if the `eval-when-compile' form is removed from warnings-foo.el, the
warning is not produced.
--
Alan Mackenzie (Nuremberg, Germany).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21963
; Package
emacs
.
(Fri, 20 Nov 2015 11:21:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 21963 <at> debbugs.gnu.org (full text, mbox):
> Date: Fri, 20 Nov 2015 10:44:19 +0000
> From: Alan Mackenzie <acm <at> muc.de>
>
> This bug is a variant of bug #11918, which hasn't yet been resolved.
I'm not sure this is the same issue.
> 1. Create two Emacs Lisp source files, ~/warnings-bar.el and
> ~/warnings-foo.el with the following contents:
>
> ;;;;;;;; warnings-bar.el ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> (defun bar ()
> "Doc string"
> "bar")
>
> (provide 'warning-bar)
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
> ;;;;;;;; warnings-foo.el ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> (eval-when-compile (require 'warning-bar))
> (require 'warning-bar)
>
> (defun foo ()
> (bar))
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
>
> 2. (Optional) byte compile warnings-bar.el.
> 3. Byte compile warnings-foo.el with:
> emacs -Q -batch -L ~ -f batch-byte-compile warning-foo.el
>
> . This produces the spurious warning message:
>
> warning-foo.el:6:1:Warning: the function `bar' might not be defined
> at runtime.
>
> .
eval-when-compile has no effect at run time, and the warning is
explicitly about what might happen at runtime.
IOW, I don't think this is a bug.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21963
; Package
emacs
.
(Fri, 20 Nov 2015 11:39:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 21963 <at> debbugs.gnu.org (full text, mbox):
Hello, Eli.
On Fri, Nov 20, 2015 at 01:19:19PM +0200, Eli Zaretskii wrote:
> > Date: Fri, 20 Nov 2015 10:44:19 +0000
> > From: Alan Mackenzie <acm <at> muc.de>
> > This bug is a variant of bug #11918, which hasn't yet been resolved.
> I'm not sure this is the same issue.
Possibly not.
> > 1. Create two Emacs Lisp source files, ~/warnings-bar.el and
> > ~/warnings-foo.el with the following contents:
> > ;;;;;;;; warnings-bar.el ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> > (defun bar ()
> > "Doc string"
> > "bar")
> > (provide 'warning-bar)
> > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> > ;;;;;;;; warnings-foo.el ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> > (eval-when-compile (require 'warning-bar))
> > (require 'warning-bar)
> > (defun foo ()
> > (bar))
> > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> > 2. (Optional) byte compile warnings-bar.el.
> > 3. Byte compile warnings-foo.el with:
> > emacs -Q -batch -L ~ -f batch-byte-compile warning-foo.el
> > . This produces the spurious warning message:
> > warning-foo.el:6:1:Warning: the function `bar' might not be defined
> > at runtime.
> > .
> eval-when-compile has no effect at run time, and the warning is
> explicitly about what might happen at runtime.
> IOW, I don't think this is a bug.
It is, at the very least, puzzling behaviour. The warning is issued for
a function that most definitely has been defined at runtime.
What seems to be happening (I'm speculating a little) is that the byte
compiler maintains a list of not-yet-defined functions in
byte-compile-unresolved-functions. Functions defined at compile time
are pushed onto this list. The problem is that when they are later
defined for run time, they aren't taken off the list.
Given that we've all been asked to get rid of warnings for 25.1, I have
to disagree with you about whether this is a bug.
--
Alan Mackenzie (Nuremberg, Germany).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21963
; Package
emacs
.
(Fri, 20 Nov 2015 14:49:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 21963 <at> debbugs.gnu.org (full text, mbox):
> Date: Fri, 20 Nov 2015 11:40:50 +0000
> Cc: 21963 <at> debbugs.gnu.org
> From: Alan Mackenzie <acm <at> muc.de>
>
> > eval-when-compile has no effect at run time, and the warning is
> > explicitly about what might happen at runtime.
>
> > IOW, I don't think this is a bug.
>
> It is, at the very least, puzzling behaviour. The warning is issued for
> a function that most definitely has been defined at runtime.
No, it was not (or, more accurately, will not be). 'eval-when-compile'
does nothing to make sure it will be defined at runtime; you need
either 'require' or 'eval-and-compile'.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21963
; Package
emacs
.
(Fri, 20 Nov 2015 15:25:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 21963 <at> debbugs.gnu.org (full text, mbox):
Hello, Eli.
On Fri, Nov 20, 2015 at 04:48:13PM +0200, Eli Zaretskii wrote:
> > Date: Fri, 20 Nov 2015 11:40:50 +0000
> > Cc: 21963 <at> debbugs.gnu.org
> > From: Alan Mackenzie <acm <at> muc.de>
> > > eval-when-compile has no effect at run time, and the warning is
> > > explicitly about what might happen at runtime.
> > > IOW, I don't think this is a bug.
> > It is, at the very least, puzzling behaviour. The warning is issued for
> > a function that most definitely has been defined at runtime.
> No, it was not (or, more accurately, will not be). 'eval-when-compile'
> does nothing to make sure it will be defined at runtime; you need
> either 'require' or 'eval-and-compile'.
The first two lines of the file are:
(eval-when-compile (require 'warning-bar))
(require 'warning-bar)
The second line will define the function `bar' at run time.
The byte-compiler has already decided after the first line that `bar' is
not defined at run time (fair enough), but seems unwilling to change its
mind after the second line.
This isn't just an academic problem. CC Mode uses such sequences (in
effect), producing warnings in the Emacs build.
--
Alan Mackenzie (Nuremberg, Germany).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21963
; Package
emacs
.
(Fri, 20 Nov 2015 15:50:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 21963 <at> debbugs.gnu.org (full text, mbox):
> Date: Fri, 20 Nov 2015 15:26:38 +0000
> Cc: 21963 <at> debbugs.gnu.org
> From: Alan Mackenzie <acm <at> muc.de>
>
> The first two lines of the file are:
>
> (eval-when-compile (require 'warning-bar))
> (require 'warning-bar)
I think if you leave only the second one, Bob's your uncle.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21963
; Package
emacs
.
(Fri, 20 Nov 2015 16:02:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 21963 <at> debbugs.gnu.org (full text, mbox):
>>>>> Eli Zaretskii <eliz <at> gnu.org> writes:
>> (eval-when-compile (require 'warning-bar))
>> (require 'warning-bar)
> I think if you leave only the second one, Bob's your uncle.
I think the question is: Why does haven't the first one cause the definedness
introduced by the second to not be recognized?
John
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21963
; Package
emacs
.
(Fri, 20 Nov 2015 16:14:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 21963 <at> debbugs.gnu.org (full text, mbox):
Hello, John.
On Fri, Nov 20, 2015 at 08:01:31AM -0800, John Wiegley wrote:
> >>>>> Eli Zaretskii <eliz <at> gnu.org> writes:
> >> (eval-when-compile (require 'warning-bar))
> >> (require 'warning-bar)
> > I think if you leave only the second one, Bob's your uncle.
> I think the question is: Why does haven't the first one cause the definedness
> introduced by the second to not be recognized?
While eval-when-compile'ing the first line, the byte compiler collects a
list of symbols defined by it (in variable
byte-compile-noruntime-functions). More or less.
There is no mechanism for taking symbols off of that list when they
subsequently become defined.
> John
--
Alan Mackenzie (Nuremberg, Germany).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21963
; Package
emacs
.
(Fri, 20 Nov 2015 16:46:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 21963 <at> debbugs.gnu.org (full text, mbox):
>>>>> Alan Mackenzie <acm <at> muc.de> writes:
> While eval-when-compile'ing the first line, the byte compiler collects a
> list of symbols defined by it (in variable
> byte-compile-noruntime-functions). More or less.
> There is no mechanism for taking symbols off of that list when they
> subsequently become defined.
Not optimal, but I must ask: Should it be fixed? Or, for now, simply noted in
the elisp manual when discussing the merits of this warning?
John
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21963
; Package
emacs
.
(Fri, 20 Nov 2015 17:49:01 GMT)
Full text and
rfc822 format available.
Message #32 received at 21963 <at> debbugs.gnu.org (full text, mbox):
Hello, John.
On Fri, Nov 20, 2015 at 08:44:56AM -0800, John Wiegley wrote:
> >>>>> Alan Mackenzie <acm <at> muc.de> writes:
> > While eval-when-compile'ing the first line, the byte compiler collects a
> > list of symbols defined by it (in variable
> > byte-compile-noruntime-functions). More or less.
> > There is no mechanism for taking symbols off of that list when they
> > subsequently become defined.
> Not optimal, but I must ask: Should it be fixed? Or, for now, simply noted in
> the elisp manual when discussing the merits of this warning?
I think it should be fixed. It will eliminate warnings from CC Mode (at
the very least).
I am working on it as we speak. I expect to produce a patch for review
soon.
> John
--
Alan Mackenzie (Nuremberg, Germany).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21963
; Package
emacs
.
(Sun, 29 Sep 2019 21:25:02 GMT)
Full text and
rfc822 format available.
Message #35 received at 21963 <at> debbugs.gnu.org (full text, mbox):
Alan Mackenzie <acm <at> muc.de> writes:
> On Fri, Nov 20, 2015 at 08:44:56AM -0800, John Wiegley wrote:
>> >>>>> Alan Mackenzie <acm <at> muc.de> writes:
>
>> > While eval-when-compile'ing the first line, the byte compiler collects a
>> > list of symbols defined by it (in variable
>> > byte-compile-noruntime-functions). More or less.
>
>> > There is no mechanism for taking symbols off of that list when they
>> > subsequently become defined.
>
>> Not optimal, but I must ask: Should it be fixed? Or, for now, simply noted in
>> the elisp manual when discussing the merits of this warning?
>
> I think it should be fixed. It will eliminate warnings from CC Mode (at
> the very least).
>
> I am working on it as we speak. I expect to produce a patch for review
> soon.
Hi Alan,
That was four years ago. Did you finish the patch which would resolve
this issue?
Best regards,
Stefan Kangas
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21963
; Package
emacs
.
(Mon, 30 Sep 2019 18:23:01 GMT)
Full text and
rfc822 format available.
Message #38 received at 21963 <at> debbugs.gnu.org (full text, mbox):
Hello, Stefan.
On Sun, Sep 29, 2019 at 23:24:29 +0200, Stefan Kangas wrote:
> Alan Mackenzie <acm <at> muc.de> writes:
> > On Fri, Nov 20, 2015 at 08:44:56AM -0800, John Wiegley wrote:
> >> >>>>> Alan Mackenzie <acm <at> muc.de> writes:
> >> > While eval-when-compile'ing the first line, the byte compiler collects a
> >> > list of symbols defined by it (in variable
> >> > byte-compile-noruntime-functions). More or less.
> >> > There is no mechanism for taking symbols off of that list when they
> >> > subsequently become defined.
> >> Not optimal, but I must ask: Should it be fixed? Or, for now, simply noted in
> >> the elisp manual when discussing the merits of this warning?
> > I think it should be fixed. It will eliminate warnings from CC Mode (at
> > the very least).
> > I am working on it as we speak. I expect to produce a patch for review
> > soon.
> Hi Alan,
> That was four years ago. Did you finish the patch which would resolve
> this issue?
Yes, I did indeed; with this patch:
acb96f2718ccb0d36af514ce63b5decf0f24a697
Squashed commit of the following: .....
Tue Nov 24 17:37:49 2015 +0000
Sorry I forgot to close the bug.
> Best regards,
> Stefan Kangas
--
Alan Mackenzie (Nuremberg, Germany).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21963
; Package
emacs
.
(Mon, 30 Sep 2019 21:25:02 GMT)
Full text and
rfc822 format available.
Message #41 received at 21963 <at> debbugs.gnu.org (full text, mbox):
close 21963 25.1
quit
> > That was four years ago. Did you finish the patch which would resolve
> > this issue?
>
> Yes, I did indeed; with this patch:
>
> acb96f2718ccb0d36af514ce63b5decf0f24a697
> Squashed commit of the following: .....
> Tue Nov 24 17:37:49 2015 +0000
>
> Sorry I forgot to close the bug.
Thanks; closed now.
Best regards,
Stefan Kangas
bug marked as fixed in version 25.1, send any further explanations to
21963 <at> debbugs.gnu.org and Alan Mackenzie <acm <at> muc.de>
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Mon, 30 Sep 2019 21:25:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 29 Oct 2019 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 194 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.