aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2023-04-09 20:21:07 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2023-04-09 20:21:07 +0200
commit81c5046b3118323d756eaed6a521846cc1361fb5 (patch)
tree01963b4a703c88acf4c16144868f29fad6be3cc0
parentbddfb467ddcf71074fdd2341ba7bb49c70430316 (diff)
compat-28: Add native-comp-available-p
-rw-r--r--NEWS.org3
-rw-r--r--compat-28.el7
-rw-r--r--compat-tests.el3
-rw-r--r--compat.texi9
4 files changed, 21 insertions, 1 deletions
diff --git a/NEWS.org b/NEWS.org
index 4b42953..bbcac9c 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -4,7 +4,8 @@
* Development
-- Improve =make-separator-line= visuals on graphic displays.
+- compat-28: Improve =make-separator-line= visuals on graphic displays.
+- compat-28: Add =native-comp-available-p=, which always returns nil.
* Release of "Compat" Version 29.1.4.1
diff --git a/compat-28.el b/compat-28.el
index 620a799..f7fc85d 100644
--- a/compat-28.el
+++ b/compat-28.el
@@ -26,6 +26,13 @@
(compat-version "28.1")
+;;;; Defined in comp.c
+
+(compat-defun native-comp-available-p () ;; <compat-tests:native-comp-available-p>
+ "Return non-nil if native compilation support is built-in.
+NOTE: The compatibility version always returns nil."
+ nil)
+
;;;; Defined in fns.c
;; FIXME Should handle multibyte regular expressions
diff --git a/compat-tests.el b/compat-tests.el
index 8972273..7312123 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -1285,6 +1285,9 @@
(should (compiled-function-p (symbol-function 'assq)))
(should (compiled-function-p (symbol-function 'identity))))
+(ert-deftest compat-native-comp-available-p ()
+ (should (memq (native-comp-available-p) '(nil t))))
+
(ert-deftest compat-subr-native-elisp-p ()
(should-not (subr-native-elisp-p (symbol-function 'identity))))
diff --git a/compat.texi b/compat.texi
index 7db6a77..0db20cf 100644
--- a/compat.texi
+++ b/compat.texi
@@ -2154,6 +2154,15 @@ If native compilation is not available, this function always returns
@code{nil}.
@end defun
+@c copied from lispref/compile.texi
+@defun native-comp-available-p
+This function returns non-@code{nil} if the running Emacs process has
+the native-compilation support compiled into it. On systems that load
+@file{libgccjit} dynamically, it also makes sure that library is
+available and can be loaded. Lisp programs that need to know up front
+whether native-compilation is available should use this predicate.
+@end defun
+
@c copied from on lisp/window.el
@defmac with-window-non-dedicated window &rest body
Evaluate @var{body} with @var{window} temporarily made non-dedicated.