summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/byte-opt.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2021-06-10 21:27:16 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2021-09-06 16:47:13 +0200
commitbba48d6ee5d90f326c70cbe8af19dfe6b00651ba (patch)
tree4f63312d69c51ddcaecb34799a784c85d97de1ef /lisp/emacs-lisp/byte-opt.el
parentfab1e220dbe38ab7a2f46b673dfc03964e496798 (diff)
downloademacs-bba48d6ee5d90f326c70cbe8af19dfe6b00651ba.tar.gz
emacs-bba48d6ee5d90f326c70cbe8af19dfe6b00651ba.tar.bz2
emacs-bba48d6ee5d90f326c70cbe8af19dfe6b00651ba.zip
More robust optimisation of `ignore`
Treat `ignore` as any other function during source-level optimisation, to avoid having its warning-suppression effects cancelled by repeated passes. Instead, define a custom code generation function. * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Don't treat `ignore' specially here. (side-effect-free-fns): Don't mark `ignore` as side-effect-free or error-free (although it is), since that would allow the optimiser to elide calls. * lisp/emacs-lisp/bytecomp.el (ignore, byte-compile-ignore): Define and register a code-gen function.
Diffstat (limited to 'lisp/emacs-lisp/byte-opt.el')
-rw-r--r--lisp/emacs-lisp/byte-opt.el11
1 files changed, 3 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 0c30d83f065..23c5a566cea 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -562,13 +562,6 @@ Same format as `byte-optimize--lexvars', with shared structure and contents.")
`(catch ,(byte-optimize-form tag nil)
. ,(byte-optimize-body exps for-effect))))
- (`(ignore . ,exps)
- ;; Don't treat the args to `ignore' as being
- ;; computed for effect. We want to avoid the warnings
- ;; that might occur if they were treated that way.
- ;; However, don't actually bother calling `ignore'.
- `(progn ,@(mapcar #'byte-optimize-form exps) nil))
-
;; Needed as long as we run byte-optimize-form after cconv.
(`(internal-make-closure . ,_)
;; Look up free vars and mark them to be kept, so that they
@@ -1419,7 +1412,9 @@ See Info node `(elisp) Integer Basics'."
fixnump floatp following-char framep
get-largest-window get-lru-window
hash-table-p
- identity ignore integerp integer-or-marker-p interactive-p
+ ;; `ignore' isn't here because we don't want calls to it elided;
+ ;; see `byte-compile-ignore'.
+ identity integerp integer-or-marker-p interactive-p
invocation-directory invocation-name
keymapp keywordp
list listp