public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@linux.intel.com>
To: Joseph Myers <josmyers@redhat.com>
Cc: gcc-patches@gnu.org
Subject: Re: [PATCH v2 3/5] C: Implement musttail attribute for returns
Date: Thu, 25 Jan 2024 12:39:32 -0800	[thread overview]
Message-ID: <ZbLHBInXf9fyYQtG@tassilo> (raw)
In-Reply-To: <f40b091-237c-d646-39a8-c332405f36aa@redhat.com>

On Thu, Jan 25, 2024 at 08:08:23PM +0000, Joseph Myers wrote:
> On Wed, 24 Jan 2024, Andi Kleen wrote:
> 
> > Implement a C23 clang compatible musttail attribute similar to the earlier
> > C++ implementation in the C parser.
> 
> I'd expect diagnostics, and associated tests of those diagnostics, for:
> 
> * musttail attribute used with any arguments, even empty 
> [[gnu::musttail()]], much like e.g. [[fallthrough()]] or 
> [[maybe_unused()]] gets diagnosed.

These happen naturally because the attribute doesn't get removed when
not in front of return, and it gets warned about like any other unknown attribute:

tattr.c:5:9: warning: ‘musttail’ attribute ignored [-Wattributes]
    5 |         [[gnu::musttail]] i++;
          |         ^

I don't have tests for that but since it's not new behavior I suppose
that's sufficient.


> For the first one of these, it may help to include the attribute in the 
> c_common_gnu_attributes table so the common attribute parsing code knows 
> that this one doesn't accept arguments (and with an attribute handler that 
> always rejects it on declarations, much like 
> handle_fallthrough_attribute).

I just removed it there based on earlier feedback, which gives the
intended "attribute is ignored" warning for these cases too.

-Andi

  reply	other threads:[~2024-01-25 20:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24 19:30 Andi Kleen
2024-01-24 19:30 ` [PATCH v2 1/5] Improve must tail in RTL backend Andi Kleen
2024-01-24 19:30 ` [PATCH v2 2/5] C++: Support clang compatible [[musttail]] (PR83324) Andi Kleen
2024-01-24 19:30 ` [PATCH v2 3/5] C: Implement musttail attribute for returns Andi Kleen
2024-01-25 20:08   ` Joseph Myers
2024-01-25 20:39     ` Andi Kleen [this message]
2024-01-26  8:48       ` Joseph Myers
2024-01-26  9:13         ` Andi Kleen
2024-01-26  9:35           ` Joseph Myers
2024-01-24 19:30 ` [PATCH v2 4/5] Add tests for C/C++ musttail attributes Andi Kleen
2024-01-24 19:30 ` [PATCH v2 5/5] Add documentation for musttail attribute Andi Kleen
2024-01-25  6:51   ` rep.dot.nop
2024-01-25  8:48     ` Andi Kleen

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=ZbLHBInXf9fyYQtG@tassilo \
    --to=ak@linux.intel.com \
    --cc=gcc-patches@gnu.org \
    --cc=josmyers@redhat.com \
    /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).