all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Review request: Fixing of spurious byte compiler warnings "might not be defined at runtime".
@ 2015-11-21 20:30 Alan Mackenzie
  2015-11-22 12:54 ` Artur Malabarba
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Mackenzie @ 2015-11-21 20:30 UTC (permalink / raw)
  To: emacs-devel

Hello, Emacs.

I've just created a branch fix/not-defined-at-runtime and committed a
fix into it.  This is a fix for bug #21963, and more.

The bug was the spurious generation by the byte compiler of warnings
like "function `foo' might not be defined at run time".

There were several problems here:
(i) The main one was, when defining new functions in an
`eval-when-compile' all these functions were blacklisted as "not at
runtime", even when they were subsequently defined in runtime scope.

(ii) In an `eval-when-compile', the byte compiler first compiles, then
evals the body.  It fails to isolate the main compilation from this
subsidiary compilation, leading to ".. not be defined at run time".

(iii) In interactive byte-compile-files, the variable
byte-compile-noruntime-functions was not being initialised between
runs, so that "blacklisted" functions accumulated in it.


The solution to (i) is to maintain a list of functions defined in
runtime scope, and when emitting warnings, to check the dodgy function
is not on the list before emitting a warning about it.

The solution to (ii) is to bind certain status variables to themselves
around the subsidiary compilation.


Some intractible warnings now no longer occur while building CC Mode,
for example.  Also, `format-spec' in org.el is no longer complained of.
It Would Be Nice If people could try out or review this new code.

-- 
Alan Mackenzie (Nuremberg, Germany).



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

* Re: Review request: Fixing of spurious byte compiler warnings "might not be defined at runtime".
  2015-11-21 20:30 Review request: Fixing of spurious byte compiler warnings "might not be defined at runtime" Alan Mackenzie
@ 2015-11-22 12:54 ` Artur Malabarba
  0 siblings, 0 replies; 2+ messages in thread
From: Artur Malabarba @ 2015-11-22 12:54 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

Thanks Alan.
Do you think you could add a test for that as well?
It should be possible by overriding `display-warning' or something like that.

(let ((warnings nil))
  (letf (((symbol-function 'display-warning) (lambda (&rest x) (push x
warnings))))
    ;; byte-compile some file here.
    (should-not warnings)))



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

end of thread, other threads:[~2015-11-22 12:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-21 20:30 Review request: Fixing of spurious byte compiler warnings "might not be defined at runtime" Alan Mackenzie
2015-11-22 12:54 ` Artur Malabarba

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.