1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-28 07:45:00 +00:00

; Fix documentation of recently-installed changes

* lisp/emacs-lisp/bytecomp.el (compilation-safety): Doc fix.

* etc/NEWS: Fix wording of the 'compilation-safety' entry.

* doc/lispref/functions.texi (Declare Form): Fix cross-reference
and wording.
* doc/lispref/compile.texi (Native-Compilation Variables): Add the
missing @anchor.  Fix wording.
This commit is contained in:
Eli Zaretskii 2024-05-14 08:51:13 +03:00
parent fff245c529
commit f6d060b39a
4 changed files with 27 additions and 19 deletions

View File

@ -987,21 +987,23 @@ form, @pxref{Declare Form}.)
The default value is 2. The default value is 2.
@end defopt @end defopt
@anchor{compilation-safety}
@defopt compilation-safety @defopt compilation-safety
This variable specifies the safetyness level used for the code emitted This variable specifies the safety level to be used for the emitted
native code. The value of compilation-safety should be a number between native code. The value should be a number, either 0 or 1 with the
zero and one with the following meaning: following meanings:
@table @asis @table @asis
@item 0 @item 0
Emitted code can misbehave or crash Emacs if function declarations are Emitted code can misbehave (up to even crashing Emacs) if a function's
not correct and the function is native compiled. declaration does not describe correctly what the function does or how it
is called, and the function is natively compiled.
@item 1 @item 1
Emitted code is generated in a safe matter even if function are Emitted code must be generated in a safe manner even if functions are
miss-declared." mis-declared.
@end table @end table
This can be controlled at function granularity as well by using the This can also be controlled at a function granularity, by using the
@code{safety} @code{declare} form, @pxref{Declare Form}. @code{safety} @code{declare} form, @pxref{Declare Form}.
@end defopt @end defopt

View File

@ -2761,10 +2761,11 @@ argument of type @var{string} and return one of the symbols
For description of additional types, see @ref{Lisp Data Types}). For description of additional types, see @ref{Lisp Data Types}).
Declaring a function with an incorrect type produces undefined behavior Declaring a function with an incorrect type produces undefined behavior
and could lead to unexpected results or might even crash Emacs when code and could lead to unexpected results or might even crash Emacs when
is native-compiled and loaded if compiled with @ref{compilation-safety} natively-compiled code is loaded, if it was compiled with
0. Note also that when redefining (or advising) a type declared @code{compilation-safety} level of zero (@pxref{compilation-safety}).
function the replacement should respect the original signature to avoid Note also that when redefining (or advising) a type-declared function,
the replacement should respect the original signature to avoid such
undefined behavior. undefined behavior.
@item no-font-lock-keyword @item no-font-lock-keyword

View File

@ -1986,9 +1986,11 @@ unibyte string.
* Lisp Changes in Emacs 30.1 * Lisp Changes in Emacs 30.1
+++ +++
** New 'compilation-safety' compilation parameter. ** New user option 'compilation-safety' to control safety of native code.
It's now possible to use the safety parameter to control how safe is It's now possible to control how safe is the code generated by native
code generated by the native compiler. compilation, by customizing this user option. It is also possible to
control this at function granularity by using the new 'safety' parameter
in the function's 'declare' form.
** New types 'closure' and 'interpreted-function'. ** New types 'closure' and 'interpreted-function'.
'interpreted-function' is the new type used for interpreted functions, 'interpreted-function' is the new type used for interpreted functions,

View File

@ -138,11 +138,14 @@
:group 'lisp) :group 'lisp)
(defcustom compilation-safety 1 (defcustom compilation-safety 1
"Safety level for compilation. "Safety level for generated compiled code.
Possible values are: Possible values are:
0 emitted code can misbehave or crash Emacs if function declarations are not 0 - emitted code can misbehave, even crash Emacs, if declarations of
correct. functions do not correctly describe their actual behavior;
1 emitted code is generated in a safe matter even if function are miss-declared." 1 - emitted code is to be generated in a safe manner, even if functions
are mis-declared.
This currently affects only code produced by native-compilation."
:type 'integer :type 'integer
:safe #'integerp :safe #'integerp
:version "30.1") :version "30.1")