emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs-29 9c18af0cfaf: * Warn when certain primitives are redefined (


From: Po Lu
Subject: Re: emacs-29 9c18af0cfaf: * Warn when certain primitives are redefined (bug#61880)
Date: Sun, 05 Mar 2023 18:43:15 +0800
User-agent: Gnus/5.13 (Gnus v5.13)

Andrea Corallo <akrl@sdf.org> writes:

> branch: emacs-29
> commit 9c18af0cfaf2d949d782f6c44c6604b54dbb87a0
> Author: Andrea Corallo <akrl@sdf.org>
> Commit: Andrea Corallo <akrl@sdf.org>
>
>     * Warn when certain primitives are redefined (bug#61880)
>     
>             * lisp/emacs-lisp/comp.el (comp-warn-primitives): New constant.
>             (comp-subr-trampoline-install): Warn when a sensitive primitive is
>             being redefined.
> ---
>  lisp/emacs-lisp/comp.el | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
> index 046d169f00f..48756caf100 100644
> --- a/lisp/emacs-lisp/comp.el
> +++ b/lisp/emacs-lisp/comp.el
> @@ -698,11 +698,22 @@ Useful to hook into pass checkers.")
>  (defvar comp-no-spawn nil
>    "Non-nil don't spawn native compilation processes.")
>  
> +(defconst comp-warn-primitives
> +  '(null memq gethash and subrp not subr-native-elisp-p
> +         comp--install-trampoline concat if symbolp symbol-name make-string
> +         length aset aref length> mapcar expand-file-name
> +         file-name-as-directory file-exists-p native-elisp-load)
> +  "List of primitives we want to warn about in case of redefinition.
> +This are essential for the trampoline machinery to work properly.")
> +
>  ;; Moved early to avoid circularity when comp.el is loaded and
>  ;; `macroexpand' needs to be advised (bug#47049).
>  ;;;###autoload
>  (defun comp-subr-trampoline-install (subr-name)
>    "Make SUBR-NAME effectively advice-able when called from native code."
> +  (when (memq subr-name comp-warn-primitives)
> +    (warn "Redefining `%s' might breaks trampoline native compilation."
                                    ^^^^^^

Was this supposed to say ``break''?

> +          subr-name))
>    (unless (or (null native-comp-enable-subr-trampolines)
>                (memq subr-name native-comp-never-optimize-functions)
>                (gethash subr-name comp-installed-trampolines-h))

Thanks.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]