From: Eshel Yaron Date: Thu, 24 Oct 2024 12:06:51 +0000 (+0200) Subject: Fix bootstrap further X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=267321cb3148b0ee4403d21835799c90952c172e;p=emacs.git Fix bootstrap further --- diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 0e02ed8c736..5bc444f5aba 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -752,28 +752,6 @@ If this function returns nil, then FORM never returns." ;; This implies that you cannot simply destructively modify the list; ;; you must return something not EQ to it if you make an optimization. -(defsubst byte-opt--bool-value-form (form) - "The form in FORM that yields its boolean value, possibly FORM itself." - (while (let ((head (car-safe form))) - (cond ((memq head '( progn inline save-excursion save-restriction - save-current-buffer)) - (setq form (car (last (cdr form)))) - t) - ((memq head '(let let*)) - (setq form (car (last (cddr form)))) - t) - ((memq head '( prog1 unwind-protect copy-sequence identity - reverse nreverse sort)) - (setq form (nth 1 form)) - t) - ((memq head '(mapc setq setcar setcdr puthash set)) - (setq form (nth 2 form)) - t) - ((memq head '(aset put function-put)) - (setq form (nth 3 form)) - t)))) - form) - ;; If the function is being called with constant integer args, ;; evaluate as much as possible at compile-time. This optimizer ;; assumes that the function is associative, like min or max. diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index fbfcde58769..99cd816b51a 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -838,6 +838,28 @@ test of free variables in the following ways: (error "Eager macro-expansion failure: %S" err) form))))) +(defsubst byte-opt--bool-value-form (form) + "The form in FORM that yields its boolean value, possibly FORM itself." + (while (let ((head (car-safe form))) + (cond ((memq head '( progn inline save-excursion save-restriction + save-current-buffer)) + (setq form (car (last (cdr form)))) + t) + ((memq head '(let let*)) + (setq form (car (last (cddr form)))) + t) + ((memq head '( prog1 unwind-protect copy-sequence identity + reverse nreverse sort)) + (setq form (nth 1 form)) + t) + ((memq head '(mapc setq setcar setcdr puthash set)) + (setq form (nth 2 form)) + t) + ((memq head '(aset put function-put)) + (setq form (nth 3 form)) + t)))) + form) + (defun byte-compile-trueconstp (form) "Return non-nil if FORM always evaluates to a non-nil value." (setq form (byte-opt--bool-value-form form))