Next: Alignment, Previous: Type Attributes, Up: C Extensions
The keyword __attribute__
allows you to specify special
attributes of labels and statements.
Some attributes are currently defined generically for variables. Other attributes are defined for variables on particular target systems. Other attributes are available for functions (see Function Attributes), types (see Type Attributes) and variables (see Variable Attributes).
You may also specify attributes with `__' preceding and following
each keyword. This allows you to use them in header files without
being concerned about a possible macro of the same name. For example,
you may use __aligned__
instead of aligned
.
See Attribute Syntax, for details of the exact syntax for using attributes.
aligned (
alignment)
some_label: __attribute__((aligned(16)))
requests the compiler to align the label, inserting nop
s as necessary,
to a 16-byte boundary.
The alignment is only a request. The compiler will usually be able to honour it but sometimes the label will be eliminated by the compiler, in which case its alignment will be eliminated too.
When applied to loops, the aligned
attribute causes the loop to
be aligned.
unused
#ifdef
conditional.
This attribute can only be applied to labels, not statements, because there is no warning if a statement is removed.