[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiler Warnings, again



>You've acknowleged that turning off compiler warnings is a bad idea. As far
>as I can see, the "Undefined functions" warnings are the only ones at issue
>here so what you need is a counterpart to (declare (ignore-if-unused ...)):
> 
>     (declare (ftype (function (*) *) fn-name))
> 
>          and at top-level:
>     (declaim (ftype (function (&rest t) t) fn-name))
> 
>     I'm not sure of the exact MCL 2.0b1 syntax.

Though MCL final will support this way of forward referencing a function
definition, 2.0b1 does not. Even 2.0 final will only support this in
the file compiler. Evaluating it in the Listener does nothing.

>>  I'm sure if I try hard enough, I can get around this, but I'd rather
>>  not anticipate every possible warning and correct for it.  I really
>>  want to turn off all warnings.  If I promise to use it only in
>>  (without-compiler-warnings (compile (convert-to-lisp-function ....)))
>>  can I get a hint on how to write without-compiler-warnings.
> 
>Perhaps someone could "compile" a list of all the possible warnings, and
>the proper way to declare each one away for those cases where we're sure
>we know what we're doing. without-compiler-warnings is trivial to write,
>but requires an undocumented internal MCL feature. And we're agreed that
>it's a bad idea to turn off all warnings.

There is a completely proper way to do this most unproper thing. Use the
Common Lisp condition system:

(defmacro without-warnings (&body body)
  `(handler-bind ((warning
                   #'(lambda (condition)
                       (muffle-warning condition))))
     ,@body))

If you want to ignore only compiler warnings, you need to use an
internal condition type:

(defmacro without-compiler-warnings (&body body)
  `(handler-bind ((ccl::compiler-warning
                   #'(lambda (condition)
                       (muffle-warning condition))))
     ,@body))