pub struct Attributes {Show 15 fields
pub noreturn: Option<SourceRange>,
pub always_inline: Option<SourceRange>,
pub noinline: Option<SourceRange>,
pub cold: Option<SourceRange>,
pub deprecated: Option<Spanned<Option<String>>>,
pub packed: Option<SourceRange>,
pub aligned: Option<Alignment>,
pub section: Option<Spanned<String>>,
pub target: Vec<Spanned<String>>,
pub constructor: Option<SourceRange>,
pub destructor: Option<SourceRange>,
pub cleanup: Option<Cleanup>,
pub mode: Option<Spanned<String>>,
pub safe: Option<SourceRange>,
pub weak: Option<SourceRange>,
}Expand description
What an attribute specifier sequence asked for.
Both spellings — GNU’s __attribute__((…)) and C23’s [[…]] — produce
this, because they say the same things. Everything the front end does not
act on is dropped while it is parsed, which C23 6.7.13.1p3 explicitly
allows and which GCC does with a warning this crate has no way to raise.
Fields§
§noreturn: Option<SourceRange>noreturn / [[noreturn]], which says exactly what _Noreturn says.
always_inline: Option<SourceRange>always_inline.
noinline: Option<SourceRange>noinline.
cold: Option<SourceRange>cold; hot clears it again, as GCC’s do.
deprecated: Option<Spanned<Option<String>>>deprecated, with the message it was given.
packed: Option<SourceRange>packed, on a record or on one member.
aligned: Option<Alignment>aligned(N), which is the same request _Alignas(N) makes.
section: Option<Spanned<String>>section("…").
target: Vec<Spanned<String>>target("avx2"), target("sse4.2,popcnt"), target("avx2", "fma"):
the instruction sets the function is compiled for, one entry per name,
in GCC’s spelling and with the range of the attribute that wrote it.
Also what #pragma GCC target leaves behind for the functions after
it; the parser puts the pragma’s list here when the declaration writes
no attribute of its own.
constructor: Option<SourceRange>constructor, whose priority is parsed and ignored.
destructor: Option<SourceRange>destructor, likewise.
cleanup: Option<Cleanup>cleanup(f), on a variable with automatic storage duration.
mode: Option<Spanned<String>>mode(M), which replaces the declared type with the one the machine
mode names, keeping its signedness.
safe: Option<SourceRange>[[cinrs::safe]] / __attribute__((cinrs_safe)): generate the function
without unsafe, so that rustc checks its body.
This crate’s own attribute rather than one of GCC’s, which is why it is spelled in this crate’s namespace both ways.
weak: Option<SourceRange>weak, which only sema can answer: it is refused on a definition and
accepted on a declaration.