From: Jakub Jelinek <jakub@redhat.com>
To: "Martin Liška" <mliska@suse.cz>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] c: support attribs starting with '_'
Date: Wed, 5 Oct 2022 14:01:08 +0200 [thread overview]
Message-ID: <Yz1yBO/ug9ADbUB3@tucnak> (raw)
In-Reply-To: <eea8eca0-6b5d-c5fa-e5bd-aa5409bd78c6@suse.cz>
On Wed, Oct 05, 2022 at 01:49:40PM +0200, Martin Liška wrote:
> PR c/107156
>
> gcc/ChangeLog:
>
> * attribs.h (lookup_attribute_by_prefix): Support attributes
> starting with underscore (like _noreturn, or __Noreturn).
There are no _noreturn or __Noreturn attributes, there is just
_Noreturn.
And, the assert is useful to catch that non-canonicalized attributes
don't make it into the attribute lists.
Now that we have the first attribute that starts with an underscore
in canonicalized form (do we accept ___Noreturn__ attribute too, perhaps
we shouldn't?), I'd say instead of removing the assert it should verify
gcc_checking_assert (attr_len == 0 || p[0] != '_'
|| (ident_len > 1 && p[1] != '_'));
?
> ---
> gcc/attribs.h | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/gcc/attribs.h b/gcc/attribs.h
> index b2836560fc2..706d35e63d8 100644
> --- a/gcc/attribs.h
> +++ b/gcc/attribs.h
> @@ -274,8 +274,6 @@ lookup_attribute_by_prefix (const char *attr_name, tree list)
> }
>
> const char *p = IDENTIFIER_POINTER (name);
> - gcc_checking_assert (attr_len == 0 || p[0] != '_');
> -
> if (strncmp (attr_name, p, attr_len) == 0)
> break;
>
> --
> 2.37.3
Jakub
next prev parent reply other threads:[~2022-10-05 12:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-05 11:42 Martin Liška
2022-10-05 11:48 ` Andreas Schwab
2022-10-05 11:49 ` Martin Liška
2022-10-05 12:01 ` Jakub Jelinek [this message]
2022-10-05 12:52 ` Martin Liška
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yz1yBO/ug9ADbUB3@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=mliska@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).