From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 0AE7C3858C42 for ; Sun, 4 Feb 2024 04:35:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0AE7C3858C42 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=baylibre.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0AE7C3858C42 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707021353; cv=none; b=N4ke8grSXTNOOIbXYwqC4GanN0sKW/zwRrzzjDS/HWC9r4XoJoCrEX/fv7w4OsB2QX5o+no6PJeJqx4R1o+Ei5a8oqcNDv603LRHooJ19c2LuVullmKExb2z3Dko7WU2xqkXIRR3SCdrtYksM8WNAmJpa7kPSD9KrXeNEUwN+EI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707021353; c=relaxed/simple; bh=lgjGlYLtesoVM8QiSTS6N3JA1egriu9H72zJe5Zd3rE=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=HjITMPaXrL2RyUV5FuYeYFE7863tVdtn7N0jHc6B0Ln6YMowVjfgcr89Ssd0GSlejrI94xJHRyRwBOHx32h70nGUrpDHCMJOInOgKHtKQn6oXQuOpLQHYg2spfVD8sDA8cTMKvzY3EKcELaM5X/9YDbPxJhg+PZBscy7h3APJYA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from mail-io1-xd42.google.com ([2607:f8b0:4864:20::d42]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rWUEN-0007m5-KP for gcc-patches@gnu.org; Sat, 03 Feb 2024 23:35:49 -0500 Received: by mail-io1-xd42.google.com with SMTP id ca18e2360f4ac-7beda6a274bso135812439f.2 for ; Sat, 03 Feb 2024 20:35:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1707021345; x=1707626145; darn=gnu.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=vDLlsJGq39hpYnAmRpzcm9cPnofkcT1bikIDNhDDu9w=; b=ULPEBHBzGw+qBxbUw3CfpWtKPYsY30SZLQx5SXCCJnq7dAmDSs7ax41AYcP6JNtd9O Ks7AoKqvBsavj4tpRvtwVJtWSsvwq1zTMBzyL8WXihcrti11EKIE0Tgn0y1GQ21NwzlZ fqvh043yzUZAKPdVqGMAkQGHyMcJXYshLG0sF3iK+kmTlT4dA5mDVhbHfNDvAgDgi3m+ pdpnTh5IoZ8QYAhu7h1DPu3fHQBCd30zqkYUyMdlNdYriSD3UC7NN5mwZTczqJdXeqas 7M7wckR4IJtGiz16N2jmmp6I5E9uHmvw6aHrpx1FC20+qNMMY2a+DXGWERL9b8VhoEIy JuXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707021345; x=1707626145; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vDLlsJGq39hpYnAmRpzcm9cPnofkcT1bikIDNhDDu9w=; b=T9b5yInwFs+zuh8vQQvaTJvSrI6HEHzAu3+px2KrVXkXB/x/Ymgmx5vNEBamlGxGos nn3uS+j0e9A+NuvZXoG0GVDsGfP99/t5VUVcTm2EWDypdFZrBji1RKXVueooa3eDTgrc ugGYl+ysuLtIAAceoSqJG1YZa2/P4DPZK2FCQDA0e80jkbqennf+GmH1gPn9hb2J7mgw O7I5DoZYsmXjZeQyCme78qgZoAkPTzvIM1KaxBLB1PBao40MBWnRJ9otNnO72ADAs1Q+ ivdfBJ3J+Gdz1wEHS5IZ+xhg+IixwfsExqoyqq03F78bZG6pmz3gLz/6xYRPdvcCH0Qp Nojw== X-Gm-Message-State: AOJu0YyXhb4Wocnv1JwgqcuqOGpNOCbWGrkYgtIk2aJq4lKHJGMWGpaL 5IKpvF/mPvfYeGrPrmYSuLJ5KnftvG44I4sPsMfh91+BfnzskJvrtAdHhjSUhg3n2tcaZlFhGfs PqNSeOA== X-Google-Smtp-Source: AGHT+IF9AsGEKSpBF434spaC7uOnTvVhhThFQIErvK2UwIrxWaDSFQ4LACZv725GhSBVyLxYgergmA== X-Received: by 2002:a92:c9cc:0:b0:363:767d:bfa4 with SMTP id k12-20020a92c9cc000000b00363767dbfa4mr6794952ilq.4.1707021344805; Sat, 03 Feb 2024 20:35:44 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVxEixTwnhqYdTDqZYqzli8QUr2sHYP/Awye9AUHqIYlIa0xHxKFJhWhu1k98o1DtuXsT+S1SfiYmHFtu9j/5wDdemq Received: from ?IPV6:2601:281:d980:41d0:5911:12d4:ba45:5435? ([2601:281:d980:41d0:5911:12d4:ba45:5435]) by smtp.gmail.com with ESMTPSA id m20-20020a056638409400b0046e917416c8sm1376120jam.89.2024.02.03.20.35.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 03 Feb 2024 20:35:44 -0800 (PST) Message-ID: Date: Sat, 3 Feb 2024 21:35:43 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 5/5] Add documentation for musttail attribute Content-Language: en-US To: Andi Kleen , gcc-patches@gnu.org References: <20240202091322.1898280-1-ak@linux.intel.com> <20240202091322.1898280-6-ak@linux.intel.com> From: Sandra Loosemore In-Reply-To: <20240202091322.1898280-6-ak@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::d42; envelope-from=sloosemore@baylibre.com; helo=mail-io1-xd42.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,RCVD_IN_DNSWL_NONE=-0.0001,SPF_HELO_NONE=0.001,SPF_PASS=-0.001,T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,SPF_HELO_PASS,SPF_SOFTFAIL,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2/2/24 02:09, Andi Kleen wrote: > 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. It took me about 3 attempts to parse this. :-S I think this might be a little better: ...can be applied to a @code{return} statement with a return-value expression that is a function call. It asserts 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 s/will generate/generates/ I'm a big fan of writing in the present tense. ;-) > +an error. Tail calls generally require enabling optimization. > +On some targets they may not be supported. > + > @end table > > @node Attribute Syntax In addition to these changes, at the beginning of this section we have @node Statement Attributes @section Statement Attributes @cindex Statement Attributes GCC allows attributes to be set on null statements. @xref{Attribute Syntax}, for details of the exact syntax for using attributes. [...] Well, we now have an attribute that goes on a non-null statement, so we have to fix this. The documentation for the other statement attributes is already explicit that they go on null statements so those already would be OK if we just removed the "null" restriction here. OTOH, the Attribute Syntax section, in discussing GCC's traditional attribute syntax, says: @subsubheading Statement Attributes In GNU C, an attribute specifier list may appear as part of a null statement. The attribute goes before the semicolon. If "musttail" is only supported in the standard attribute syntax, its new entry in the Statement Attributes node must say that, and the blurb at the top of the node quoted above must say something to the effect that the traditional syntax only allows statement attributes on null statements and attributes on non-null statements are only permitted in the new standard attribute form. -Sandra