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 via email to