From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Content-Type: text/plain 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 List-Id: 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; -- 2.25.1