1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-07 15:00:34 -08:00

Define compiler macros for /=, atom and nlistp

Calls to these functions were previously rewritten in terms of other
functions both in the optimiser and during codegen, for no good reason.

This also resulted in poor diagnostics: wrong-arity calls to 'atom' and
'nlistp' produced doubled but slightly-different warnings, and no
warnings at all for '/='.

Using compiler macros fixes the problems.  The generated code is the same.

* lisp/emacs-lisp/bytecomp.el (byte-compile-negated)
(byte-compile-negation-optimizer): Replace with...
(bytecomp--define-negated): ...this compiler macro defining macro.
This commit is contained in:
Mattias Engdegård 2025-10-29 13:02:32 +01:00
parent 85e1a64943
commit 305744fdfc
2 changed files with 12 additions and 28 deletions

View file

@ -1424,12 +1424,6 @@ See Info node `(elisp) Integer Basics'."
(put 'not 'byte-optimizer #'byte-optimize-not)
(put 'null 'byte-optimizer #'byte-optimize-not)
;; byte-compile-negation-optimizer lives in bytecomp.el
(put '/= 'byte-optimizer #'byte-compile-negation-optimizer)
(put 'atom 'byte-optimizer #'byte-compile-negation-optimizer)
(put 'nlistp 'byte-optimizer #'byte-compile-negation-optimizer)
(defun byte-optimize-funcall (form)
;; (funcall #'(lambda ...) ...) -> (let ...)
;; (funcall #'SYM ...) -> (SYM ...)