From patchwork Wed Jan 24 11:08:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Kleen X-Patchwork-Id: 1890192 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=lmyh2+eb; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TKh7w0vsvz23dy for ; Wed, 24 Jan 2024 22:10:20 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1D38C385E828 for ; Wed, 24 Jan 2024 11:10:18 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 05797385E007 for ; Wed, 24 Jan 2024 11:08:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 05797385E007 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=linux.intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 05797385E007 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=1706094511; cv=none; b=fpTIyhD4tkJ0zaBZU3AHEFmKHRE5+9KdmkaiYmtWA6jC9RaAS4/23s1zze7SgQKmx1cml0zIBDG3zXzT2+1aMjjfG6AV0ms5VHZJkP/AAbFzvQJC+ystSlCcUDyrpEAzGTgl+sETyIKnGm4IG7+jemqq/cAJCS92Iz+g/dgkvcc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706094511; c=relaxed/simple; bh=MLqYq3AHvAzhGbe+d5uSAffcZ9g2fRAzAg2AJWkZCHM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=c+IJoA3TlhyNCDWnryAHGQoKtOyAY3CutkYoLxu0olYU4O7TjxW1Be9zkFDnWQVdf4JU4vR2uZsCxJ8trKzpR2RjVRjuqc2GwyURMmT2TVN2WtZmCg+2svIgHtthjZjfxeZOdizLRe8sYs18NHHrZiyyd4rSlh+BRbkF+6d+UIE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from mgamail.intel.com ([192.55.52.93]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rSb7L-0004qb-Kc for gcc-patches@gnu.org; Wed, 24 Jan 2024 06:08:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706094507; x=1737630507; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MLqYq3AHvAzhGbe+d5uSAffcZ9g2fRAzAg2AJWkZCHM=; b=lmyh2+ebkQDsyr7hAiPZpTPmD8W7W99ge8V5PYMKzdZUA49r3Gl/Ov6l 7j6v1fEQLdsKl/J3Ij6OoA8+sbnknE0FGnWRcXr7sxS1l+aHFBA0VBP61 10lnkkc8S6rd/Kc1aXq0HNVfTJVIP/MKxXPhs6F6Ox+T1ncNaNmDNYY+j hMEV6vZvAoeNtxZ/0xILvgp4jaZpnQmCbjbhgRGDtjt94GRUKMWAlP2VM VgRn2TeGepQBYLHhpGfefouIdTBBZj62XPEp8/edb+vdzwKxDcmnuoa5X 6/HabDLri6SW7e9uNxJ4iZ8L0ORLZMXHK1zh1tgtCaNWtoHqsUJvml6nb w==; X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="398969571" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="398969571" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2024 03:08:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="959472956" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="959472956" Received: from tassilo.jf.intel.com ([10.54.38.190]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2024 03:08:17 -0800 From: Andi Kleen To: gcc-patches@gnu.org Cc: Andi Kleen Subject: [PATCH v1 4/4] Add documentation for musttail attribute Date: Wed, 24 Jan 2024 03:08:00 -0800 Message-ID: <20240124110800.3154093-4-ak@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240124110800.3154093-1-ak@linux.intel.com> References: <20240124110800.3154093-1-ak@linux.intel.com> MIME-Version: 1.0 Received-SPF: none client-ip=192.55.52.93; envelope-from=ak@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -55 X-Spam_score: -5.6 X-Spam_bar: ----- X-Spam_report: (-5.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.327, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org --- gcc/doc/extend.texi | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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