aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEshel Yaron2025-09-29 16:40:56 +0200
committerEshel Yaron2025-09-29 16:42:35 +0200
commit761e706505872cbaa135da131ab812a92385a896 (patch)
tree3d7d12732a48613b88a1f3210d846e3ec6f365e5
parent136c39438f73066167c6597c67d62a5ea3565230 (diff)
downloademacs-761e706505872cbaa135da131ab812a92385a896.tar.gz
emacs-761e706505872cbaa135da131ab812a92385a896.zip
; scope.el: Mark 'static-when/unless' as unsafe.
* lisp/emacs-lisp/scope.el: Add handlers for 'static-when' and 'static-unless'. (scope-unsafe-macros): Also add them to list of unsafe macros.
-rw-r--r--lisp/emacs-lisp/scope.el9
1 files changed, 8 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/scope.el b/lisp/emacs-lisp/scope.el
index f33b5ff403c..2791e362eb9 100644
--- a/lisp/emacs-lisp/scope.el
+++ b/lisp/emacs-lisp/scope.el
@@ -1608,7 +1608,8 @@ trusted code macro expansion is always safe."
1608 :group 'lisp) 1608 :group 'lisp)
1609 1609
1610(defvar scope-unsafe-macros 1610(defvar scope-unsafe-macros
1611 '( static-if cl-eval-when eval-when-compile eval-and-compile let-when-compile 1611 '( static-if static-when static-unless
1612 cl-eval-when eval-when-compile eval-and-compile let-when-compile
1612 rx cl-macrolet nnoo-define-basics)) 1613 rx cl-macrolet nnoo-define-basics))
1613 1614
1614(defun scope-safe-macro-p (macro) 1615(defun scope-safe-macro-p (macro)
@@ -2356,6 +2357,12 @@ trusted code macro expansion is always safe."
2356 (scope-1 then scope--output-type) 2357 (scope-1 then scope--output-type)
2357 (scope-n else scope--output-type)) 2358 (scope-n else scope--output-type))
2358 2359
2360(scope-define-macro-analyzer static-when (&optional test &rest body)
2361 (scope-1 test)
2362 (scope-n body scope--output-type))
2363
2364(put 'static-unless 'scope-analyzer #'scope--analyze-static-when)
2365
2359(scope-define-macro-analyzer eval-when-compile (&rest body) 2366(scope-define-macro-analyzer eval-when-compile (&rest body)
2360 (scope-n body scope--output-type)) 2367 (scope-n body scope--output-type))
2361 2368