Commit 1cb16802 authored by Robert P. Goldman's avatar Robert P. Goldman
Browse files

Update reify-undefined-warning for SBCL 1.4.7+

REIFY-UNDEFINED-WARNING uses SB-C internals to "dehydrate"
SB-C::COMPILER-ERROR-CONTEXT structures, but those structures have
changed.
Merge (squashed) of topic branch fix-sbcl-deferred-warnings
Eric Timmons found the bug, and Fare and Attila Lendvai improved the
initial fix substantially.
parent 66d7f62c
Loading
Loading
Loading
Loading
+19 −3
Original line number Diff line number Diff line
@@ -342,12 +342,28 @@ Simple means made of symbols, numbers, characters, simple-strings, pathnames, co
     (sb-c::undefined-warning-kind warning)
     (sb-c::undefined-warning-name warning)
     (sb-c::undefined-warning-count warning)
     ;; the COMPILER-ERROR-CONTEXT struct has changed in SBCL, which means how we
     ;; handle deferred warnings must change... TODO: when enough time has
     ;; gone by, just assume all versions of SBCL are adequately
     ;; up-to-date, and cut this material.[2018/05/30:rpg]
     (mapcar
      #'(lambda (frob)
          ;; the lexenv slot can be ignored for reporting purposes
          `(:enclosing-source ,(sb-c::compiler-error-context-enclosing-source frob)
            :source ,(sb-c::compiler-error-context-source frob)
            :original-source ,(sb-c::compiler-error-context-original-source frob)
          `(
            #- #.(uiop/utility:symbol-test-to-feature-expression '#:compiler-error-context-%source '#:sb-c)
            ,@`(:enclosing-source
                ,(sb-c::compiler-error-context-enclosing-source frob)
                :source
                ,(sb-c::compiler-error-context-source frob)
                :original-source
                ,(sb-c::compiler-error-context-original-source frob))
            #+ #.(uiop/utility:symbol-test-to-feature-expression '#:compiler-error-context-%source '#:sb-c)
            ,@ `(:%enclosing-source
                 ,(sb-c::compiler-error-context-enclosing-source frob)
                 :%source
                 ,(sb-c::compiler-error-context-source frob)
                 :original-form
                 ,(sb-c::compiler-error-context-original-form frob))
            :context ,(sb-c::compiler-error-context-context frob)
            :file-name ,(sb-c::compiler-error-context-file-name frob) ; a pathname
            :file-position ,(sb-c::compiler-error-context-file-position frob) ; an integer
+15 −1
Original line number Diff line number Diff line
@@ -35,7 +35,9 @@
   #:simple-style-warning #:style-warn ;; simple style warnings
   #:match-condition-p #:match-any-condition-p ;; conditions
   #:call-with-muffled-conditions #:with-muffled-conditions
   #:not-implemented-error #:parameter-error))
   #:not-implemented-error #:parameter-error
   #:symbol-test-to-feature-expression
   #:boolean-to-feature-expression))
(in-package :uiop/utility)

;;;; Defining functions in a way compatible with hot-upgrade:
@@ -650,3 +652,15 @@ message, that takes the functionality as its first argument (that can be skipped
           :format-control format-control
           :format-arguments format-arguments)))

(with-upgradability ()
  (defun boolean-to-feature-expression (value)
    "Converts a boolean VALUE to a form suitable for testing with #+."
    (if value
        '(:and)
        '(:or)))

  (defun symbol-test-to-feature-expression (name package)
    "Check if a symbol with a given NAME exists in PACKAGE and returns a
form suitable for testing with #+."
    (boolean-to-feature-expression
     (find-symbol* name package nil))))