* 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.
This commit is contained in:
Andrea Corallo 2021-03-12 08:59:55 +01:00
parent 711b2c8349
commit 0144764d1d

View file

@ -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.