Proper use of style-warning

Discussion of Common Lisp
Post Reply
vsedach
Posts: 8
Joined: Wed Dec 17, 2008 1:59 pm
Location: Montreal, QC, CA
Contact:

Proper use of style-warning

Post by vsedach » Tue Jan 25, 2011 9:59 pm

COMPILE-FILE returns 3 values. According to the CLHS "The tertiary value, failure-p, is false if no conditions of type error or warning (other than style-warning) were detected by the compiler, and true otherwise."

SLIME uses this to display a list of errors and prompt you to continue loading the compiled file or not.

I want to raise style-warnings (for things like uses of deprecated API macros), but don't want them to raise errors in SLIME. The thing is style-warning itself doesn't have slots to hold a format string. Doing something like creating a simple-style-warning class from simple-warning and style-warning doesn't work, but surprisingly neither does this:

Code: Select all

(define-condition ps-style-warning (style-warning)
  ((format-control :reader format-control :initarg :format-control :initform "Parenscript style warning; someone forgot to say what it is!")
   (format-arguments :reader format-arguments :initarg :format-arguments :initform nil))
  (:report (lambda (condition stream)
             (apply #'format stream (format-control condition) (format-arguments condition)))))
Doing a

Code: Select all

(warn 'ps-style-warning ...)
at compile-time still causes SLIME to claim that file compilation failed.

So how do I signal non-failure warnings at compile-time?

ramarren
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland
Contact:

Re: Proper use of style-warning

Post by ramarren » Tue Jan 25, 2011 11:57 pm

vsedach wrote:at compile-time still causes SLIME to claim that file compilation failed.
I doesn't for me on SBCL when I do slime-compile-file in a file which contains only the definition and eval-whenified warning form. The warning is signalled. How are you compiling the file? And on what system?

Post Reply