Hi All,
So I think I have a situation with compiling and loading a file where it needs
(with-compilation-unit () (load (compile-file ... )))
in order not to have spurious warnings about undefined functions.
If anyone is interested in details I can give as many as you would like, but first I'd just like to ask if, assuming this is a legitimate problem, it makes sense to take care of such a thing by extending
swank:compile-file-with-compile-file ?
From studying the sources, it is not entirely clear to me where the actual
(load ... )
is taking place, so I am not sure where one would wrap the
(with-compilation-unit () ...)
even if it turns out that this will be a reasonable thing to do...
Has anyone seen something like this or has any ideas?
And Happy New Year (the year is still only 10 days old, so still can say that, I guess... :)
On Fri, Jan 11 2013, Dave Cooper wrote:
Hi All,
So I think I have a situation with compiling and loading a file where it needs
(with-compilation-unit () (load (compile-file ... )))
in order not to have spurious warnings about undefined functions.
The warning would still be there, regardless of the WITH-COMPILATION-UNIT, right?
If anyone is interested in details I can give as many as you would like, but first I'd just like to ask if, assuming this is a legitimate problem, it makes sense to take care of such a thing by extending
swank:compile-file-with-compile-file ?
Handling warnings and errors that occur during LOAD is quite tricky or at least there is a wide variety of opinions what should be done. We probably want some test cases before we change it, just to make sure that we don't do the opposite of what we did last time (and we changed this many times by now).
From studying the sources, it is not entirely clear to me where the actual
(load ... )
is taking place, so I am not sure where one would wrap the
(with-compilation-unit () ...)
even if it turns out that this will be a reasonable thing to do...
It works like this: 1. Emacs ask Lisp to compile a file 2 Lisp sends the warnings back to Emacs 3. Based on the warnings, Emacs can ask the user if the file should be loaded at all. If there are no warnings, Emacs doesn't ask. 4. Emacs tells Lisp to load the fasl file
So compile-file and load are currently not executed as a unit.
Has anyone seen something like this or has any ideas?
A related issue with SBCL: if a function is redefined and the previous version came from a different file, then it prints something like "style-warning: redefining foo in DEFUN". This happens during load time, so SLIME does not report it as a compiler warning; it's simply printed to *standard-output*.
Helmut
On Fri, 11 Jan 2013 09:33:10 +0100, Helmut Eller said:
On Fri, Jan 11 2013, Dave Cooper wrote:
Hi All,
So I think I have a situation with compiling and loading a file where it needs
(with-compilation-unit () (load (compile-file ... )))
in order not to have spurious warnings about undefined functions.
The warning would still be there, regardless of the WITH-COMPILATION-UNIT, right?
Not if the function is defined as a result of loading the file (in some way that the compiler didn't notice). WITH-COMPILATION-UNIT will not warn about it because the function is defined at the end.
__Martin