aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/expr.cc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2025-12-06 11:07:18 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2025-12-06 11:07:18 +0100
commit3b7e865779d03b4d29375a3c28dfaa2172eced4a (patch)
tree62a63de076f76c6c7f9ee209e2cd586b850d85e9 /gcc/fortran/expr.cc
parent78c787bbe593b24d73dbcfe59b8f6103be1e798f (diff)
downloadgcc-3b7e865779d03b4d29375a3c28dfaa2172eced4a.zip
gcc-3b7e865779d03b4d29375a3c28dfaa2172eced4a.tar.gz
gcc-3b7e865779d03b4d29375a3c28dfaa2172eced4a.tar.bz2
c++: is_late_template_attribute and tsubst_attribute fixes
This has been discussed in the 1/9 Reflection thread, but doesn't depend on reglection in any way. cp_parser_std_attribute calls lookup_attribute_spec as: const attribute_spec *as = lookup_attribute_spec (TREE_PURPOSE (attribute)); so with TREE_LIST where TREE_VALUE is attribute name and TREE_PURPOSE attribute ns. Similarly c_parser_std_attribute. And for attribute_takes_identifier_p those do: else if (attr_ns == gnu_identifier && attribute_takes_identifier_p (attr_id)) and bool takes_identifier = (ns != NULL_TREE && strcmp (IDENTIFIER_POINTER (ns), "gnu") == 0 && attribute_takes_identifier_p (name)); when handling std attributes (for GNU attributes they just call those with the IDENTIFIER_NODE name. is_late_template_attribute and tsubst_attribute pass to these functions just get_attribute_name though, so handle attributes in all namespaces as GNU attributes only, which means that lookup_attribute_spec can return NULL or find a different attribute if it is not from gnu:: or say standard attribute mapped to gnu::, or attribute_takes_identifier_p can return true even for attributes for which it shouldn't. I thought about changing attribute_takes_identifier_p to take optionally TREE_LIST, but that would mean handling it in the target hooks too and they only care about GNU attributes right now, so given the above parser.cc/c-parser.cc snippets, the following patch just follow what they do. 2025-12-06 Jakub Jelinek <jakub@redhat.com> * decl2.cc (is_late_template_attribute): Call lookup_attribute_spec on TREE_PURPOSE (attr) rather than name. Only call attribute_takes_identifier_p if get_attribute_namespace (attr) is gnu_identifier. * pt.cc (tsubst_attribute): Only call attribute_takes_identifier_p if get_attribute_namespace (t) is gnu_identifier.
Diffstat (limited to 'gcc/fortran/expr.cc')
0 files changed, 0 insertions, 0 deletions