diff options
author | alk3pInjection <webmaster@raspii.tech> | 2024-02-04 16:16:35 +0800 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2024-02-04 16:16:35 +0800 |
commit | abdaadbcae30fe0c9a66c7516798279fdfd97750 (patch) | |
tree | 00a54a6e25601e43876d03c1a4a12a749d4a914c /share/doc/gcc/C_002b_002b-Attributes.html |
https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
Change-Id: I7303388733328cd98ab9aa3c30236db67f2e9e9c
Diffstat (limited to 'share/doc/gcc/C_002b_002b-Attributes.html')
-rw-r--r-- | share/doc/gcc/C_002b_002b-Attributes.html | 182 |
1 files changed, 182 insertions, 0 deletions
diff --git a/share/doc/gcc/C_002b_002b-Attributes.html b/share/doc/gcc/C_002b_002b-Attributes.html new file mode 100644 index 0000000..d332dc8 --- /dev/null +++ b/share/doc/gcc/C_002b_002b-Attributes.html @@ -0,0 +1,182 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<!-- This file documents the use of the GNU compilers. + +Copyright (C) 1988-2023 Free Software Foundation, Inc. + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.3 or +any later version published by the Free Software Foundation; with the +Invariant Sections being "Funding Free Software", the Front-Cover +Texts being (a) (see below), and with the Back-Cover Texts being (b) +(see below). A copy of the license is included in the section entitled +"GNU Free Documentation License". + +(a) The FSF's Front-Cover Text is: + +A GNU Manual + +(b) The FSF's Back-Cover Text is: + +You have freedom to copy and modify this GNU Manual, like GNU + software. Copies published by the Free Software Foundation raise + funds for GNU development. --> +<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ --> +<head> +<title>Using the GNU Compiler Collection (GCC): C++ Attributes</title> + +<meta name="description" content="Using the GNU Compiler Collection (GCC): C++ Attributes"> +<meta name="keywords" content="Using the GNU Compiler Collection (GCC): C++ Attributes"> +<meta name="resource-type" content="document"> +<meta name="distribution" content="global"> +<meta name="Generator" content="makeinfo"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<link href="index.html#Top" rel="start" title="Top"> +<link href="Indices.html#Indices" rel="index" title="Indices"> +<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> +<link href="C_002b_002b-Extensions.html#C_002b_002b-Extensions" rel="up" title="C++ Extensions"> +<link href="Function-Multiversioning.html#Function-Multiversioning" rel="next" title="Function Multiversioning"> +<link href="Bound-member-functions.html#Bound-member-functions" rel="previous" title="Bound member functions"> +<style type="text/css"> +<!-- +a.summary-letter {text-decoration: none} +blockquote.smallquotation {font-size: smaller} +div.display {margin-left: 3.2em} +div.example {margin-left: 3.2em} +div.indentedblock {margin-left: 3.2em} +div.lisp {margin-left: 3.2em} +div.smalldisplay {margin-left: 3.2em} +div.smallexample {margin-left: 3.2em} +div.smallindentedblock {margin-left: 3.2em; font-size: smaller} +div.smalllisp {margin-left: 3.2em} +kbd {font-style:oblique} +pre.display {font-family: inherit} +pre.format {font-family: inherit} +pre.menu-comment {font-family: serif} +pre.menu-preformatted {font-family: serif} +pre.smalldisplay {font-family: inherit; font-size: smaller} +pre.smallexample {font-size: smaller} +pre.smallformat {font-family: inherit; font-size: smaller} +pre.smalllisp {font-size: smaller} +span.nocodebreak {white-space:nowrap} +span.nolinebreak {white-space:nowrap} +span.roman {font-family:serif; font-weight:normal} +span.sansserif {font-family:sans-serif; font-weight:normal} +ul.no-bullet {list-style: none} +--> +</style> + + +</head> + +<body lang="en_US" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> +<a name="C_002b_002b-Attributes"></a> +<div class="header"> +<p> +Next: <a href="Function-Multiversioning.html#Function-Multiversioning" accesskey="n" rel="next">Function Multiversioning</a>, Previous: <a href="Bound-member-functions.html#Bound-member-functions" accesskey="p" rel="previous">Bound member functions</a>, Up: <a href="C_002b_002b-Extensions.html#C_002b_002b-Extensions" accesskey="u" rel="up">C++ Extensions</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p> +</div> +<hr> +<a name="C_002b_002b_002dSpecific-Variable_002c-Function_002c-and-Type-Attributes"></a> +<h3 class="section">7.7 C++-Specific Variable, Function, and Type Attributes</h3> + +<p>Some attributes only make sense for C++ programs. +</p> +<dl compact="compact"> +<dd><a name="index-abi_005ftag-function-attribute"></a> +<a name="index-abi_005ftag-variable-attribute"></a> +<a name="index-abi_005ftag-type-attribute"></a> +</dd> +<dt><code>abi_tag ("<var>tag</var>", ...)</code></dt> +<dd><p>The <code>abi_tag</code> attribute can be applied to a function, variable, or class +declaration. It modifies the mangled name of the entity to +incorporate the tag name, in order to distinguish the function or +class from an earlier version with a different ABI; perhaps the class +has changed size, or the function has a different return type that is +not encoded in the mangled name. +</p> +<p>The attribute can also be applied to an inline namespace, but does not +affect the mangled name of the namespace; in this case it is only used +for <samp>-Wabi-tag</samp> warnings and automatic tagging of functions and +variables. Tagging inline namespaces is generally preferable to +tagging individual declarations, but the latter is sometimes +necessary, such as when only certain members of a class need to be +tagged. +</p> +<p>The argument can be a list of strings of arbitrary length. The +strings are sorted on output, so the order of the list is +unimportant. +</p> +<p>A redeclaration of an entity must not add new ABI tags, +since doing so would change the mangled name. +</p> +<p>The ABI tags apply to a name, so all instantiations and +specializations of a template have the same tags. The attribute will +be ignored if applied to an explicit specialization or instantiation. +</p> +<p>The <samp>-Wabi-tag</samp> flag enables a warning about a class which does +not have all the ABI tags used by its subobjects and virtual functions; for users with code +that needs to coexist with an earlier ABI, using this option can help +to find all affected types that need to be tagged. +</p> +<p>When a type involving an ABI tag is used as the type of a variable or +return type of a function where that tag is not already present in the +signature of the function, the tag is automatically applied to the +variable or function. <samp>-Wabi-tag</samp> also warns about this +situation; this warning can be avoided by explicitly tagging the +variable or function or moving it into a tagged inline namespace. +</p> +<a name="index-init_005fpriority-variable-attribute"></a> +</dd> +<dt><code>init_priority (<var>priority</var>)</code></dt> +<dd> +<p>In Standard C++, objects defined at namespace scope are guaranteed to be +initialized in an order in strict accordance with that of their definitions +<em>in a given translation unit</em>. No guarantee is made for initializations +across translation units. However, GNU C++ allows users to control the +order of initialization of objects defined at namespace scope with the +<code>init_priority</code> attribute by specifying a relative <var>priority</var>, +a constant integral expression currently bounded between 101 and 65535 +inclusive. Lower numbers indicate a higher priority. +</p> +<p>In the following example, <code>A</code> would normally be created before +<code>B</code>, but the <code>init_priority</code> attribute reverses that order: +</p> +<div class="smallexample"> +<pre class="smallexample">Some_Class A __attribute__ ((init_priority (2000))); +Some_Class B __attribute__ ((init_priority (543))); +</pre></div> + +<p>Note that the particular values of <var>priority</var> do not matter; only their +relative ordering. +</p> +<a name="index-warn_005funused-type-attribute"></a> +</dd> +<dt><code>warn_unused</code></dt> +<dd> +<p>For C++ types with non-trivial constructors and/or destructors it is +impossible for the compiler to determine whether a variable of this +type is truly unused if it is not referenced. This type attribute +informs the compiler that variables of this type should be warned +about if they appear to be unused, just like variables of fundamental +types. +</p> +<p>This attribute is appropriate for types which just represent a value, +such as <code>std::string</code>; it is not appropriate for types which +control a resource, such as <code>std::lock_guard</code>. +</p> +<p>This attribute is also accepted in C, but it is unnecessary because C +does not have constructors or destructors. +</p> +</dd> +</dl> + +<hr> +<div class="header"> +<p> +Next: <a href="Function-Multiversioning.html#Function-Multiversioning" accesskey="n" rel="next">Function Multiversioning</a>, Previous: <a href="Bound-member-functions.html#Bound-member-functions" accesskey="p" rel="previous">Bound member functions</a>, Up: <a href="C_002b_002b-Extensions.html#C_002b_002b-Extensions" accesskey="u" rel="up">C++ Extensions</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p> +</div> + + + +</body> +</html> |