From: Andi Kleen <ak@linux.intel.com>
To: gcc-patches@gnu.org
Cc: Andi Kleen <ak@linux.intel.com>
Subject: [PATCH v2 5/5] Add documentation for musttail attribute
Date: Wed, 24 Jan 2024 11:30:45 -0800 [thread overview]
Message-ID: <20240124193134.622934-6-ak@linux.intel.com> (raw)
In-Reply-To: <20240124193134.622934-1-ak@linux.intel.com>
---
gcc/doc/extend.texi | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 0bc586d120e7..c68d32bed8de 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -9867,6 +9867,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::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 Attribute Syntax
--
2.43.0
next prev parent reply other threads:[~2024-01-24 19:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-24 19:30 Andi Kleen
2024-01-24 19:30 ` [PATCH v2 1/5] Improve must tail in RTL backend Andi Kleen
2024-01-24 19:30 ` [PATCH v2 2/5] C++: Support clang compatible [[musttail]] (PR83324) Andi Kleen
2024-01-24 19:30 ` [PATCH v2 3/5] C: Implement musttail attribute for returns Andi Kleen
2024-01-25 20:08 ` Joseph Myers
2024-01-25 20:39 ` Andi Kleen
2024-01-26 8:48 ` Joseph Myers
2024-01-26 9:13 ` Andi Kleen
2024-01-26 9:35 ` Joseph Myers
2024-01-24 19:30 ` [PATCH v2 4/5] Add tests for C/C++ musttail attributes Andi Kleen
2024-01-24 19:30 ` Andi Kleen [this message]
2024-01-25 6:51 ` [PATCH v2 5/5] Add documentation for musttail attribute rep.dot.nop
2024-01-25 8:48 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240124193134.622934-6-ak@linux.intel.com \
--to=ak@linux.intel.com \
--cc=gcc-patches@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).