support for (un)reifying deferred warnings

Bug #1106268 reported by Faré
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
New
Undecided
Unassigned

Bug Description

ASDF 2.26.x introduces support for saving deferred warnings and re-playing them in a different session.

It currently does it by peeking and poking at the internals of SBCL (and CCL). Could you export a supported variant of that functionality in SBCL?

See the code in asdf/lisp-build.lisp. The entry points are reify-deferred-warnings unreify-deferred-warnings reset-deferred-warnings

 http://common-lisp.net/gitweb?p=projects/asdf/asdf.git

Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

If I understand correctly you want to serialize and deserialize some conditions.

Which ones?

Could you just use MAKE-LOAD-FORM-SAVING-SLOTS?

Or using existing supported APIs, such as MOP?
(defun thing-to-list (thing)
  (let ((class (class-of thing)))
    (cons (class-name class)
          (mapcar (lambda (slotd)
                    (let ((name (sb-mop:slot-definition-name slotd)))
                      (list name (slot-value thing name))))
                  (sb-mop:class-slots class)))))

(defun thing-from-list (class-and-slots)
  (let ((thing (allocate-instance (find-class (car class-and-slots)))))
    (dolist (slot-and-value (cdr class-and-slots))
      (setf (slot-value thing (first slot-and-value))
            (second slot-and-value)))
    thing))

?

Revision history for this message
Faré (fahree) wrote :

Here are the docstrings I just added.

(defun reify-deferred-warnings ()
  "return a portable S-expression, portably readable and writeable in any Common Lisp implementation
using READ within a WITH-SAFE-IO-SYNTAX, that represents the warnings currently deferred by
WITH-COMPILATION-UNIT. One of three functions required for deferred-warnings support in ASDF."
 ...)

(defun unreify-deferred-warnings (reified-deferred-warnings)
  "given a S-expression created by REIFY-DEFERRED-WARNINGS, reinstantiate the corresponding
deferred warnings as to be handled at the end of the current WITH-COMPILATION-UNIT.
Handle any warning that has been resolved already,
such as an undefined function that has been defined since.
One of three functions required for deferred-warnings support in ASDF."
 ...)

(defun reset-deferred-warnings ()
  "Reset the set of deferred warnings to be handled at the end of the current WITH-COMPILATION-UNIT.
One of three functions required for deferred-warnings support in ASDF."
 ...)

Revision history for this message
Faré (fahree) wrote :

It's OK to me if you use MAKE-LOAD-FORM and to reify the conditions into a string, and hand me the string, though that will probably be inefficient.

However, there's not just the reifying the condition, there's also the finding the conditions to reify from the current compilation unit, the resetting the set of conditions deferred in the current compilation unit, the reinstantiating previously reified conditions into the current compilation unit.

Revision history for this message
Faré (fahree) wrote :

Maybe I should allow for (*read-eval* t) and non-readability across other Lisps. Will ponder it.

Revision history for this message
Faré (fahree) wrote :

In summary, yes, a MAKE-LOAD-FORM or anything that would make write :readably t work would be great. If I need more than that, I can implement it myself on top of it.

Revision history for this message
Douglas Katzman (dougk) wrote :

I think the way this should work is that LOADing a fasl should re-issue any warnings that were issued during compilation and unresolved within that same compilation unit.
Thereby, a system-construction tool that simply loads the fasls will be able observe the warnings given a suitable condition handler around the loading.
This is simple enough to implement, and more-or-less the equivalent of a C compiler emitting into its debug section of the '.o' all symbols referenced, whether they be known or unknown.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.