From patchwork Tue May 21 14:28:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Kleen X-Patchwork-Id: 90600 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 98C55384AB70 for ; Tue, 21 May 2024 14:34:24 +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.14]) by sourceware.org (Postfix) with ESMTPS id 6C4EB384B06A for ; Tue, 21 May 2024 14:32:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6C4EB384B06A 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 6C4EB384B06A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716301945; cv=none; b=gAhfnDAwKlRWjCWSRqWDSlUvxohO0qlibxVXKv4OhagjIFCpZ7TPUNX0SI84aXBUDOeOR/kexMhgeLckW+oLBOLltvdXbXtck6i6uXI2gAauiOL572SybukbzMIGzlT/xfSEtBnDmjwA2Xlecvw1PSUZQIaEiujIttP8EV45DaU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716301945; c=relaxed/simple; bh=piVVOF4b/Dp0brV/CtdroV0gJMtjlQ+rp2EqSTiz2mc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=CBNXuwJzA1cZoPPIROnk5hD3l45dK6MuYOpVFqVtivQEHbAQq/9shbkI5v1KBgp4HMJDW+UnhYlbIOj78PPhjnXq1pSoxC6BmQY+UNBIAG8UOaB+/TFpfH+1tWg5HCKdpdzOQh4ca4oWyI6vF8o7CBpEgc6OG13zXF2gny75SuI= 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=1716301944; x=1747837944; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=piVVOF4b/Dp0brV/CtdroV0gJMtjlQ+rp2EqSTiz2mc=; b=YAIo2fUeKhYojdv1DoXX7AUUYrxa6gP0jy4rdLxb1Pv1QKy6q+y+rN59 v+AIGCKHbb8M+0S6wcfYNogOaJTt1kgBDKd6REWw14/d4KUFaYh3t+vs7 wAX5+yY0RTlZVdF9/kgpA14DTje+HpS8/EEGwjiSEYQ3xtlN/cGtwcf+/ GWyUcr7YHLMNJMPG7SB3vteDXLZ76HOtueXgzVXmR9UVRorGFwJU5B256 TlvsbboNoslXxDF0I1kTDdFkDK4PHW22WNiUVVEWDk3pAYfR8pIf+Vfgi TQBGpf+vqu8kOrHR9NlFpjBgBcFRursgHgQ/bHKQN3PcV77a9Y+BH5839 A==; X-CSE-ConnectionGUID: YyiNF2ZVQ92M3AcndcVxvw== X-CSE-MsgGUID: H9EM+j7ER1umW0nTAK7MyA== X-IronPort-AV: E=McAfee;i="6600,9927,11078"; a="16328256" X-IronPort-AV: E=Sophos;i="6.08,178,1712646000"; d="scan'208";a="16328256" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 07:32:19 -0700 X-CSE-ConnectionGUID: fDTkK0CvRgOfEYBycUt4qw== X-CSE-MsgGUID: wWBtvbWASFe8em2uUhUsbw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,178,1712646000"; d="scan'208";a="64166843" Received: from tassilo.jf.intel.com ([10.54.38.190]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 07:32:19 -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 v6 2/8] Add a musttail generic attribute to the c-attribs table Date: Tue, 21 May 2024 07:28:35 -0700 Message-ID: <20240521143203.2893096-3-ak@linux.intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240521143203.2893096-1-ak@linux.intel.com> References: <20240521143203.2893096-1-ak@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.9 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 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 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 04e39b41bdf3..7110d56c8ca0 100644 --- a/gcc/c-family/c-attribs.cc +++ b/gcc/c-family/c-attribs.cc @@ -338,6 +338,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 @@ -1216,6 +1218,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 2d5f53998855..2707405e8def 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -1637,6 +1637,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);