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: 161994 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp2617331vqu; Mon, 6 Nov 2023 04:25:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IGAggsqeFzX4wopth5SsqeXm5ZJmg0esIV3aNzZUgQs4wY2PfWIsG++nB8ThWUO7WfO4Jdg X-Received: by 2002:a67:b044:0:b0:45a:98d9:38ea with SMTP id q4-20020a67b044000000b0045a98d938eamr18044467vsh.16.1699273503420; Mon, 06 Nov 2023 04:25:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699273503; cv=pass; d=google.com; s=arc-20160816; b=WM9J529BwvvUPyZVzJjJMVehuNo0Euj6bW+/S0U64Jjj1O9Bk7aNQ4SCnbLAjbcGiD OaqrYjFL6rcb6aHWPyKwblPM5w77npgeG4xZApfezAejuAPfhCnZcQ1/kh2DpLkhZxFp VMlQFLsaarELFuvYtpkO/zWmAuKG/OwOQY2KGHgLC02TM6jnlvKP8YizKVJFPZDIBpIh TcaH3cFKNd/pVFHhs1/+u7zXfx9gi9P7Ih+aAK8JAgn5s0x1dThC5Z3zn/Hfa8JJaUTa Lv3NJ+HMmXU7nv0FdZS6glebyMIJzGnl5pGM1b5cv4rdIlgtLeVa9UksycyELrO72C5c P6jw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:user-agent :message-id:date:subject:mail-followup-to:to:from:arc-filter :dmarc-filter:delivered-to; bh=nHIWNttQlx4gwJ/MTU4NlDDgZO27BPtmcpUjMZSWtMI=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=BSVO7mlm87v5Ir1I14E0W2BilIZ3DDy4V74jLe0WPtH44KK6C0j+6oP764ZDtffmmq PwZqidicsxdP7tFfeFxgTXb/cULZou9wxVxYydc5MUcLAHSiEuDnNIk5v6b4bXCaO/jv oKTzkr5evun5Odo5VvX+ZZYt1dQmlmfuGuoyVgvlCqOtOUxVEA2HkXYWscgPBCQvAf9r BnunDfyZm7bZzT6BxZmVi3eYiWQ/FHI8NqsFAPxJ4uP+Dl296OF2SF1H8o1yjHbXFZr/ 3/FlZyxwZMl0uJIgPdOMFzT95R4hBKMM55Eo46JH+0ymG1w8/zv3xx+xG6YbVdBweh3C WndA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id u41-20020a05622a19a900b004195cf296d2si5448229qtc.239.2023.11.06.04.25.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 04:25:03 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 336DD3856DE7 for ; Mon, 6 Nov 2023 12:25:03 +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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781817413010202859 X-GMAIL-MSGID: 1781817413010202859 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;