[PATCH] D148700: [clang] Add support for “regular” keyword attributes

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 6 16:31:24 PDT 2023


rsmith added a comment.

In D148700#4401353 <https://reviews.llvm.org/D148700#4401353>, @jyknight wrote:

> Yes, standard attributes aren't supposed to be used for things which affect the type system (although, we certainly have many, already, which do, since we expose most GCC-syntax attributes also as C++-standard attribute syntax!)

The rule that standard attributes don't affect semantics only applies to attributes specified by the language standard. There is no expectation that vendor attributes avoid such effects. In particular, I'm concerned by this in the description of this change:

In D148700 <https://reviews.llvm.org/D148700>, @rsandifo-arm wrote:

> Really, the “only” thing wrong with using standard attributes is that standard attributes cannot affect semantics.

If the only reason for this patch series is an idea that vendor attributes using `[[...]]` syntax can't affect program semantics, then I think this change is not justified, because vendor attributes using `[[...]]` syntax can and usually do affect program semantics. But the documentation change here makes the point that using a keyword attribute may be as good idea in cases where you would always want compilation to fail on a compiler that doesn't understand the annotation, rather than the annotation being ignored (likely with a warning), so maybe that's reasonable justification for this direction.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148700/new/

https://reviews.llvm.org/D148700



More information about the cfe-commits mailing list