emacs-diffs
[Top][All Lists]
Advanced

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

feature/native-comp 3be9339 2/2: Sanitize eln filename when native compi


From: Andrea Corallo
Subject: feature/native-comp 3be9339 2/2: Sanitize eln filename when native compiling single functions
Date: Tue, 20 Oct 2020 16:29:35 -0400 (EDT)

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

    Sanitize eln filename when native compiling single functions
    
        * lisp/emacs-lisp/comp.el (comp-spill-lap-function): Fix
        temporary eln name generation.
    
        * test/src/comp-tests.el (free-fun-silly-name): New testcase.
---
 lisp/emacs-lisp/comp.el | 3 ++-
 test/src/comp-tests.el  | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 6c54085..4967e85 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -664,7 +664,8 @@ clashes."
   "Byte-compile FUNCTION-NAME spilling data from the byte compiler."
   (unless (comp-ctxt-output comp-ctxt)
     (setf (comp-ctxt-output comp-ctxt)
-          (make-temp-file (symbol-name function-name) nil ".eln")))
+          (make-temp-file (comp-c-func-name function-name "freefn-")
+                          nil ".eln")))
   (let* ((f (symbol-function function-name))
          (c-name (comp-c-func-name function-name "F"))
          (func (make-comp-func-l :name function-name
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index a13235b..b9a0a87 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -369,6 +369,12 @@ Check that the resulting binaries do not differ."
   (should (equal (interactive-form #'comp-tests-free-fun-f)
                  '(interactive))))
 
+(comp-deftest free-fun-silly-name ()
+  "Check we are able to compile a single function."
+  (eval '(defun comp-tests/free\fun-f ()) t)
+  (native-compile #'comp-tests/free\fun-f)
+  (should (subr-native-elisp-p (symbol-function #'comp-tests/free\fun-f))))
+
 (comp-deftest bug-40187 ()
   "Check function name shadowing.
 https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html.";



reply via email to

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