https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116130

--- Comment #10 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 30 Jul 2024, jakub at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116130
> 
> --- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> (In reply to rguent...@suse.de from comment #8)
> > IMO this asks for metadata on each (standard) attribute whether it
> > merges conservatively by union or by intersection since there are
> > two classes of attributes.
> 
> Well, doing so would violate the standard, which added a clear:
> "If one of the types has a standard attribute, the composite type also has 
> that
> attribute."

We do violate the standard in other places - IMO QOI/safety should be
a priority.  I view the above as a defect.

I'd at least emit an unconditional diagnostic when doing this kind
of merging in any place (also for GCC type/decl attributes).

> > And then there's things like [[gnu::warn_unused_result]] where
> > it's not at all clear what is "conservative" (drop valid diagnostics
> > or introduce broken ones?).
> 
> gnu::warn_unused_result is not a standard attribute (but currently we merge 
> all
> of them), but more importantly it isn't a function type attribute, but 
> function
> decl attribute.  Those aren't merged.

Huh, that's an odd distinction.  I hope we document this somewhere
in a way understandable by users since IIRC it's not possible to
distinguish those syntactically when placed in a function declaration?

Reply via email to