summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/comp.el
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2021-03-12 08:59:55 +0100
committerAndrea Corallo <akrl@sdf.org>2021-03-12 10:03:09 +0100
commit0144764d1dde8a2f1d413d042d46cea3e10a7d0a (patch)
tree9c813b3cd78751287e47123922f2db4f4a55cdb9 /lisp/emacs-lisp/comp.el
parent711b2c834976e41ca2c9c36dafcc9977eb4f398b (diff)
downloademacs-0144764d1dde8a2f1d413d042d46cea3e10a7d0a.tar.gz
emacs-0144764d1dde8a2f1d413d042d46cea3e10a7d0a.tar.bz2
emacs-0144764d1dde8a2f1d413d042d46cea3e10a7d0a.zip
* Fix error reporting for async native compilation (bug#47024)
* lisp/emacs-lisp/comp.el (comp--native-compile): During async compilation if we catch an error print it in a parsable way so we can report it to the user.
Diffstat (limited to 'lisp/emacs-lisp/comp.el')
-rw-r--r--lisp/emacs-lisp/comp.el22
1 files changed, 17 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 3d2a345e210..98f4dd6e1f6 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -3970,12 +3970,24 @@ load once it finishes compiling."
(comp-log (format "Done compiling %s" data) 0)
(cl-loop for (pass . time) in (reverse report)
do (comp-log (format "Pass %s took: %fs." pass time) 0))))
- (native-compiler-error
- ;; Add source input.
+ (t
(let ((err-val (cdr err)))
- (signal (car err) (if (consp err-val)
- (cons function-or-file err-val)
- (list function-or-file err-val))))))
+ ;; If we are doing an async native compilation print the
+ ;; error in the correct format so is parsable and abort.
+ (if (and comp-async-compilation
+ (not (eq (car err) 'native-compiler-error)))
+ (progn
+ (message (if err-val
+ "%s: Error: %s %s"
+ "%s: Error %s")
+ function-or-file
+ (get (car err) 'error-message)
+ (car-safe err-val))
+ (kill-emacs -1))
+ ;; Otherwise re-signal it adding the compilation input.
+ (signal (car err) (if (consp err-val)
+ (cons function-or-file err-val)
+ (list function-or-file err-val)))))))
(if (stringp function-or-file)
data
;; So we return the compiled function.