From patchwork Mon Nov 6 12:23:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1860142 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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 4SP9WG1YmVz1yQL for ; Mon, 6 Nov 2023 23:23:50 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 771F1385DC1D for ; Mon, 6 Nov 2023 12:23:48 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 243043858C2B for ; Mon, 6 Nov 2023 12:23:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 243043858C2B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 243043858C2B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699273419; cv=none; b=sUNlnBhVJdd3m0ckBUMVuduL1lvfED0Gb+v/bEhe0VU9dui3Mel7kQteQOe0l39PhbZz8bIsz+5GIg3ZxtUl2kySkUvj2z5g4YQ6Puax2lmkrrC5Vv7RumNj55YQSc0A1hhFoI4sq0Lf7hgn78S1YFYfRsMMt7e9oqmZDOL4zRc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699273419; c=relaxed/simple; bh=LK/m6I/irTWmnUChnRip9VuWTngyGZv+nelYD4XN5NQ=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=hF/EQOHtde5rWMczL2Ife2GgoDJKp4KjmmRMHjHNMibjKhyF3VPyx1Ndv7a6QLhAJWSQMOy+qm4xoYP4hJ4IYeV2tEV2ZVB/JAVFoNpqGmaZU7tECoJoDfJFaN8e8JCBK+a4W7KGIYO8P5GCZeolOjKaO4t1U+i+eNr9+5IqcrY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B958C1FB for ; Mon, 6 Nov 2023 04:24:20 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3681E3F64C for ; Mon, 6 Nov 2023 04:23:36 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [PATCH 1/3] attribs: Cache the gnu namespace Date: Mon, 06 Nov 2023 12:23:34 +0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Spam-Status: No, score=-23.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, 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 Later patches add more calls to get_attribute_namespace. For scoped attributes, this is a simple operation on tree pointers. But for normal GNU attributes (the vast majority), it involves a call to get_identifier ("gnu"). This patch caches the identifier for speed. Admittedly I'm just going off gut instinct here. I'm happy to drop the patch if this doesn't seem worth a new GC root. Tested on aarch64-linux-gnu & x86_64-linux-gnu. OK to install? Richard gcc/ * Makefile.in (GTFILES): Add attribs.cc. * attribs.cc (gnu_namespace_cache): New variable. (get_gnu_namespace): New function. (lookup_attribute_spec): Use it instead of get_identifier ("gnu"). (get_attribute_namespace, attribs_cc_tests): Likewise. --- gcc/Makefile.in | 3 ++- gcc/attribs.cc | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 29cec21c825..a128ff76c07 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2812,7 +2812,8 @@ GTFILES = $(CPPLIB_H) $(srcdir)/input.h $(srcdir)/coretypes.h \ $(srcdir)/symtab-thunks.h $(srcdir)/symtab-thunks.cc \ $(srcdir)/symtab-clones.h \ $(srcdir)/reload.h $(srcdir)/caller-save.cc $(srcdir)/symtab.cc \ - $(srcdir)/alias.cc $(srcdir)/bitmap.cc $(srcdir)/cselib.cc $(srcdir)/cgraph.cc \ + $(srcdir)/alias.cc $(srcdir)/attribs.cc \ + $(srcdir)/bitmap.cc $(srcdir)/cselib.cc $(srcdir)/cgraph.cc \ $(srcdir)/ipa-prop.cc $(srcdir)/ipa-cp.cc $(srcdir)/ipa-utils.h \ $(srcdir)/ipa-param-manipulation.h $(srcdir)/ipa-sra.cc \ $(srcdir)/ipa-modref.h $(srcdir)/ipa-modref.cc \ diff --git a/gcc/attribs.cc b/gcc/attribs.cc index 6725fe78f2c..6c70110e350 100644 --- a/gcc/attribs.cc +++ b/gcc/attribs.cc @@ -102,6 +102,19 @@ static const struct attribute_spec *lookup_scoped_attribute_spec (const_tree, static bool attributes_initialized = false; +/* Do not use directly; go through get_gnu_namespace instead. */ +static GTY(()) tree gnu_namespace_cache; + +/* Return the IDENTIFIER_NODE for the gnu namespace. */ + +static tree +get_gnu_namespace () +{ + if (!gnu_namespace_cache) + gnu_namespace_cache = get_identifier ("gnu"); + return gnu_namespace_cache; +} + /* Return base name of the attribute. Ie '__attr__' is turned into 'attr'. To avoid need for copying, we simply return length of the string. */ @@ -403,7 +416,7 @@ lookup_attribute_spec (const_tree name) name = TREE_VALUE (name); } else - ns = get_identifier ("gnu"); + ns = get_gnu_namespace (); return lookup_scoped_attribute_spec (ns, name); } @@ -420,7 +433,7 @@ get_attribute_namespace (const_tree attr) { if (cxx11_attribute_p (attr)) return TREE_PURPOSE (TREE_PURPOSE (attr)); - return get_identifier ("gnu"); + return get_gnu_namespace (); } /* Check LAST_DECL and NODE of the same symbol for attributes that are @@ -2689,3 +2702,5 @@ attribs_cc_tests () } /* namespace selftest */ #endif /* CHECKING_P */ + +#include "gt-attribs.h" From patchwork Mon Nov 6 12:24:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1860143 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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 4SP9Wy1TyZz1yQL for ; Mon, 6 Nov 2023 23:24:30 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5F83D3857803 for ; Mon, 6 Nov 2023 12:24:27 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 8E4863858C2B for ; Mon, 6 Nov 2023 12:24:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8E4863858C2B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8E4863858C2B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699273456; cv=none; b=Zhzw9tislhlhC+GQSZ1OcaZEo21qXcZSnVMmyWGSAGFfGNxpeg9UtH/MAd/VeWOyf6W7AvUALCj3i0Z7mguEUqp5EWLoK5/Tko2iEig4lZyMfuDUJi3kiJMaJePQK/WRhgrPQZfzemgLYkiEW0AckUva6h/VMYu7WYIaCJ7JAKg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699273456; c=relaxed/simple; bh=OEP0LMsyCEn5Ttswglqd1WTZhfHOMEcer6l5QujkgCk=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=F2K7RqryhIzYI4szbksNYdN8kASdr0JNfQOSjikBxDXi0+/n3d0ySodqEE140BTCZOIrxAn8jFYyiWXbAfnMyPOrPU8kHUI99qVsrLDOYhzgBiqHohziNLclAezDBORqUwXU2UQTsBy0JI6D6lUy0UJO553ZwFUdZyv0j/l54AM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5D5511FB for ; Mon, 6 Nov 2023 04:24:59 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D1EC63F64C for ; Mon, 6 Nov 2023 04:24:14 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [PATCH 2/3] attribs: Consider namespaces when comparing attributes Date: Mon, 06 Nov 2023 12:24:13 +0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Spam-Status: No, score=-23.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, 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 decl_attributes and comp_type_attributes both had code that iterated over one list of attributes and looked for coresponding attributes in another list. This patch makes those lookups namespace-aware. Tested on aarch64-linux-gnu & x86_64-linux-gnu. OK to install? Richard gcc/ * attribs.cc (find_same_attribute): New function. (decl_attributes, comp_type_attributes): Use it when looking up one list's attributes in another list. --- gcc/attribs.cc | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/gcc/attribs.cc b/gcc/attribs.cc index 6c70110e350..c23ed3bac91 100644 --- a/gcc/attribs.cc +++ b/gcc/attribs.cc @@ -583,6 +583,23 @@ attribute_ignored_p (const attribute_spec *const as) return as->max_length == -2; } +/* See whether LIST contains at least one instance of attribute ATTR + (possibly with different arguments). Return the first such attribute + if so, otherwise return null. */ + +static tree +find_same_attribute (const_tree attr, tree list) +{ + if (list == NULL_TREE) + return NULL_TREE; + tree ns = get_attribute_namespace (attr); + tree name = get_attribute_name (attr); + return private_lookup_attribute (ns ? IDENTIFIER_POINTER (ns) : nullptr, + IDENTIFIER_POINTER (name), + ns ? IDENTIFIER_LENGTH (ns) : 0, + IDENTIFIER_LENGTH (name), list); +} + /* Process the attributes listed in ATTRIBUTES and install them in *NODE, which is either a DECL (including a TYPE_DECL) or a TYPE. If a DECL, it should be modified in place; if a TYPE, a copy should be created @@ -912,9 +929,9 @@ decl_attributes (tree *node, tree attributes, int flags, else old_attrs = TYPE_ATTRIBUTES (*anode); - for (a = lookup_attribute (spec->name, old_attrs); + for (a = find_same_attribute (attr, old_attrs); a != NULL_TREE; - a = lookup_attribute (spec->name, TREE_CHAIN (a))) + a = find_same_attribute (attr, TREE_CHAIN (a))) { if (simple_cst_equal (TREE_VALUE (a), args) == 1) break; @@ -945,8 +962,8 @@ decl_attributes (tree *node, tree attributes, int flags, if (TYPE_ATTRIBUTES (variant) == old_attrs) TYPE_ATTRIBUTES (variant) = TYPE_ATTRIBUTES (*anode); - else if (!lookup_attribute - (spec->name, TYPE_ATTRIBUTES (variant))) + else if (!find_same_attribute + (attr, TYPE_ATTRIBUTES (variant))) TYPE_ATTRIBUTES (variant) = tree_cons (name, args, TYPE_ATTRIBUTES (variant)); } @@ -1459,7 +1476,7 @@ comp_type_attributes (const_tree type1, const_tree type2) if (!as || as->affects_type_identity == false) continue; - attr = lookup_attribute (as->name, CONST_CAST_TREE (a2)); + attr = find_same_attribute (a, CONST_CAST_TREE (a2)); if (!attr || !attribute_value_equal (a, attr)) break; } @@ -1473,7 +1490,7 @@ comp_type_attributes (const_tree type1, const_tree type2) if (!as || as->affects_type_identity == false) continue; - if (!lookup_attribute (as->name, CONST_CAST_TREE (a1))) + if (!find_same_attribute (a, CONST_CAST_TREE (a1))) break; /* We don't need to compare trees again, as we did this already in first loop. */ From patchwork Mon Nov 6 12:24:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1860144 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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 4SP9XQ0YZHz1yQL for ; Mon, 6 Nov 2023 23:24:54 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 708DD3861813 for ; Mon, 6 Nov 2023 12:24:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 2329D3861841 for ; Mon, 6 Nov 2023 12:24:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2329D3861841 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2329D3861841 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699273481; cv=none; b=gtiaPy0WClt+3oDexeZdmXw1AN/2RbTY6xdeIPikzS+F3ZVi4EM1GuOqjM8BUd411eXX796UsCx5b5wROU0yruYVvRYIM+xpTGOvxtIUi3IUMPztgMb4rdsdccswPanS3TN1DmNetWPFTNBKWZlxEfdWMo27JNik8xPWpmwEXaQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699273481; c=relaxed/simple; bh=oLjLO9gNlObwdXFMqex6/+u5E0+5F71VgOj8G0mSITo=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=ApHbQgV8vujtbfGiPXaL5AOzaKa9ZgVnHk5ep03I8e6CSqQCmGgzVNqpPMqid8vksfKGNyFx8hUz85bDYY7nMqwCL3LbnrdfYs9VoZB4SABAkC+EmqQynF2L5iQLNJhuBL/CH+I3RbldVP11rtiRCd8wzUMcXx5QxNoy7InUhSk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DD56D1FB for ; Mon, 6 Nov 2023 04:25:23 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5DC323F64C for ; Mon, 6 Nov 2023 04:24:39 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [PATCH 3/3] attribs: Namespace-aware lookup_attribute_spec Date: Mon, 06 Nov 2023 12:24:38 +0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Spam-Status: No, score=-23.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, 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 attribute_ignored_p already used a namespace-aware query to find the attribute_spec for an existing attribute: const attribute_spec *as = lookup_attribute_spec (TREE_PURPOSE (attr)); This patch does the same for other callers in the file. Tested on aarch64-linux-gnu & x86_64-linux-gnu. OK to install? Richard gcc/ * attribs.cc (comp_type_attributes): Pass the full TREE_PURPOSE to lookup_attribute_spec, rather than just the name. (remove_attributes_matching): Likewise. --- gcc/attribs.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gcc/attribs.cc b/gcc/attribs.cc index c23ed3bac91..a2935b8101f 100644 --- a/gcc/attribs.cc +++ b/gcc/attribs.cc @@ -1472,7 +1472,7 @@ comp_type_attributes (const_tree type1, const_tree type2) const struct attribute_spec *as; const_tree attr; - as = lookup_attribute_spec (get_attribute_name (a)); + as = lookup_attribute_spec (TREE_PURPOSE (a)); if (!as || as->affects_type_identity == false) continue; @@ -1486,7 +1486,7 @@ comp_type_attributes (const_tree type1, const_tree type2) { const struct attribute_spec *as; - as = lookup_attribute_spec (get_attribute_name (a)); + as = lookup_attribute_spec (TREE_PURPOSE (a)); if (!as || as->affects_type_identity == false) continue; @@ -1528,8 +1528,7 @@ remove_attributes_matching (tree attrs, Predicate predicate) const_tree start = attrs; for (const_tree attr = attrs; attr; attr = TREE_CHAIN (attr)) { - tree name = get_attribute_name (attr); - const attribute_spec *as = lookup_attribute_spec (name); + const attribute_spec *as = lookup_attribute_spec (TREE_PURPOSE (attr)); const_tree end; if (!predicate (attr, as)) end = attr;