emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/sly 4513c382f0: Fix #501: Print and then muffle all compil


From: ELPA Syncer
Subject: [nongnu] elpa/sly 4513c382f0: Fix #501: Print and then muffle all compile warnings on SBCL
Date: Wed, 2 Mar 2022 06:58:36 -0500 (EST)

branch: elpa/sly
commit 4513c382f07a2a2cedb3c046231b69eae2f5e6f0
Author: Eric Timmons <etimmons@mit.edu>
Commit: João Távora <joaotavora@gmail.com>

    Fix #501: Print and then muffle all compile warnings on SBCL
    
    SBCL emits full WARNINGs during compilation if there is a DEFPACKAGE
    form at variance with the current state of the package.  Slynk uses
    direct CL:EXPORT a lot, resulting in the :SLYNK and :SLYNK-BACKEND
    packages being in variance if the system definition reloaded.
    
    Traditionally, we worked around this with ASDF's 'OPERATE :AROUND ((O
    LOAD-OP)' trick, but that broke when Slynk began being used as a
    dependency from other places other than SLY itself.  That issue is
    
    Additionally, SBCL emits a (full) deprecation WARNING for FD->HANDLE
    at compile time. But only on Windows.  This is #501.
    
    In this commit we're broadening the reach of an existing hook added
    for for #492.
    
    Why does this problem happen? Well, the specification for COMPILE-FILE
    states that it must return a true FAILURE-P value if there are any
    ERRORs *or* full WARNINGS.  ASDF sees this, and by default signals an
    ERROR instead of loading the fasl.  ASDF exports
    *COMPILE-FILE-FAILURE-BEHAVIOR* to control this behavior.  However,
    this variable is really meant for system consumers to set. If a system
    knows that it produces WARNINGs and that they're acceptable, it's
    preferred to provide an :AROUND-COMPILE hook that handles the warnings
    so that COMPILE-FILE never returns failure.
    
    The hook we've added for #492 (and are expanding for #501) handles all
    full WARNINGs produced during compilation by printing them and then
    muffling them. It's a bit of a big hammer since it muffles every full
    WARNING, but SBCL does not export specific warnings that we can
    muffle. We may be able to do better by using UIOP:DEFINE-PACKAGE to
    avoid package variance warnings altogether or UIOP:MATCH-CONDITION-P
    to muffle only the warnings we want based on their format string. That
    would ensure no new warnings slip in in the future, but would require
    bumping the minimum ASDF version needed to run Slynk.
    
    All-code-by: Eric Timmons <etimmons@mit.edu>
    Co-authored-by: João Távora <joaotavora@gmail.com>
---
 slynk/slynk.asd | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/slynk/slynk.asd b/slynk/slynk.asd
index 97e7a2f0de..eada619aee 100644
--- a/slynk/slynk.asd
+++ b/slynk/slynk.asd
@@ -19,17 +19,21 @@
 
 (defsystem :slynk
   :serial t
+  ;; See commit message and GitHub#502, GitHub#501 for the reason
+  ;; for this dedicated sbcl muffling.
+  #+sbcl
+  :around-compile
+  #+sbcl
+  (lambda (thunk)
+    (handler-bind (((and warning (not style-warning))
+                     (lambda (c)
+                       (format *error-output* "~&~@<~S: ~3i~:_~A~:>~%"
+                               (class-name (class-of c)) c)
+                       (muffle-warning c))))
+      (let ((sb-ext:*on-package-variance* '(:warn t)))
+        (funcall thunk))))
   :components
-  ((:file "slynk-backend"
-    ;; If/when we require ASDF3, we can use UIOP:DEFINE-PACKAGE instead or use
-    ;; UIOP:MATCH-CONDITION-P to muffle only the package variance
-    ;; warning. Alternatively, SBCL could export the package variance warning
-    ;; from SB-EXT and we can muffle it directly.
-    #+sbcl :around-compile
-    #+sbcl #1=(lambda (thunk)
-                (handler-bind (((and warning (not style-warning)) 
#'muffle-warning))
-                  (let ((sb-ext:*on-package-variance* '(:warn t)))
-                    (funcall thunk)))))
+  ((:file "slynk-backend")
    ;; If/when we require ASDF3, we shall use :if-feature instead
    #+(or cmu sbcl scl)
    (:file "slynk-source-path-parser")
@@ -69,9 +73,7 @@
    (:file "slynk-gray")
    (:file "slynk-match")
    (:file "slynk-rpc")
-   (:file "slynk"
-    #+sbcl :around-compile
-    #+sbcl #1#)
+   (:file "slynk")
    (:file "slynk-completion")
    (:file "slynk-apropos")))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]