Replace the Kitten of Death message with a warning in the banner
[sbcl.git] / src / compiler / knownfun.lisp
index f9a0028..100f3ee 100644 (file)
                                 (:derive-type (or function null))
                                 (:optimizer (or function null))
                                 (:destroyed-constant-args (or function null))
-                                (:result-arg (or index null)))
+                                (:result-arg (or index null))
+                                (:overwrite-fndb-silently boolean))
                           *)
                 %defknown))
-(defun %defknown (names type attributes &key derive-type optimizer destroyed-constant-args result-arg)
+(defun %defknown (names type attributes
+                  &key derive-type optimizer destroyed-constant-args result-arg
+                    overwrite-fndb-silently)
   (let ((ctype (specifier-type type))
         (info (make-fun-info :attributes attributes
                              :derive-type derive-type
                              :optimizer optimizer
                              :destroyed-constant-args destroyed-constant-args
-                             :result-arg result-arg))
-        (target-env *info-environment*))
+                             :result-arg result-arg)))
     (dolist (name names)
-      (let ((old-fun-info (info :function :info name)))
-        (when old-fun-info
-          ;; This is handled as an error because it's generally a bad
-          ;; thing to blow away all the old optimization stuff. It's
-          ;; also a potential source of sneaky bugs:
-          ;;    DEFKNOWN FOO
-          ;;    DEFTRANSFORM FOO
-          ;;    DEFKNOWN FOO ; possibly hidden inside some macroexpansion
-          ;;    ; Now the DEFTRANSFORM doesn't exist in the target Lisp.
-          ;; However, it's continuable because it might be useful to do
-          ;; it when testing new optimization stuff interactively.
-          (cerror "Go ahead, overwrite it."
-                  "~@<overwriting old FUN-INFO ~2I~_~S ~I~_for ~S~:>"
-                  old-fun-info name)))
-      (setf (info :function :type name target-env) ctype)
-      (setf (info :function :where-from name target-env) :declared)
-      (setf (info :function :kind name target-env) :function)
-      (setf (info :function :info name target-env) info)))
+      (unless overwrite-fndb-silently
+        (let ((old-fun-info (info :function :info name)))
+          (when old-fun-info
+            ;; This is handled as an error because it's generally a bad
+            ;; thing to blow away all the old optimization stuff. It's
+            ;; also a potential source of sneaky bugs:
+            ;;    DEFKNOWN FOO
+            ;;    DEFTRANSFORM FOO
+            ;;    DEFKNOWN FOO ; possibly hidden inside some macroexpansion
+            ;;    ; Now the DEFTRANSFORM doesn't exist in the target Lisp.
+            ;; However, it's continuable because it might be useful to do
+            ;; it when testing new optimization stuff interactively.
+            (cerror "Go ahead, overwrite it."
+                    "~@<overwriting old FUN-INFO ~2I~_~S ~I~_for ~S~:>"
+                    old-fun-info name))))
+      (setf (info :function :type name) ctype)
+      (setf (info :function :where-from name) :declared)
+      (setf (info :function :kind name) :function)
+      (setf (info :function :info name) info)))
   names)
 
 ;;; Return the FUN-INFO for NAME or die trying. Since this is