master: Limit the scope of warning suppressions

snuglas via Sbcl-commits <[email protected]> Sat, 18 Jul 2026 00:05:38 +0000
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  d3fa62156fd91ca3f69b3e906b98d6e5d006e22b (commit)
      from  9c82bf8bdcb4a4d266645face80f83018f69b769 (commit)

- Log -----------------------------------------------------------------
commit d3fa62156fd91ca3f69b3e906b98d6e5d006e22b
Author: Douglas Katzman <[email protected]>
Date:   Fri Jul 17 22:27:58 2026 +0000

    Limit the scope of warning suppressions
    
    * Rev 906a406a quieted all compiler notes coming from make-host-1,
      rendering moot the muffle-conditions code-deletion-note in shared.lisp,
      not to mention (satisfies unable-to-optimize-note-p) there as well.
    * Prevent introduction of new occurrences of the optional+key warning
      by confining the suppression to precisely where there is old code.
    
    We need to fix whatever is wrong with cross-typep so that make-host-2
    correctly utilizes the &OPTIONAL-AND-&KEY-IN-LAMBDA-LIST condition.
---
 crossbuild-runner/pass-2.lisp | 6 +++++-
 make-host-1.lisp              | 5 +----
 src/code/defstruct.lisp       | 4 ++++
 src/cold/shared.lisp          | 9 +--------
 src/compiler/macros.lisp      | 8 ++++++++
 5 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/crossbuild-runner/pass-2.lisp b/crossbuild-runner/pass-2.lisp
index c31a25979..ae4bc6a5b 100644
--- a/crossbuild-runner/pass-2.lisp
+++ b/crossbuild-runner/pass-2.lisp
@@ -1,7 +1,11 @@
 (defvar *config-name* (second sb-ext:*posix-argv*))
 (defvar *sbcl-local-target-features-file*
   (format nil "obj/xbuild/~A/local-target-features" *config-name*))
-(load "src/cold/shared.lisp")
+(let ((sb-c::*handled-conditions* sb-c::*handled-conditions*))
+  ;; As many useless notes emanate from loading shared as we have configs,
+  ;; at (compile nil (read-from-file customizer-file-name))
+  (declaim (muffle-conditions compiler-note))
+  (load "src/cold/shared.lisp"))
 (in-package "SB-COLD")
 (let* ((build-dir (format nil "obj/xbuild/~A/" cl-user::*config-name*))
        (objroot (format nil "~A/from-xc/" build-dir)))
diff --git a/make-host-1.lisp b/make-host-1.lisp
index b9c9a52f6..14aabbae5 100644
--- a/make-host-1.lisp
+++ b/make-host-1.lisp
@@ -9,10 +9,7 @@
         (when val
           (format t "~&target ~S = ~S~%" sym  val))))))
 (in-package "SB-COLD")
-#+sbcl
-(declaim (sb-ext:muffle-conditions
-          sb-ext:compiler-note
-          (satisfies optional+key-style-warning-p)))
+#+sbcl (declaim (sb-ext:muffle-conditions sb-ext:compiler-note))
 (progn
   (setf *host-obj-prefix* (if (boundp 'cl-user::*sbcl-host-obj-prefix*)
                               (symbol-value 'cl-user::*sbcl-host-obj-prefix*)
diff --git a/src/code/defstruct.lisp b/src/code/defstruct.lisp
index 01a50f2e6..864b490ea 100644
--- a/src/code/defstruct.lisp
+++ b/src/code/defstruct.lisp
@@ -922,6 +922,10 @@ unless :NAMED is also specified.")))
 (defun parse-1-dsd (proto-classoid defstruct spec &optional included-slot
                     &aux accessor-name (always-boundp t) (safe-p t)
                          ctype rsd-index index)
+  ;; suppress the "optional & key" warning in the DESTRUCTURING-BIND below
+  #+(and sb-xc-host host-quirks-sbcl) (declare (host-sb-ext:muffle-conditions style-warning))
+  ;; Just like in src/code/macros we'd prefer a more fine-grained suppression
+  ;; using SB-KERNEL:&OPTIONAL-AND-&KEY-IN-LAMBDA-LIST but it doesn't work.
   #-sb-xc-host (declare (muffle-conditions style-warning))
   (multiple-value-bind (name default default-p type type-p read-only ro-p)
       (typecase spec
diff --git a/src/cold/shared.lisp b/src/cold/shared.lisp
index 9b6e7b3aa..9de780b49 100644
--- a/src/cold/shared.lisp
+++ b/src/cold/shared.lisp
@@ -232,14 +232,7 @@
         ext:*gc-verbose* nil))
 
 #+sbcl
-(progn
-  (setq cl:*compile-print* nil)
-  (load (find-bootstrap-file "^muffler"))
-  ;; Let's just say we never care to see these.
-  (declaim (sb-ext:muffle-conditions
-            (satisfies unable-to-optimize-note-p)
-            (satisfies optional+key-style-warning-p)
-            sb-ext:code-deletion-note)))
+(setq cl:*compile-print* nil)
 
 ;;;; special read-macros for building the cold system (and even for
 ;;;; building some of our tools for building the cold system)
diff --git a/src/compiler/macros.lisp b/src/compiler/macros.lisp
index dd2e31397..34f7bf937 100644
--- a/src/compiler/macros.lisp
+++ b/src/compiler/macros.lisp
@@ -300,6 +300,13 @@
 ;;;             if the function returns T.
 ;;;   :BEFORE-VOP
 ;;;           - an ordinary transform placed before VOP transforms.
+(locally
+;; suppress the "optional & key" warning in our lambda lists
+#+(and sb-xc-host host-quirks-sbcl) (declare (host-sb-ext:muffle-conditions style-warning))
+;; This ought to be (MUFFLE-CONDITIONS SB-KERNEL:&OPTIONAL-AND-&KEY-IN-LAMBDA-LIST)
+;; for more finesse, however, the host lisp sees this condition class name, and honestly
+;; I can't explain that. We have to just say STYLE-WARNING. So it goes.
+#-sb-xc-host (declare (muffle-conditions style-warning))
 (defmacro deftransform (name (lambda-list &optional (arg-types '*)
                                                     (result-type '*)
                               &key result policy node defun-only
@@ -384,6 +391,7 @@
                      `(%deftransform ',name ,(if policy '#'policy-test) ',type
                                      #',transform-name ,important))
                    names)))))
+) ; end LOCALLY
 
 
 (defun make-optimizer-name (name)

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL