From patchwork Sat Jun 22 18:54: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: 1951116 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=M+qxjwoB; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; 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 [8.43.85.97]) (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 4W63P00GP1z1ydW for ; Sun, 23 Jun 2024 04:56:52 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2B2C0385DDDC for ; Sat, 22 Jun 2024 18:56:49 +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.17]) by sourceware.org (Postfix) with ESMTPS id EAB793858408 for ; Sat, 22 Jun 2024 18:56:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EAB793858408 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 EAB793858408 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.17 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719082572; cv=none; b=EO08KGdgfmnZu3cxDvVtSjmmc0dYRODdmlpmyakt8mURS1KPEFrWYPIZPJzZRbkrqpnYqmg9Y3xhFlKmSHNclwqV76ijHtml4R4NekNkV9K23bJZrM3/S4bF58n8PDKXChsJQ19/5pVazDKMjZGUQ9MPqUKRbKle9R9C4LicoeQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719082572; c=relaxed/simple; bh=vpk7UNWgldwZgXa7roenR8DrYgm95bICO/yrWNHd12g=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=d/zbVfvi9MVbvUKaBgRBxv1FEcuDzuuEJmRglHxx9r73PDDG04SMm+5+WbK5G2dVPvU/pDtd8OIfPytJYE92gkx06IyYvdCz/eaAwL5tYqrEdPRZrWCBCuT3YqMiHtjHdcZRTtDVK6fSyZGdUPjrYCdqLvZww/9dw7oinKrAefg= 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=1719082571; x=1750618571; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vpk7UNWgldwZgXa7roenR8DrYgm95bICO/yrWNHd12g=; b=M+qxjwoB1HeZ2Be4HWQzpQ1vNVwJzicbL9964cAnyVA41TPxqWa82TU1 +fO5MbfryXK5ikybP9bceKSiPW6bp1Z8FFtP7DTUTlGn7a9FBJbVC5t++ AJqfPQ9Ju4zfJ33ZYY+iuq2ht0jXh/GhklKqE133B+N4GVnppxnS6VMFb YyqtdMgKgCDUBkCkU7ht+nLljYUvCQ8VE0iQBd+QTPf5PfzZkpfzmmxXv yLhRJutl26S4gLbSfsnqsid2vVF7WkKsaD4UBterGAs7RZrbVXEG6HL47 DVuZ+OPH5XYzDZxFDx9P3+2Faqb6A1z3v0CwMOMHT6ZnDBu2u3oHiJFgm A==; X-CSE-ConnectionGUID: vstb998uTf6ZCJ6tkaRjxw== X-CSE-MsgGUID: 611D/JkqSaCv/ND8ElL/bw== X-IronPort-AV: E=McAfee;i="6700,10204,11111"; a="16216439" X-IronPort-AV: E=Sophos;i="6.08,258,1712646000"; d="scan'208";a="16216439" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2024 11:56:06 -0700 X-CSE-ConnectionGUID: Kn0DzYMoSCe9v2f3l1O3UQ== X-CSE-MsgGUID: l2Frvw24SyOZlzyBKgvLQg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,258,1712646000"; d="scan'208";a="42968333" Received: from tassilo.jf.intel.com ([10.54.38.190]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2024 11:56:05 -0700 From: Andi Kleen To: gcc-patches@gcc.gnu.org Cc: Andi Kleen Subject: [PATCH v8 03/12] Add a musttail generic attribute to the c-attribs table Date: Sat, 22 Jun 2024 11:54:35 -0700 Message-ID: <20240622185557.1589179-4-ak@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240622185557.1589179-1-ak@linux.intel.com> References: <20240622185557.1589179-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+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 48c89b603bcd..e84c9c47513b 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -1643,6 +1643,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);