]> git.ipfire.org Git - thirdparty/gcc.git/commit
attribs: Don't canonicalize lookup_scoped_attribute_spec argument [PR113674]
authorJakub Jelinek <jakub@redhat.com>
Mon, 12 Feb 2024 19:45:01 +0000 (20:45 +0100)
committerJakub Jelinek <jakub@redhat.com>
Mon, 12 Feb 2024 19:45:01 +0000 (20:45 +0100)
commitb42e978f29b33071addff6d7bb8bcdb11d176606
treef2023a9d7643e9f3a81f68d23a22cd61fc15b696
parentf3306a9455f4d2556ba941e5783c94d4bede3b58
attribs: Don't canonicalize lookup_scoped_attribute_spec argument [PR113674]

The C and C++ FEs when parsing attributes already canonicalize them
(i.e. if they start with __ and end with __ substrings, we remove those).
lookup_attribute already verifies in gcc_assert that the first character
of name is not an underscore, and even lookup_scoped_attribute_spec doesn't
attempt to canonicalize the namespace it is passed.  But for some historic
reason it was canonicalizing the name argument, which misbehaves when
an attribute starts with ____ and ends with ____.
I believe it is just wrong to try to canonicalize
lookup_scope_attribute_spec name attribute, it should have been
canonicalized already, in other spots where it is called it is already
canonicalized before.

2024-02-12  Jakub Jelinek  <jakub@redhat.com>

PR c++/113674
* attribs.cc (extract_attribute_substring): Remove.
(lookup_scoped_attribute_spec): Don't call it.

* c-c++-common/Wattributes-3.c: New test.
gcc/attribs.cc
gcc/testsuite/c-c++-common/Wattributes-3.c [new file with mode: 0644]