Re: Fix :REPORT undefined function style-warnings
Christophe Rhodes <csr21 <at> cantab.net>
2008-06-18 13:55:12 GMT
Zach Beane <xach <at> xach.com> writes:
> On Mon, Jun 16, 2008 at 11:30:32PM +0100, Christophe Rhodes wrote:
>> Do the symptoms that you've observed go away if instead you patch the
>> expansion of DEFINE-CONDITION to look like
>> (eval-when (:compile-toplevel :execute)
>> (%compiler-define-condition ...))
>> (eval-when (:load-toplevel :execute)
>> (%define-condition ...)))
> Yes, this works perfectly for both LOAD and at the REPL. Thanks for
> looking at it!
OK, but I don't think this is the whole story. With this as the
expansion, at the repl now %compiler-define-condition gets run twice,
which I think is wasteful.
My next stab at the solution was to expand into (the moral equivalent of)
(eval-when (:load-toplevel :execute)
(%define-condition ... (locally (declare (ftype (function (t) t) , <at> all-readers)) ...))))
in other words, to use a ftype declaration around the report function
to inform the compiler about those functions. However, I discovered
that this doesn't work; the compiler's process-ftype-decl will cause
an undefined reference if it can't find an already-existing function
at compile-time, from find-global-fun.