On Mon, Feb 12, 2024 at 01:15:55PM -0500, Marek Polacek wrote:
> On Mon, Feb 12, 2024 at 06:30:55PM +0100, Jakub Jelinek wrote:
> > 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.
> > 
> > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> 
> Looks fine.  extract_attribute_substring was added in
> https://gcc.gnu.org/pipermail/gcc-patches/2007-July/221563.html
> but with no tests.  I see that without it gcc.dg/attr-noinline.c
> was failing, but that hasn't been the case for many years now.  So
> I don't know why it would be necessary to keep it.

I think it was added far before Martin's changes to canonicalize attributes
in r8-2418.  At that point attributes in the attributes lists weren't
canonicalized, so it was necessary to canonicalize them before or during
the lookups.

        Jakub

Reply via email to