]> git.eshelyaron.com Git - emacs.git/commitdiff
* Better error handling after calling 'gcc_jit_context_compile_to_file'
authorAndrea Corallo <akrl@sdf.org>
Tue, 15 Sep 2020 07:05:14 +0000 (09:05 +0200)
committerAndrea Corallo <akrl@sdf.org>
Tue, 15 Sep 2020 07:05:14 +0000 (09:05 +0200)
Tipically errors are catched in 'compile_function' but in case
libgccjit throw an error only afterwards while compiling the whole
compilation unit we have to report it correctly.

* src/comp.c (Fcomp__compile_ctxt_to_file): Catch libgccjit
errors after calling 'gcc_jit_context_compile_to_file'.

src/comp.c

index b3640b5e378a1ba40a0dbf2a51267a5d5160a609..15d85d30fcb3055fce6f80f66f0fd3f7d053a439 100644 (file)
@@ -4391,6 +4391,13 @@ DEFUN ("comp--compile-ctxt-to-file", Fcomp__compile_ctxt_to_file,
                                   GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY,
                                   SSDATA (tmp_file));
 
+  const char *err =  gcc_jit_context_get_first_error (comp.ctxt);
+  if (err)
+    xsignal3 (Qnative_ice,
+             build_string ("failed to compile"),
+             file_name,
+             build_string (err));
+
   CALL1I (comp-clean-up-stale-eln, file_name);
   CALL2I (comp-delete-or-replace-file, file_name, tmp_file);