On Thu Jul 16, 2026 at 4:03 PM CEST, Jakub Jelinek wrote:
> On Thu, Jul 16, 2026 at 03:48:44PM +0200, Richard Biener wrote:
>> > +/* Attribute table for the callback attribute to be used by the C
>> > frontends.
>> > + We don't want to expose the attribute outside of the GNU namespace, so
>> > it
>> > + has to be separated out. */
>> > +const struct attribute_spec c_common_callback_attribute[] = {
>> > + { CALLBACK_ATTR_IDENT, 1, -1, true, false, false, false,
>> > + handle_callback_attribute, NULL },
>> > +};
>> > +
>> > +const struct scoped_attribute_specs c_common_callback_attribute_table
>> > + = { "gnu", { c_common_callback_attribute } };
>
> I don't really like this.
> Why can't __attribute__((callback_only (...))) be supported? I thought
> the LLVM attribute is callback, not callback_only.
That's what was agreed upon on last year's Cauldron, to further
emphasize that the attributes are not mutually compatible. Though maybe
the docs are enough?
>
> Furthermore, even if you want to reject __attribute__((callback_only (...)))
> and only allow [[gnu::callback_only (...)]]], then having a separate
> scoped_attribute_specs is not the right way to do that.
> In the handler you should instead check if if (flags & ATTR_FLAG_CXX11)
> (if so, it is the gnu::callback_only form, otherwise perhaps warn or
> error).
I'll do that instead then, thanks.
Best regards,
Josef
>
> Jakub