summaryrefslogtreecommitdiff
path: root/devdocs/gcc~13/weak-pragmas.html
blob: 04a9c8657517203f3b0edb1b8e4c52bd8cce754f (plain)
1
2
3
4
5
6
7
8
9
<div class="subsection-level-extent" id="Weak-Pragmas"> <div class="nav-panel"> <p> Next: <a href="diagnostic-pragmas" accesskey="n" rel="next">Diagnostic Pragmas</a>, Previous: <a href="structure-layout-pragmas" accesskey="p" rel="prev">Structure-Layout Pragmas</a>, Up: <a href="pragmas" accesskey="u" rel="up">Pragmas Accepted by GCC</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="subsection" id="Weak-Pragmas-1"><span>6.62.11 Weak Pragmas<a class="copiable-link" href="#Weak-Pragmas-1"> ¶</a></span></h1> <p>For compatibility with SVR4, GCC supports a set of <code class="code">#pragma</code> directives for declaring symbols to be weak, and defining weak aliases. </p> <dl class="table"> <dt>
<span><code class="code">#pragma weak <var class="var">symbol</var></code><a class="copiable-link" href="#index-pragma_002c-weak"> ¶</a></span>
</dt> <dd>
<p>This pragma declares <var class="var">symbol</var> to be weak, as if the declaration had the attribute of the same name. The pragma may appear before or after the declaration of <var class="var">symbol</var>. It is not an error for <var class="var">symbol</var> to never be defined at all. </p> </dd> <dt><code class="code">#pragma weak <var class="var">symbol1</var> = <var class="var">symbol2</var></code></dt> <dd><p>This pragma declares <var class="var">symbol1</var> to be a weak alias of <var class="var">symbol2</var>. It is an error if <var class="var">symbol2</var> is not defined in the current translation unit. </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/Weak-Pragmas.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Weak-Pragmas.html</a>
  </p>
</div>