emacs-diffs
[Top][All Lists]
Advanced

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

feature/native-comp 15aa239: * Handle `comp-native-driver-options' both


From: Andrea Corallo
Subject: feature/native-comp 15aa239: * Handle `comp-native-driver-options' both as file-local both as global
Date: Sun, 7 Mar 2021 16:20:51 -0500 (EST)

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

    * Handle `comp-native-driver-options' both as file-local both as global
    
        * src/comp.c (add_driver_options): Throw an error if
        `comp-native-driver-options' is set globally but
        'gcc_jit_context_add_driver_option' is not available, ignore for
        the file-local case.
---
 src/comp.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/comp.c b/src/comp.c
index b68adf3..e6f672d 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -4334,9 +4334,9 @@ DEFUN ("comp-native-driver-options-effective-p",
 static void
 add_driver_options (void)
 {
-  Lisp_Object options = comp.driver_options;
+  Lisp_Object options = Fsymbol_value (Qcomp_native_driver_options);
 
-#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option) \
+#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option) \
   || defined (WINDOWSNT)
   load_gccjit_if_necessary (true);
   if (!NILP (Fcomp_native_driver_options_effective_p ()))
@@ -4347,7 +4347,6 @@ add_driver_options (void)
                                            ENCODE_FILE or
                                            ENCODE_SYSTEM.  */
                                         SSDATA (XCAR (options)));
-  return;
 #endif
   if (CONSP (options))
     xsignal1 (Qnative_compiler_error,
@@ -4355,6 +4354,20 @@ add_driver_options (void)
                            " via `comp-native-driver-options' is"
                            " only available on libgccjit version 9"
                            " and above."));
+
+  /* Captured `comp-native-driver-options' because file-local.  */
+#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option) \
+  || defined (WINDOWSNT)
+  options = comp.driver_options;
+  if (!NILP (Fcomp_native_driver_options_effective_p ()))
+    FOR_EACH_TAIL (options)
+      gcc_jit_context_add_driver_option (comp.ctxt,
+                                        /* FIXME: Need to encode
+                                           this, but how? either
+                                           ENCODE_FILE or
+                                           ENCODE_SYSTEM.  */
+                                        SSDATA (XCAR (options)));
+#endif
 }
 
 DEFUN ("comp--compile-ctxt-to-file", Fcomp__compile_ctxt_to_file,



reply via email to

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