From patchwork Fri Feb 2 09:09:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Kleen X-Patchwork-Id: 85203 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E59B03857B87 for ; Fri, 2 Feb 2024 09:16:01 +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 7F7813858414 for ; Fri, 2 Feb 2024 09:13:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7F7813858414 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 7F7813858414 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=1706865224; cv=none; b=fDbBverTIh2ocvoJOHYD32Vo2xT02Jlo0RAD/Mj3Bx2MsTXGa6hX43aTss2y1Ld+/O7uEzJKeRTuva2bdyM7ePyf76Gffg0hztNOAskZdR8SSKwob9axps5wkNFaN0oLzPZwYNASNgi+sIPqN/9KidcT6tjvI9vIJJBOos1o6P4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706865224; c=relaxed/simple; bh=4XJgf9IeqAEBW+VOM/JVPlCCD6TohzsMzQUOel98ozc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=v2vVnP0ks4BNVIhc7Ddc/rUWx1inHkNlg3QYgZX3c7g8iD3x0yz+pZYJXCb2Z7glx63CQ93Q8HsyqAsl5Cf/brFh7GH2tmWlzQG7r8m3rfXTuHdryRLZGkHiPLDst716IHTNmqdY+GsIpLBTT6lyuyBnS+ItLfu0JtahiTrUX3w= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from mgamail.intel.com ([192.198.163.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVpcC-0004Em-JL for gcc-patches@gnu.org; Fri, 02 Feb 2024 04:13:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706865220; x=1738401220; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4XJgf9IeqAEBW+VOM/JVPlCCD6TohzsMzQUOel98ozc=; b=WFFsJ/bCUTx+RbxyZdmYe7iapUNXaU5zyTyO+/uZFH0H/hx0Em0JmJl0 7EcLuj8hM74ie+gAIRaL4JxvvuKgdRBgrkNlqbrjxAJTEDtBFDKw7r8Nz 8TpQV8ASj3Hgb/PZ5FbdO/mBSloML942Hj674TbQN/uTNzFP4yjc8lI9/ ggKOJa0sUmgfDmLrVEfQOA5fYPbldzsrno9gDskbu1GVakqf/NwJjButW WhJa7PXsh4o62/S7stJTVHpky3np/UFfH9GOHUy7y4BLmOaMuT1yt5jIo Uu2aj85t7GnG8SHF1VsdHmV/XNqXoUU7286Uc1HIwc99foNakBTn7kQxL Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10971"; a="3942952" X-IronPort-AV: E=Sophos;i="6.05,237,1701158400"; d="scan'208";a="3942952" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2024 01:13:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,237,1701158400"; d="scan'208";a="23318068" Received: from tassilo.jf.intel.com ([10.54.38.190]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2024 01:13:30 -0800 From: Andi Kleen To: gcc-patches@gnu.org Cc: Andi Kleen Subject: [PATCH v4 5/5] Add documentation for musttail attribute Date: Fri, 2 Feb 2024 01:09:20 -0800 Message-ID: <20240202091322.1898280-6-ak@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240202091322.1898280-1-ak@linux.intel.com> References: <20240202091322.1898280-1-ak@linux.intel.com> MIME-Version: 1.0 Received-SPF: none client-ip=192.198.163.12; envelope-from=ak@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.292, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, 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=-13.1 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+patchwork=sourceware.org@gcc.gnu.org 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