xdg-dir)
(t emacs-d-dir))))
-(defvar comp--delayed-sources)
(defvar comp--loadable)
+(defvar comp--delayed-sources)
+(defun startup--require-comp-safetly ()
+ "Require the native compiler avoiding circular dependencies."
+ (unless (featurep 'comp)
+ ;; Require comp with `comp--loadable' set to nil to break
+ ;; circularity.
+ (let ((comp--loadable nil))
+ (require 'comp))
+ (native--compile-async comp--delayed-sources nil 'late)
+ (setq comp--delayed-sources nil)))
+
(declare-function native--compile-async "comp.el"
(files &optional recursively load selector))
(defun startup--honor-delayed-native-compilations ()
"Honor pending delayed deferred native compilations."
- (if (and (native-comp-available-p)
- comp--delayed-sources)
- (progn
- ;; Require comp before setting `comp--loadable' to break
- ;; circularity.
- (require 'comp)
- (setq comp--loadable t)
- (native--compile-async comp--delayed-sources nil 'late)
- (setq comp--delayed-sources nil))
- (setq comp--loadable t)))
+ (when (and (native-comp-available-p)
+ comp--delayed-sources)
+ (startup--require-comp-safetly))
+ (setq comp--loadable t))
(defvar native-comp-eln-load-path)
(defun normal-top-level ()
#define THIRD(x) \
XCAR (XCDR (XCDR (x)))
+/* Like call0 but stringify and intern. */
+#define CALL0I(fun) \
+ CALLN (Ffuncall, intern_c_string (STR (fun)))
+
/* Like call1 but stringify and intern. */
#define CALL1I(fun, arg) \
CALLN (Ffuncall, intern_c_string (STR (fun)), arg)
if (comp__loadable)
{
/* Startup is done, comp is usable. */
- Frequire (Qcomp, Qnil, Qnil);
+ CALL0I(startup--require-comp-safetly);
Fputhash (function_name, definition, Vcomp_deferred_pending_h);
CALLN (Ffuncall, intern_c_string ("native--compile-async"),
src, Qnil, Qlate);