gcc/ChangeLog: * doc/extend.texi: Document [[musttail]] --- gcc/doc/extend.texi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 142e41ab8fbf..866f6c4a9fed 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -9875,6 +9875,22 @@ foo (int x, int y) @code{y} is not actually incremented and the compiler can but does not have to optimize it to just @code{return 42 + 42;}. +@cindex @code{musttail} statement attribute +@item musttail + +The @code{gnu::musttail} or @code{clang::musttail} 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 Attribute Syntax -- 2.43.0