all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#14551: compiler fails to track eval-when-compile in required files
@ 2013-06-03 20:30 Glenn Morris
  2013-06-03 20:59 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2013-06-03 20:30 UTC (permalink / raw)
  To: 14551

Package: emacs
Severity: minor
Version: 24.3

(I guess this issue has always been present.)

Suppose we have three files:


foo.el:
(require 'lib)
(defun foo ()
  (lib2-func))


lib.el:
(eval-when-compile
  (require 'lib2))
(provide 'lib)


lib2.el:
(defun lib2-func ()
  t)
(provide 'lib2)


rm lib*.elc
emacs -Q -L . -batch -f batch-byte-compile foo.el

produces no warnings.

If lib.el is compiled first though:
emacs -Q -L . -batch -f batch-byte-compile lib.el
emacs -Q -L . -batch -f batch-byte-compile foo.el

In end of data:
foo.el:6:1:Warning: the function `lib2-func' is not known to be defined.


eval-when-compile is equivalent to progn in uncompiled code, and the
compiler doesn't compile things brought in by require.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#14551: compiler fails to track eval-when-compile in required files
  2013-06-03 20:30 bug#14551: compiler fails to track eval-when-compile in required files Glenn Morris
@ 2013-06-03 20:59 ` Stefan Monnier
  2024-01-10 11:17   ` Stefan Kangas
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2013-06-03 20:59 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 14551

> foo.el:
> (require 'lib)
> (defun foo ()
>   (lib2-func))
[...]
> lib.el:
> (eval-when-compile
>   (require 'lib2))
> (provide 'lib)
[...]
> rm lib*.elc
> emacs -Q -L . -batch -f batch-byte-compile foo.el
> produces no warnings.

Yes, that's a long standing bug.  Fixing it right is likely to be pretty
tricky/difficult because it means we need to disregard some of the
packages already loaded somehow.  In the general case, you have the same
problem even without eval-when-compile, e.g. if you have in lib.el
a call to an autoloaded macro, in which case the autoloaded package will
be loaded if lib.el is not yet compiled but not if it is.

The "noruntime" warnings are implemented with a pile of hacks, and I'd
rather not add to them.  So, given that a proper fix looks pretty
difficult, I wouldn't hold my breath.


        Stefan





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#14551: compiler fails to track eval-when-compile in required files
  2013-06-03 20:59 ` Stefan Monnier
@ 2024-01-10 11:17   ` Stefan Kangas
  2024-01-12 15:57     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Kangas @ 2024-01-10 11:17 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Glenn Morris, 14551

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> foo.el:
>> (require 'lib)
>> (defun foo ()
>>   (lib2-func))
> [...]
>> lib.el:
>> (eval-when-compile
>>   (require 'lib2))
>> (provide 'lib)
> [...]
>> rm lib*.elc
>> emacs -Q -L . -batch -f batch-byte-compile foo.el
>> produces no warnings.
>
> Yes, that's a long standing bug.  Fixing it right is likely to be pretty
> tricky/difficult because it means we need to disregard some of the
> packages already loaded somehow.  In the general case, you have the same
> problem even without eval-when-compile, e.g. if you have in lib.el
> a call to an autoloaded macro, in which case the autoloaded package will
> be loaded if lib.el is not yet compiled but not if it is.
>
> The "noruntime" warnings are implemented with a pile of hacks, and I'd
> rather not add to them.  So, given that a proper fix looks pretty
> difficult, I wouldn't hold my breath.

Is still an issue 10 years later?





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#14551: compiler fails to track eval-when-compile in required files
  2024-01-10 11:17   ` Stefan Kangas
@ 2024-01-12 15:57     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-01-12 15:57 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Glenn Morris, 14551

> Is still an issue 10 years later?

I don't think anything has changed in this respect.


        Stefan






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-12 15:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-03 20:30 bug#14551: compiler fails to track eval-when-compile in required files Glenn Morris
2013-06-03 20:59 ` Stefan Monnier
2024-01-10 11:17   ` Stefan Kangas
2024-01-12 15:57     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.