1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-11 16:08:13 +00:00

single function native compilation doc + interactive support + tests

This commit is contained in:
Andrea Corallo 2019-12-08 20:52:34 +01:00
parent b3db331e8c
commit 6c9acd13d0
2 changed files with 12 additions and 2 deletions

View File

@ -420,7 +420,9 @@ Put PREFIX in front of it."
"Byte compile FUNCTION-NAME spilling data from the byte compiler."
(let* ((f (symbol-function function-name))
(func (make-comp-func :name function-name
:c-name (comp-c-func-name function-name"F"))))
:c-name (comp-c-func-name function-name"F")
:doc (documentation f)
:int-spec (interactive-form f))))
(when (byte-code-function-p f)
(signal 'native-compiler-error
"can't native compile an already bytecompiled function"))

View File

@ -328,10 +328,18 @@ Check that the resulting binaries do not differ."
(ert-deftest comp-tests-free-fun ()
"Check we are able to compile a single function."
(defun comp-tests-free-fun-f ()
"Some doc."
(interactive)
3)
(load (native-compile #'comp-tests-free-fun-f))
(should (subr-native-elisp-p (symbol-function #'comp-tests-free-fun-f)))
(should (= (comp-tests-free-fun-f) 3)))
(should (= (comp-tests-free-fun-f) 3))
(should (string= (documentation #'comp-tests-free-fun-f)
"Some doc."))
(should (commandp #'comp-tests-free-fun-f))
(should (equal (interactive-form #'comp-tests-free-fun-f)
'(interactive))))
;;;;;;;;;;;;;;;;;;;;