From 143b485029f8d438001aa6e989954a92c4b2a60b Mon Sep 17 00:00:00 2001 From: "Charles A. Roelli" Date: Wed, 21 Mar 2018 20:52:35 +0100 Subject: * doc/lispref/internals.texi (Writing Emacs Primitives): Fix grammar. --- doc/lispref/internals.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/lispref/internals.texi') diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index 8bf9abfc614..6d25eb14dfd 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -843,7 +843,7 @@ defined with @code{DEFVAR_BOOL} are automatically added to the list @code{byte-boolean-vars} used by the byte compiler. @cindex defining customization variables in C - If you want to make a Lisp variables that is defined in C behave + If you want to make a Lisp variable that is defined in C behave like one declared with @code{defcustom}, add an appropriate entry to @file{cus-start.el}. -- cgit v1.2.1 From 8ac621bb5594786c66cc724864e6037c8c650774 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 22 Mar 2018 14:57:43 +0200 Subject: Document DEFUN attributes * doc/lispref/internals.texi (Writing Emacs Primitives): Document specification of function attributes in DEFUN. --- doc/lispref/internals.texi | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'doc/lispref/internals.texi') diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index 6d25eb14dfd..398ea8de855 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -735,7 +735,7 @@ Lisp form. For example: @example @group -DEFUN ("foo", Ffoo, Sfoo, 0, UNEVALLED, +DEFUN ("foo", Ffoo, Sfoo, 0, UNEVALLED, 0 "(list (read-char-by-name \"Insert character: \")\ (prefix-numeric-value current-prefix-arg)\ t))", @@ -761,6 +761,43 @@ arguments. All the usual rules for documentation strings in Lisp code (@pxref{Documentation Tips}) apply to C code documentation strings too. + +The documentation string can be followed by a list of C function +attributes for the C function that implements the primitive, like +this: + +@example +@group +DEFUN ("bar", Fbar, Sbar, 0, UNEVALLED, 0 + doc: /* @dots{} /* + attributes: @var{attr1} @var{attr2} @dots{}) +@end group +@end example + +@noindent +You can specify more than a single attribute, one after the other. +Currently, only the following attributes are recognized: + +@table @code +@item noreturn +Declares the C function as one that never returns. This corresponds +to the C11 keyword @code{_Noreturn} and to @w{@code{__attribute__ +((__noreturn__))}} attribute of GCC (@pxref{Function Attributes,,, +gcc, Using the GNU Compiler Collection}). + +@item const +Declares that the function does not examine any values except its +arguments, and has no effects except the return value. This +corresponds to @w{@code{__attribute__ ((__const__))}} attribute of +GCC. + +@item noinline +This corresponds to @w{@code{__attribute__ ((__noinline__))}} +attribute of GCC, which prevents the function from being considered +for inlining. This might be needed, e.g., to countermand effects of +link-time optimizations on stack-based variables. +@end table + @end table After the call to the @code{DEFUN} macro, you must write the -- cgit v1.2.1