[info-mcl] How does one capture compiler warnings?

Ralf Stoye stoye at stoye.com
Fri Jun 29 09:21:08 CDT 2007


Am 29.06.2007 um 12:22 schrieb Marco Antoniotti:

> what is a "un" in Common Lisp?

Last time i used mcl (some years ago) i just tested the library  
"color-coded.lisp", which colors and formats your code while you type  
it. Part of the default settings of this library is to mangle (up/ 
down-case) some symbols: defclass -> defClass, defun -> defUn.
Since the reader converts case during #'read anyway it doesn't matter  
(but i totally agree in that it is an ugly style).
Just to be shure the code *will* work in MCL fired up MCL (5.0) ...
My standard-environment is openmcl with emacs, but this wasn't an  
easy decision!
I would love to see MCL returning to its "state of the art" form it  
had long ago in OS 9 days.

To go ontopic again:

(let* ((*error-output* nil))
   (declare (special *error-output*))
   (defun test-a ()
     (test-b)))

will loose because you have to bind *error-output* to a stream.
(you don't have to declare *error-output* special, it is special  
anyway per defparameter)
but even if you do so, you will not get the warnings, since mcl  
compiles the form before it evaluates it.
So the following doesn't catch the warnings:

(let* ((*error-output* (make-string-output-stream)))
   (defun test-a ()
     (test-b))
   (format T "~%i got ~s during this" (get-output-stream-string  
*error-output*)))

We can catch the warnings by delaying the compilation of the defun form:

(let* ((*error-output* (make-string-output-stream)))
   (eval '(defun test-a ()
            (test-b)))
   (format t "i encountered the following: ~s"
           (get-output-stream-string *error-output*)))

Surprisingly the following doesn't work in MCL (but in openmcl):

(let* ((*error-output* (make-string-output-stream)))
   (load #p"wd:tests;scratch;loadme.lisp") ;; some forms producing  
compiler warnings inside
   (format T "~%i got ~s during this" (get-output-stream-string  
*error-output*)))

Digging around in mcl's compiler-warnings stuff i saw thing like  
ccl::*outstanding-deferred-warnings* and with-compilation-unit which  
should provide a way to obtain the desired behaviour, maybe Alice can  
bring it to the point...

Greetings
Ralf Stoye


STOYE - networked solutions
Ralf Stoye
mail:      stoye at stoye.com
phone:  +49 (0)228 4462627



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://clozure.com/pipermail/info-mcl/attachments/20070629/85b9739c/attachment.html>


More information about the info-mcl mailing list