[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sbcl-commits
Subject:    [Sbcl-commits] master: Be slightly more cautious in defconstant-eqx
From:       Douglas Katzman via Sbcl-commits <sbcl-commits () lists ! sourceforge ! net>
Date:       2021-01-14 3:08:37
Message-ID: 1610593718.44584.29068 () sfp-scm-7 ! v30 ! lw ! sourceforge ! com
[Download RAW message or body]

The branch "master" has been updated in SBCL:
       via  4f5a507772f2a3490a585e0cc44375c9ed5aae36 (commit)
      from  47a2bf2b2bfe497dbd502366f177e02859be65c1 (commit)

- Log -----------------------------------------------------------------
commit 4f5a507772f2a3490a585e0cc44375c9ed5aae36
Author: Douglas Katzman <dougk@google.com>
Date:   Wed Jan 13 22:07:37 2021 -0500

    Be slightly more cautious in defconstant-eqx
    
    (And the previous one one had an error in it. Oops)
---
 src/code/primordial-extensions.lisp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/code/primordial-extensions.lisp b/src/code/primordial-extensions.lisp
index 3ef76d272..646386d1d 100644
--- a/src/code/primordial-extensions.lisp
+++ b/src/code/primordial-extensions.lisp
@@ -331,10 +331,18 @@
 (eval-when (:compile-toplevel)
   (sb-xc:defmacro defconstant-eqx (symbol expr eqx &optional doc)
     (unless (constantp expr)
-      (format t "~&Assuming constant value for ~s~%" symbol))
+      ;; Using an allowlist ensure that nothing too crazy occurs.
+      (unless (memq symbol '(sb-vm::+common-static-symbols+
+                             sb-c::+no-costs+
+                             sb-c::+no-loads+
+                             sb-format::!illegal-inside-justification
+                             sb-impl::!+pcl-reader-name+
+                             sb-impl::!+pcl-writer-name+
+                             sb-impl::!+pcl-boundp-name+))
+        (error "Assuming constant value for ~s" symbol)))
     `(progn
        (eval-when (:compile-toplevel)
          (defconstant ,symbol (%defconstant-eqx-value ',symbol ,expr ,eqx)))
        (eval-when (:load-toplevel)
-         (sb-c::%defconstant ',symbol `',(eval expr)
+         (sb-c::%defconstant ',symbol ',(eval expr)
            (sb-c:source-location) ,@(when doc (list doc)))))))

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


hooks/post-receive
-- 
SBCL


_______________________________________________
Sbcl-commits mailing list
Sbcl-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic