]> git.eshelyaron.com Git - emacs.git/commitdiff
* Fix circular dependecy when loading a modified comp.el (bug#47049)
authorAndrea Corallo <akrl@sdf.org>
Fri, 12 Mar 2021 21:19:51 +0000 (22:19 +0100)
committerAndrea Corallo <akrl@sdf.org>
Fri, 12 Mar 2021 21:35:23 +0000 (22:35 +0100)
* lisp/emacs-lisp/comp.el (comp-subr-trampoline-install): Move it
before other functional code.

lisp/emacs-lisp/comp.el

index a62efc7e025c346f194d649474e02a5a51ec55b3..866ee8dcf732046f33e044eb09abb85f7a9530c7 100644 (file)
@@ -648,6 +648,23 @@ Useful to hook into pass checkers.")
   'native-compiler-error)
 \f
 
+;; 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."
+  (unless (or (null comp-enable-subr-trampolines)
+              (memq subr-name comp-never-optimize-functions)
+              (gethash subr-name comp-installed-trampolines-h))
+    (cl-assert (subr-primitive-p (symbol-function subr-name)))
+    (comp--install-trampoline
+     subr-name
+     (or (comp-trampoline-search subr-name)
+         (comp-trampoline-compile subr-name)
+         ;; Should never happen.
+         (cl-assert nil)))))
+
+\f
 (cl-defstruct (comp-vec (:copier nil))
   "A re-sizable vector like object."
   (data (make-hash-table :test #'eql) :type hash-table
@@ -3743,20 +3760,6 @@ Return the trampoline if found or nil otherwise."
       finally (error "Cannot find suitable directory for output in \
 `comp-eln-load-path'")))))
 
-;;;###autoload
-(defun comp-subr-trampoline-install (subr-name)
-  "Make SUBR-NAME effectively advice-able when called from native code."
-  (unless (or (null comp-enable-subr-trampolines)
-              (memq subr-name comp-never-optimize-functions)
-              (gethash subr-name comp-installed-trampolines-h))
-    (cl-assert (subr-primitive-p (symbol-function subr-name)))
-    (comp--install-trampoline
-     subr-name
-     (or (comp-trampoline-search subr-name)
-         (comp-trampoline-compile subr-name)
-         ;; Should never happen.
-         (cl-assert nil)))))
-
 \f
 ;; Some entry point support code.