On Fri, 3 Jun 2022, Marek Polacek via Gcc-patches wrote:

> However, the patch does not touch the C FE.  The C FE doesn't have
> a counterpart to C++'s cp_parser_attributes_opt -- it only has
> c_parser_transaction_attributes (which parses both GNU and [[]]
> attributes), but that's TM-specific.  The C FE seems to use either
> c_parser_gnu_attributes or c_parser_std_attribute_specifier_sequence.
> As a consequence, this works:
> 
>   [[maybe_unused]] __attribute__((deprecated)) void f2 ();
> 
> but this doesn't:
> 
>   __attribute__((deprecated)) [[maybe_unused]] void f1 ();
> 
> I'm not sure what, if anything, should be done about this.

In many places, both GNU and [[]] attributes are valid, but appertain to 
different entities, so it would be hard to define semantics for mixing 
them.  At the start of a declaration like that, for example, GNU 
attributes can be mixed arbitrarily among the declaration specifiers (and 
appertain to the declaration) - but [[]] attributes can appear only before 
the declaration specifiers (appertaining to the declaration) or after them 
(appertaining to the type determined by those declaration specifiers), not 
in the middle.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to