summaryrefslogtreecommitdiff
path: root/devdocs/gcc~13/enumerator-attributes.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/gcc~13/enumerator-attributes.html
new repository
Diffstat (limited to 'devdocs/gcc~13/enumerator-attributes.html')
-rw-r--r--devdocs/gcc~13/enumerator-attributes.html22
1 files changed, 22 insertions, 0 deletions
diff --git a/devdocs/gcc~13/enumerator-attributes.html b/devdocs/gcc~13/enumerator-attributes.html
new file mode 100644
index 00000000..647c8f8d
--- /dev/null
+++ b/devdocs/gcc~13/enumerator-attributes.html
@@ -0,0 +1,22 @@
+<div class="section-level-extent" id="Enumerator-Attributes"> <div class="nav-panel"> <p> Next: <a href="statement-attributes" accesskey="n" rel="next">Statement Attributes</a>, Previous: <a href="label-attributes" accesskey="p" rel="prev">Label Attributes</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Enumerator-Attributes-1"><span>6.37 Enumerator Attributes<a class="copiable-link" href="#Enumerator-Attributes-1"> ¶</a></span></h1> <p>GCC allows attributes to be set on enumerators. See <a class="xref" href="attribute-syntax">Attribute Syntax</a>, for details of the exact syntax for using attributes. Other attributes are available for functions (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>), variables (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>), labels (see <a class="pxref" href="label-attributes">Label Attributes</a>), statements (see <a class="pxref" href="statement-attributes">Statement Attributes</a>), and for types (see <a class="pxref" href="type-attributes">Specifying Attributes of Types</a>). </p> <p>This example uses the <code class="code">deprecated</code> enumerator attribute to indicate the <code class="code">oldval</code> enumerator is deprecated: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">enum E {
+ oldval __attribute__((deprecated)),
+ newval
+};
+
+int
+fn (void)
+{
+ return oldval;
+}</pre>
+</div> <dl class="table"> <dt>
+<span><code class="code">deprecated</code><a class="copiable-link" href="#index-deprecated-enumerator-attribute"> ¶</a></span>
+</dt> <dd>
+<p>The <code class="code">deprecated</code> attribute results in a warning if the enumerator is used anywhere in the source file. This is useful when identifying enumerators that are expected to be removed in a future version of a program. The warning also includes the location of the declaration of the deprecated enumerator, to enable users to easily find further information about why the enumerator is deprecated, or what they should do instead. Note that the warnings only occurs for uses. </p> </dd> <dt>
+<span><code class="code">unavailable</code><a class="copiable-link" href="#index-unavailable-enumerator-attribute"> ¶</a></span>
+</dt> <dd>
+<p>The <code class="code">unavailable</code> attribute results in an error if the enumerator is used anywhere in the source file. In other respects it behaves in the same manner as the <code class="code">deprecated</code> attribute. </p> </dd> </dl> </div><div class="_attribution">
+ <p class="_attribution-p">
+ &copy; Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br>
+ <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Enumerator-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Enumerator-Attributes.html</a>
+ </p>
+</div>