* Additional Numeric Types:: Additional sizes and formats, plus complex numbers.
* Aggregate Types:: Extensions to arrays, structs, and unions.
* Named Address Spaces::Named address spaces.
-* Function Attributes:: Declaring that functions have no side effects,
- or that they can never return.
-* Variable Attributes:: Specifying attributes of variables.
-* Type Attributes:: Specifying attributes of types.
-* Label Attributes:: Specifying attributes on labels.
-* Enumerator Attributes:: Specifying attributes on enumerators.
-* Statement Attributes:: Specifying attributes on statements.
-* Attribute Syntax:: Formal syntax for attributes.
+* Attributes:: GCC supports both standard and legacy attribute syntax.
* Pragmas:: Pragmas accepted by GCC.
* Thread-Local:: Per-thread variables.
* OpenMP:: Multiprocessing extensions.
defined when these address spaces are supported.
@end table
+@node Attributes
+@section Attributes Specific to GCC
+@cindex attributes
+@cindex declaring attributes
+@cindex GNU attributes
+
+Attributes provide a mechanism to declare additional properties of
+functions, variables, types, and statements. For example, attributes
+can be used to control placement of objects in particular memory
+sections, or to specify properties that can allow the compiler to
+generate better code or diagnostics, such as declaring that a function
+never returns. GCC supports a large number of such attributes, which
+are documented in this section.
+
+GCC provides two different ways to specify attributes: the traditional
+GNU syntax using @samp{__attribute__ ((...))} annotations, and the
+newer standard C and C++ syntax using @samp{[[...]]} with the
+@samp{gnu::} namespace prefix on attribute names.
+The traditional syntax, described in detail in @ref{Attribute Syntax},
+is supported in all non-strict C and C++ language dialects.
+The standard syntax is supported in C with @option{-std=c23} or later,
+in C++ with @option{-std=c++11} or later, and as an extension in older
+GNU C and C++ dialects.
+
+@menu
+* Function Attributes:: Declaring that functions have no side effects,
+ or that they can never return.
+* Variable Attributes:: Specifying attributes of variables.
+* Type Attributes:: Specifying attributes of types.
+* Label Attributes:: Specifying attributes on labels.
+* Enumerator Attributes:: Specifying attributes on enumerators.
+* Statement Attributes:: Specifying attributes on statements.
+* Attribute Syntax:: Formal syntax for attributes.
+@end menu
+
@node Function Attributes
-@section Declaring Attributes of Functions
+@subsection Declaring Attributes of Functions
@cindex function attributes
@cindex declaring attributes of functions
@end menu
@node Common Function Attributes
-@subsection Common Function Attributes
+@subsubsection Common Function Attributes
The following attributes are supported on most targets.
@c This is the end of the target-independent attribute table
@node AArch64 Function Attributes
-@subsection AArch64 Function Attributes
+@subsubsection AArch64 Function Attributes
The following target-specific function attributes are available for the
AArch64 target. For the most part, these options mirror the behavior of
is valid and compiles function @code{foo} for ARMv8-A with @code{crc}
and @code{crypto} extensions and tunes it for @code{cortex-a53}.
-@subsubsection Inlining rules
+@subsubheading Inlining rules
Specifying target attributes on individual functions or performing link-time
optimization across translation units compiled with different target options
can affect function inlining rules:
architectural feature rules specified above.
@node AMD GCN Function Attributes
-@subsection AMD GCN Function Attributes
+@subsubsection AMD GCN Function Attributes
These function attributes are supported by the AMD GCN back end:
@end table
@node ARC Function Attributes
-@subsection ARC Function Attributes
+@subsubsection ARC Function Attributes
These function attributes are supported by the ARC back end:
@end table
@node ARM Function Attributes
-@subsection ARM Function Attributes
+@subsubsection ARM Function Attributes
These function attributes are supported for ARM targets:
@end table
@node AVR Function Attributes
-@subsection AVR Function Attributes
+@subsubsection AVR Function Attributes
These function attributes are supported by the AVR back end:
@end table
@node Blackfin Function Attributes
-@subsection Blackfin Function Attributes
+@subsubsection Blackfin Function Attributes
These function attributes are supported by the Blackfin back end:
@end table
@node BPF Function Attributes
-@subsection BPF Function Attributes
+@subsubsection BPF Function Attributes
These function attributes are supported by the BPF back end:
@end table
@node C-SKY Function Attributes
-@subsection C-SKY Function Attributes
+@subsubsection C-SKY Function Attributes
These function attributes are supported by the C-SKY back end:
@node Epiphany Function Attributes
-@subsection Epiphany Function Attributes
+@subsubsection Epiphany Function Attributes
These function attributes are supported by the Epiphany back end:
@node H8/300 Function Attributes
-@subsection H8/300 Function Attributes
+@subsubsection H8/300 Function Attributes
These function attributes are available for H8/300 targets:
@end table
@node IA-64 Function Attributes
-@subsection IA-64 Function Attributes
+@subsubsection IA-64 Function Attributes
These function attributes are supported on IA-64 targets:
@end table
@node LoongArch Function Attributes
-@subsection LoongArch Function Attributes
+@subsubsection LoongArch Function Attributes
These function attributes are supported by the LoongArch end:
@end table
@node M32C Function Attributes
-@subsection M32C Function Attributes
+@subsubsection M32C Function Attributes
These function attributes are supported by the M32C back end:
@end table
@node M32R/D Function Attributes
-@subsection M32R/D Function Attributes
+@subsubsection M32R/D Function Attributes
These function attributes are supported by the M32R/D back end:
@end table
@node m68k Function Attributes
-@subsection m68k Function Attributes
+@subsubsection m68k Function Attributes
These function attributes are supported by the m68k back end:
@end table
@node MCORE Function Attributes
-@subsection MCORE Function Attributes
+@subsubsection MCORE Function Attributes
These function attributes are supported by the MCORE back end:
@end table
@node MicroBlaze Function Attributes
-@subsection MicroBlaze Function Attributes
+@subsubsection MicroBlaze Function Attributes
These function attributes are supported on MicroBlaze targets:
@end table
@node Microsoft Windows Function Attributes
-@subsection Microsoft Windows Function Attributes
+@subsubsection Microsoft Windows Function Attributes
The following attributes are available on Microsoft Windows and Symbian OS
targets.
@end table
@node MIPS Function Attributes
-@subsection MIPS Function Attributes
+@subsubsection MIPS Function Attributes
These function attributes are supported by the MIPS back end:
@end table
@node MSP430 Function Attributes
-@subsection MSP430 Function Attributes
+@subsubsection MSP430 Function Attributes
These function attributes are supported by the MSP430 back end:
@end table
@node NDS32 Function Attributes
-@subsection NDS32 Function Attributes
+@subsubsection NDS32 Function Attributes
These function attributes are supported by the NDS32 back end:
@end table
@node Nvidia PTX Function Attributes
-@subsection Nvidia PTX Function Attributes
+@subsubsection Nvidia PTX Function Attributes
These function attributes are supported by the Nvidia PTX back end:
@end table
@node PowerPC Function Attributes
-@subsection PowerPC Function Attributes
+@subsubsection PowerPC Function Attributes
These function attributes are supported by the PowerPC back end:
@end table
@node RISC-V Function Attributes
-@subsection RISC-V Function Attributes
+@subsubsection RISC-V Function Attributes
These function attributes are supported by the RISC-V back end:
and @code{zbb} extensions and tunes it for @code{rocket}.
@node RL78 Function Attributes
-@subsection RL78 Function Attributes
+@subsubsection RL78 Function Attributes
These function attributes are supported by the RL78 back end:
@end table
@node RX Function Attributes
-@subsection RX Function Attributes
+@subsubsection RX Function Attributes
These function attributes are supported by the RX back end:
@end table
@node S/390 Function Attributes
-@subsection S/390 Function Attributes
+@subsubsection S/390 Function Attributes
These function attributes are supported on the S/390:
@end table
@node SH Function Attributes
-@subsection SH Function Attributes
+@subsubsection SH Function Attributes
These function attributes are supported on the SH family of processors:
@end table
@node Symbian OS Function Attributes
-@subsection Symbian OS Function Attributes
+@subsubsection Symbian OS Function Attributes
@xref{Microsoft Windows Function Attributes}, for discussion of the
@code{dllexport} and @code{dllimport} attributes.
@node V850 Function Attributes
-@subsection V850 Function Attributes
+@subsubsection V850 Function Attributes
The V850 back end supports these function attributes:
@end table
@node Visium Function Attributes
-@subsection Visium Function Attributes
+@subsubsection Visium Function Attributes
These function attributes are supported by the Visium back end:
@end table
@node x86 Function Attributes
-@subsection x86 Function Attributes
+@subsubsection x86 Function Attributes
These function attributes are supported by the x86 back end:
@end table
-@subsubsection Inlining rules
+@subsubheading Inlining rules
On the x86, the inliner does not inline a
function that has different target options than the caller, unless the
callee has a subset of the target options of the caller. For example
of ISA features and marked with always_inline.
@node Xstormy16 Function Attributes
-@subsection Xstormy16 Function Attributes
+@subsubsection Xstormy16 Function Attributes
These function attributes are supported by the Xstormy16 back end:
@end table
@node Variable Attributes
-@section Specifying Attributes of Variables
+@subsection Specifying Attributes of Variables
@cindex attribute of variables
@cindex variable attributes
@end menu
@node Common Variable Attributes
-@subsection Common Variable Attributes
+@subsubsection Common Variable Attributes
The following attributes are supported on most targets.
@end table
@node ARC Variable Attributes
-@subsection ARC Variable Attributes
+@subsubsection ARC Variable Attributes
@table @code
@cindex @code{aux} variable attribute, ARC
@end table
@node AVR Variable Attributes
-@subsection AVR Variable Attributes
+@subsubsection AVR Variable Attributes
@table @code
@cindex @code{progmem} variable attribute, AVR
@end table
@node Blackfin Variable Attributes
-@subsection Blackfin Variable Attributes
+@subsubsection Blackfin Variable Attributes
Three attributes are currently defined for the Blackfin.
@end table
@node H8/300 Variable Attributes
-@subsection H8/300 Variable Attributes
+@subsubsection H8/300 Variable Attributes
These variable attributes are available for H8/300 targets:
@end table
@node IA-64 Variable Attributes
-@subsection IA-64 Variable Attributes
+@subsubsection IA-64 Variable Attributes
The IA-64 back end supports the following variable attribute:
@end table
@node LoongArch Variable Attributes
-@subsection LoongArch Variable Attributes
+@subsubsection LoongArch Variable Attributes
One attribute is currently defined for the LoongArch.
@end table
@node M32R/D Variable Attributes
-@subsection M32R/D Variable Attributes
+@subsubsection M32R/D Variable Attributes
One attribute is currently defined for the M32R/D@.
@end table
@node Microsoft Windows Variable Attributes
-@subsection Microsoft Windows Variable Attributes
+@subsubsection Microsoft Windows Variable Attributes
You can use these attributes on Microsoft Windows targets.
@ref{x86 Variable Attributes} for additional Windows compatibility
@end table
@node MSP430 Variable Attributes
-@subsection MSP430 Variable Attributes
+@subsubsection MSP430 Variable Attributes
@table @code
@cindex @code{upper} variable attribute, MSP430
@end table
@node Nvidia PTX Variable Attributes
-@subsection Nvidia PTX Variable Attributes
+@subsubsection Nvidia PTX Variable Attributes
These variable attributes are supported by the Nvidia PTX back end:
@end table
@node PowerPC Variable Attributes
-@subsection PowerPC Variable Attributes
+@subsubsection PowerPC Variable Attributes
Three attributes currently are defined for PowerPC configurations:
@code{altivec}, @code{ms_struct} and @code{gcc_struct}.
documentation in @ref{PowerPC Type Attributes}.
@node RL78 Variable Attributes
-@subsection RL78 Variable Attributes
+@subsubsection RL78 Variable Attributes
@cindex @code{saddr} variable attribute, RL78
The RL78 back end supports the @code{saddr} variable attribute. This
which can be accessed more efficiently than the default memory region.
@node V850 Variable Attributes
-@subsection V850 Variable Attributes
+@subsubsection V850 Variable Attributes
These variable attributes are supported by the V850 back end:
@end table
@node x86 Variable Attributes
-@subsection x86 Variable Attributes
+@subsubsection x86 Variable Attributes
Two attributes are currently defined for x86 configurations:
@code{ms_struct} and @code{gcc_struct}.
@end table
@node Xstormy16 Variable Attributes
-@subsection Xstormy16 Variable Attributes
+@subsubsection Xstormy16 Variable Attributes
One attribute is currently defined for xstormy16 configurations:
@code{below100}.
@end table
@node Type Attributes
-@section Specifying Attributes of Types
+@subsection Specifying Attributes of Types
@cindex attribute of types
@cindex type attributes
@end menu
@node Common Type Attributes
-@subsection Common Type Attributes
+@subsubsection Common Type Attributes
The following type attributes are supported on most targets.
packed))}.
@node ARC Type Attributes
-@subsection ARC Type Attributes
+@subsubsection ARC Type Attributes
@cindex @code{uncached} type attribute, ARC
Declaring objects with @code{uncached} allows you to exclude
loads and stores of data declared @code{uncached}.
@node ARM Type Attributes
-@subsection ARM Type Attributes
+@subsubsection ARM Type Attributes
@cindex @code{notshared} type attribute, ARM
On those ARM targets that support @code{dllimport} (such as Symbian
most Symbian OS code uses @code{__declspec}.)
@node BPF Type Attributes
-@subsection BPF Type Attributes
+@subsubsection BPF Type Attributes
@cindex @code{preserve_access_index} type attribute, BPF
BPF Compile Once - Run Everywhere (CO-RE) support. When attached to a
@node PowerPC Type Attributes
-@subsection PowerPC Type Attributes
+@subsubsection PowerPC Type Attributes
Three attributes currently are defined for PowerPC configurations:
@code{altivec}, @code{ms_struct} and @code{gcc_struct}.
@code{__pixel}, and @code{__bool} AltiVec keywords.
@node x86 Type Attributes
-@subsection x86 Type Attributes
+@subsubsection x86 Type Attributes
Two attributes are currently defined for x86 configurations:
@code{ms_struct} and @code{gcc_struct}.
@end table
@node Label Attributes
-@section Label Attributes
+@subsection Label Attributes
@cindex Label Attributes
GCC allows attributes to be set on C labels. @xref{Attribute Syntax}, for
@end table
@node Enumerator Attributes
-@section Enumerator Attributes
+@subsection Enumerator Attributes
@cindex Enumerator Attributes
GCC allows attributes to be set on enumerators. @xref{Attribute Syntax}, for
@end table
@node Statement Attributes
-@section Statement Attributes
+@subsection Statement Attributes
@cindex Statement Attributes
GCC allows attributes to be set on statements. @xref{Attribute Syntax},
@end table
@node Attribute Syntax
-@section Attribute Syntax
+@subsection Attribute Syntax
@cindex attribute syntax
@cindex C standard attributes
@cindex C++ standard attributes