The default value is 2.
@end defopt
+@defopt compilation-safety
+This variable specifies the safetyness level used for the code emitted
+native code. The value of compilation-safety should be a number between
+zero and one with the following meaning:
+
+@table @asis
+@item 0
+Emitted code can misbehave or crash Emacs if function declarations are
+not correct and the function is native compiled.
+@item 1
+Emitted code is generated in a safe matter even if function are
+miss-declared."
+@end table
+
+This can be controlled at function granularity as well by using the
+@code{safety} @code{declare} form, @pxref{Declare Form}.
+@end defopt
+
@defopt native-comp-debug
This variable specifies the level of debugging information produced by
native-compilation. Its value should be a number between zero and 3,
@minus{}1, native compilation of the function will emit bytecode
instead of native code for the function.
+@item (safety @var{n})
+Specify the value of @code{compilation-safety} in effect for this
+function. This allows function-level control of the safety level used
+for the code emitted for the function (@pxref{Native-Compilation
+Variables}).
+
@item (type @var{type})
Declare @var{type} to be the type of this function. This is used for
documentation by @code{describe-function}. Also it can be used by the
Declaring a function with an incorrect type produces undefined behavior
and could lead to unexpected results or might even crash Emacs when code
-is native-compiled and loaded. Note also that when redefining (or
-advising) a type declared function the replacement should respect the
-original signature to avoid undefined behavior.
+is native-compiled and loaded if compiled with @ref{compilation-safety}
+0. Note also that when redefining (or advising) a type declared
+function the replacement should respect the original signature to avoid
+undefined behavior.
@item no-font-lock-keyword
This is valid for macros only. Macros with this declaration are
:group 'lisp)
(defcustom compilation-safety 1
- "Safety level."
+ "Safety level for compilation.
+Possible values are:
+0 emitted code can misbehave or crash Emacs if function declarations are not
+correct.
+1 emitted code is generated in a safe matter even if function are miss-declared."
:type 'integer
:safe #'integerp
:version "30.1")