emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/native-comp 0144764: * Fix error reporting for async native comp


From: Andrea Corallo
Subject: feature/native-comp 0144764: * Fix error reporting for async native compilation (bug#47024)
Date: Fri, 12 Mar 2021 04:04:13 -0500 (EST)

branch: feature/native-comp
commit 0144764d1dde8a2f1d413d042d46cea3e10a7d0a
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>

    * 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.
---
 lisp/emacs-lisp/comp.el | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 3d2a345..98f4dd6 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]