diff mbox series

[v1,4/4] Add documentation for musttail attribute

Message ID 20240124110800.3154093-4-ak@linux.intel.com
State New
Headers show
Series [v1,1/4] Improve must tail in RTL backend | expand

Commit Message

Andi Kleen Jan. 24, 2024, 11:08 a.m. UTC
---
 gcc/doc/extend.texi | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 0bc586d120e7..444b68f5d071 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -27890,7 +27890,8 @@  Predefined Macros,cpp,The GNU C Preprocessor}).
                         each needed template instantiation is emitted.
 * Bound member functions:: You can extract a function pointer to the
                         method denoted by a @samp{->*} or @samp{.*} expression.
-* C++ Attributes::      Variable, function, and type attributes for C++ only.
+* C++ Attributes::      Variable, function, statement, and type attributes
+			for C++ only.
 * Function Multiversioning::   Declaring multiple function versions.
 * Type Traits::         Compiler support for type traits.
 * C++ Concepts::        Improved support for generic programming.
@@ -28458,6 +28459,22 @@  precedence and the @code{hot} attribute is not propagated.
 For the effects of the @code{hot} attribute on functions, see
 @ref{Common Function Attributes}.
 
+@cindex @code{musttail} statement attribute
+@item musttail
+
+The @code{gnu::musttail} or @code{clang::hottail} attribute
+can be applied to a return statement that returns the value
+of a call to indicate that the call must be a tail call
+that does not allocate extra stack space.
+
+@smallexample
+[[gnu::musttail]] return foo();
+@end smallexample
+
+If the compiler cannot generate a tail call it will generate
+an error. Tail calls generally require enabling optimization.
+On some targets they may not be supported.
+
 @end table
 
 @node Function Multiversioning