public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 3/3] attribs: Namespace-aware lookup_attribute_spec
@ 2023-11-06 12:24 Richard Sandiford
  2023-11-10 20:27 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2023-11-06 12:24 UTC (permalink / raw)
  To: gcc-patches

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 3/3] attribs: Namespace-aware lookup_attribute_spec
  2023-11-06 12:24 [PATCH 3/3] attribs: Namespace-aware lookup_attribute_spec Richard Sandiford
@ 2023-11-10 20:27 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2023-11-10 20:27 UTC (permalink / raw)
  To: gcc-patches, richard.sandiford



On 11/6/23 05:24, Richard Sandiford wrote:
> 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.
OK
jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-10 20:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-06 12:24 [PATCH 3/3] attribs: Namespace-aware lookup_attribute_spec Richard Sandiford
2023-11-10 20:27 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).