From patchwork Sun Jun 2 17:16:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Kleen X-Patchwork-Id: 1942533 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=Gw+WBhH7; 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 4VskGz1QDwz20Pr for ; Mon, 3 Jun 2024 03:23:55 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 39C31393BA6A for ; Sun, 2 Jun 2024 17:23:53 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) by sourceware.org (Postfix) with ESMTPS id 1EAE0392AC14 for ; Sun, 2 Jun 2024 17:22:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1EAE0392AC14 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 1EAE0392AC14 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717348943; cv=none; b=Q++827PLzJIYgslZn/BgryUd3axx+6qA/Sr1x+7wVOyhGBxhC5nOuPRiGHBehAHv6Qk01ygD3OzsZ+qbnT+hIUedCY7GF9zOe7nGnhig1HpdqOBfI38d0U7UNvrxMfaDMV+E1Xzbf9npcEdOQNZDZEOj9Ko6+ZJFps+b8ROXe8o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717348943; c=relaxed/simple; bh=xpu87Knpq495rPjbAgQubfCw/ar+F8v6T+LmYrw0N60=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=HzuDlUxsPHAPPXjkjrkGGt2yNC1IWuF17wOJIbYgJQKZgpkotn765w4utEwK2oIE3ysKyb5cCEyvhKleWeTXbMY5E1Uao+mR7g8fhJeSKhqEb3RuQf8gaEBDVng5XIyuU+uUCXW+8ih48PQRl3H7lvEUCUZk2KiEKrS8KtMRjUU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717348942; x=1748884942; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xpu87Knpq495rPjbAgQubfCw/ar+F8v6T+LmYrw0N60=; b=Gw+WBhH7aWw8o+gMxROPubGKhe2G9frcq8wV2U/lWotwoKC4b8WDeggl pCo44H6PUdtJhQEFP+yxDvtvasE1D4Gyn5G/Nv7n3mIkxt+PDTz6lLiPN iIp9Tfwbpihloxl/kRjaZ48CQV7rXxG1yKlJbqBTiNUEV8YiPHwWINM1n MXLe5NfuuOxpbBdSTUicRLK6EC+Ovxeu5DkI+JyvJ6Le9l52ysdWvvI4D HJn2V2iWFODrDqRAOzVstbJ6+pb5YxqjGDWsZGNRr58Tg0xt2JCv2+Cu2 zW7gDCHDsthneXz2QWG1ZssdGMgPMbbrI3ykuW3Plkqfy85WaJ84Umd5C w==; X-CSE-ConnectionGUID: 8y5v10q3Q32GDWyR88vGVg== X-CSE-MsgGUID: 0V7AzAplTaeKTqe69TnQ0g== X-IronPort-AV: E=McAfee;i="6600,9927,11091"; a="24418927" X-IronPort-AV: E=Sophos;i="6.08,209,1712646000"; d="scan'208";a="24418927" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2024 10:22:18 -0700 X-CSE-ConnectionGUID: jIJnklUpS4SBgk1na0plAw== X-CSE-MsgGUID: iedR8Yz+RNu8fqMp+JV6yQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,209,1712646000"; d="scan'208";a="41088185" Received: from tassilo.jf.intel.com ([10.54.38.190]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2024 10:22:17 -0700 From: Andi Kleen To: gcc-patches@gcc.gnu.org Cc: richard.guenther@gmail.com, nathan@acm.org, josmyers@redhat.com, richard.sandiford@arm.com, jason@redhat.com, Andi Kleen Subject: [PATCH v7 3/9] Add a musttail generic attribute to the c-attribs table Date: Sun, 2 Jun 2024 10:16:47 -0700 Message-ID: <20240602172205.2151579-4-ak@linux.intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240602172205.2151579-1-ak@linux.intel.com> References: <20240602172205.2151579-1-ak@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, 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 It does nothing currently since statement attributes are handled directly in the parser. gcc/c-family/ChangeLog: * c-attribs.cc (handle_musttail_attribute): Add. * c-common.h (handle_musttail_attribute): Add. --- gcc/c-family/c-attribs.cc | 15 +++++++++++++++ gcc/c-family/c-common.h | 1 + 2 files changed, 16 insertions(+) diff --git a/gcc/c-family/c-attribs.cc b/gcc/c-family/c-attribs.cc index f9b229aba7fc..5adc7b775eaf 100644 --- a/gcc/c-family/c-attribs.cc +++ b/gcc/c-family/c-attribs.cc @@ -340,6 +340,8 @@ const struct attribute_spec c_common_gnu_attributes[] = { "common", 0, 0, true, false, false, false, handle_common_attribute, attr_common_exclusions }, + { "musttail", 0, 0, false, false, false, + false, handle_musttail_attribute, NULL }, /* FIXME: logically, noreturn attributes should be listed as "false, true, true" and apply to function types. But implementing this would require all the places in the compiler that use TREE_THIS_VOLATILE @@ -1222,6 +1224,19 @@ handle_common_attribute (tree *node, tree name, tree ARG_UNUSED (args), return NULL_TREE; } +/* Handle a "musttail" attribute; arguments as in + struct attribute_spec.handler. */ + +tree +handle_musttail_attribute (tree ARG_UNUSED (*node), tree name, tree ARG_UNUSED (args), + int ARG_UNUSED (flags), bool *no_add_attrs) +{ + /* Currently only a statement attribute, handled directly in parser. */ + warning (OPT_Wattributes, "%qE attribute ignored", name); + *no_add_attrs = true; + return NULL_TREE; +} + /* Handle a "noreturn" attribute; arguments as in struct attribute_spec.handler. */ diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 3e0eed0548b0..f08b92e420b6 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -1638,6 +1638,7 @@ extern tree find_tm_attribute (tree); extern const struct attribute_spec::exclusions attr_cold_hot_exclusions[]; extern const struct attribute_spec::exclusions attr_noreturn_exclusions[]; extern tree handle_noreturn_attribute (tree *, tree, tree, int, bool *); +extern tree handle_musttail_attribute (tree *, tree, tree, int, bool *); extern bool has_attribute (location_t, tree, tree, tree (*)(tree)); extern tree build_attr_access_from_parms (tree, bool);