libstdc++: Document P1642 and extensions
libstdc++-v3/ChangeLog: * doc/xml/manual/using.xml: Document newly-freestanding headers and the effect of the -ffreestanding flag. * doc/xml/manual/status_cxx2023.xml: Document P1642R11 as completed. * doc/xml/manual/configure.xml: Document that hosted installs respect __STDC_HOSTED__. * doc/xml/manual/test.xml: Document how to run tests in freestanding mode. * doc/html/*: Regenerate.
This commit is contained in:
parent
17d0892d61
commit
9f4baed6ac
13 changed files with 152 additions and 22 deletions
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The GNU C++ Library</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><meta name="description" content="Short Contents Copyright (C) 2008-2022 FSF Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. This is the top level of the libstdc++ documentation set. The documentation is divided into the following three sections. Manual Frequently Asked Questions API and Source Documentation" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="index.html" title="The GNU C++ Library" /><link rel="next" href="manual/index.html" title="The GNU C++ Library Manual" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">The GNU C++ Library</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="manual/index.html">Next</a></td></tr></table><hr /></div><div class="set" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="set-index"></a>The GNU C++ Library</h1></div><div><div class="abstract"><a id="contents"></a><p class="title"><strong>Short Contents</strong></p><p>
|
||||
Copyright (C) 2008-2022
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The GNU C++ Library</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><meta name="description" content="Short Contents Copyright (C) 2008-2023 FSF Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. This is the top level of the libstdc++ documentation set. The documentation is divided into the following three sections. Manual Frequently Asked Questions API and Source Documentation" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="index.html" title="The GNU C++ Library" /><link rel="next" href="manual/index.html" title="The GNU C++ Library Manual" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">The GNU C++ Library</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="manual/index.html">Next</a></td></tr></table><hr /></div><div class="set" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="set-index"></a>The GNU C++ Library</h1></div><div><div class="abstract"><a id="contents"></a><p class="title"><strong>Short Contents</strong></p><p>
|
||||
Copyright (C) 2008-2023
|
||||
<a class="link" href="https://www.fsf.org" target="_top">FSF
|
||||
</a>
|
||||
</p><p>
|
||||
|
|
|
@ -219,7 +219,10 @@
|
|||
built. The C++ Standard also describes a
|
||||
<span class="emphasis"><em>freestanding</em></span> environment, in which only a
|
||||
minimal set of headers are provided. This option builds such an
|
||||
environment.
|
||||
environment. Note that a hosted library installs headers that still can
|
||||
be used in non hosted environments, as the library checks for
|
||||
<code class="code">__STDC_HOSTED__</code>, however, a library configured with
|
||||
<code class="code">--disable-hosted-libstdcxx</code> will not install unusable headers.
|
||||
</p></dd><dt><span class="term"><code class="code">--disable-libstdcxx-hosted</code></span></dt><dd><p>This is an alias for <code class="code">--disable-hosted-libstdcxx</code>.</p></dd><dt><span class="term"><code class="code">--disable-libstdcxx-verbose</code></span></dt><dd><p>
|
||||
By default, the library is configured to write descriptive messages
|
||||
to standard error for certain events such as calling a pure virtual
|
||||
|
|
|
@ -560,4 +560,4 @@ make <code class="literal">XSL_STYLE_DIR="/usr/share/xml/docbook/stylesheet/nwal
|
|||
</td></tr></tbody></table></div></div><br class="table-break" /></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="appendix_porting.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="appendix_porting.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="internals.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Appendix B.
|
||||
Porting and Maintenance
|
||||
|
||||
</td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Porting to New Hardware or Operating Systems</td></tr></table></div></body></html>
|
||||
</td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Porting to New Hardware or Operating Systems</td></tr></table></div></body></html>
|
|
@ -644,4 +644,4 @@ be private.
|
|||
</a>
|
||||
</em>. </span><span class="subtitle">
|
||||
N2461
|
||||
. </span></p></div></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="pairs.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="utilities.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="traits.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Pairs </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Traits</td></tr></table></div></body></html>
|
||||
. </span></p></div></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="pairs.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="utilities.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="traits.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Pairs </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Traits</td></tr></table></div></body></html>
|
|
@ -1297,4 +1297,4 @@
|
|||
Wickland
|
||||
</span>. </span><span class="publisher"><span class="publishername">
|
||||
National Psychological Institute
|
||||
. </span></span></p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bitmap_allocator_impl.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="extensions.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="policy_data_structures_using.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Implementation </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Using</td></tr></table></div></body></html>
|
||||
. </span></span></p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bitmap_allocator_impl.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="extensions.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="policy_data_structures_using.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Implementation </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Using</td></tr></table></div></body></html>
|
|
@ -1916,7 +1916,11 @@ or any notes about the implementation.
|
|||
<a class="link" href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2186r2.html" target="_top">
|
||||
P2186R2
|
||||
</a>
|
||||
</td><td align="center"> 12.1 </td><td align="left"> </td></tr></tbody></table></div></div><br class="table-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="status.iso.tr1"></a>C++ TR1</h3></div></div></div><p>
|
||||
</td><td align="center"> 12.1 </td><td align="left"> </td></tr><tr><td align="left"> Easy [utilities], [ranges], and [iterators] </td><td align="left">
|
||||
<a class="link" href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1642r11.html" target="_top">
|
||||
P1642R11
|
||||
</a>
|
||||
</td><td align="center"> 13.1 </td><td align="left"> </td></tr></tbody></table></div></div><br class="table-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="status.iso.tr1"></a>C++ TR1</h3></div></div></div><p>
|
||||
This table is based on the table of contents of ISO/IEC DTR 19768,
|
||||
Doc No: N1836=05-0096, Date: 2005-06-24,
|
||||
"Draft Technical Report on C++ Library Extensions".
|
||||
|
|
|
@ -203,6 +203,18 @@ cat 27_io/objects/char/3_xin.in | a.out</pre></dd><dt><span class="term"><code c
|
|||
</p><pre class="programlisting">
|
||||
make check-target-libstdc++-v3 RUNTESTFLAGS='--target_board \"unix{-mabi=32,,-mabi=64}\"'
|
||||
</pre><p>
|
||||
</p><p>
|
||||
If you wish to run the testsuite in a freestanding configuration, you can
|
||||
pass the <code class="code">-ffreestanding</code> flag. Doing so will run the tests
|
||||
that do not require hosted features, and emit a
|
||||
<code class="literal">UNSUPPORTED</code> for those that do. To run tests in the
|
||||
freestanding configuration, you still need to build for a target you can
|
||||
run programs on, e.g. <code class="code">x86_64-pc-linux-gnu</code>, as a few tests
|
||||
still execute the code they build. Here's an example of how to run the
|
||||
testsuite with libstdc++ in freestanding mode:
|
||||
</p><pre class="programlisting">
|
||||
make check-target-libstdc++-v3 RUNTESTFLAGS='--target_board=unix/-ffreestanding'
|
||||
</pre><p>
|
||||
</p><p>
|
||||
You can run the tests with a compiler and library that have
|
||||
already been installed. Make sure that the compiler (e.g.,
|
||||
|
|
|
@ -40,4 +40,10 @@
|
|||
</td></tr><tr><td align="left"><code class="literal">-fopenmp</code></td><td align="left">For <a class="link" href="parallel_mode.html" title="Chapter 18. Parallel Mode">parallel</a> mode.</td></tr><tr><td align="left"><code class="literal">-ltbb</code></td><td align="left">Linking to tbb (Thread Building Blocks) is required for use of the
|
||||
Parallel Standard Algorithms and execution policies in
|
||||
<code class="filename"><execution></code>.
|
||||
</td></tr><tr><td align="left"><code class="literal">-ffreestanding</code></td><td align="left">
|
||||
Limits the library to its freestanding subset. Headers that are
|
||||
not supported in freestanding will emit a "This header is not available
|
||||
in freestanding mode" error.
|
||||
Headers that are in the freestanding subset partially will not expose
|
||||
functionality that is not part of the freestanding subset.
|
||||
</td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="make.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="intro.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="using_headers.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Make </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Headers</td></tr></table></div></body></html>
|
|
@ -30,15 +30,40 @@
|
|||
<code class="filename">initializer_list</code>
|
||||
</p></li><li class="listitem"><p>
|
||||
<code class="filename">type_traits</code>
|
||||
</p></li></ul></div><p> There exists a library that offers runtime support for
|
||||
just these headers, and it is called
|
||||
<code class="filename">libsupc++.a</code>. To use it, compile with <span class="command"><strong>gcc</strong></span> instead of <span class="command"><strong>g++</strong></span>, like so:
|
||||
</p></li></ul></div><p>
|
||||
As of GCC 13, libstdc++ implements P1642, which brings in many more
|
||||
headers, as well a quite a few ones not covered by the paper.
|
||||
|
||||
In general, if a feature does not require traditionally libc-provided
|
||||
facilities, or dynamic memory allocation, it's enabled in the
|
||||
freestanding subset. In addition, if only a subset of a header
|
||||
requires such features, it is partially included. Some examples
|
||||
include:
|
||||
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
|
||||
<code class="filename">string_view</code>
|
||||
</p></li><li class="listitem"><p>
|
||||
<code class="filename">tuple</code>
|
||||
</p></li><li class="listitem"><p>
|
||||
<code class="filename">bitset</code>
|
||||
</p></li></ul></div><p>
|
||||
Currently, this subset includes all of the iterator APIs (including the
|
||||
ranges APIs) that do not involve streams, the entire C++ algorithms
|
||||
library, excluding parallel algorithms, and a large part of the
|
||||
utilities library. This is on top of the headers included in the lists
|
||||
above.
|
||||
</p><p>
|
||||
<span class="command"><strong>gcc foo.cc -lsupc++</strong></span>
|
||||
If you're using a libstdc++ configured for hosted environments, and
|
||||
would like to not involve the libraries libstdc++ would depend on in
|
||||
your programs, you will need to use <span class="command"><strong>gcc</strong></span> to link your
|
||||
application with only <code class="filename">libsupc++.a</code>,
|
||||
like so:
|
||||
</p><p>
|
||||
No attempt is made to verify that only the minimal subset
|
||||
identified above is actually used at compile time. Violations
|
||||
are diagnosed as undefined symbols at link time.
|
||||
<span class="command"><strong>gcc -ffreestanding foo.cc -lsupc++</strong></span>
|
||||
</p><p>
|
||||
If you configured libstdc++ with
|
||||
<code class="code">--disable-hosted-libstdcxx</code>, however, you can use the
|
||||
normal <span class="command"><strong>g++</strong></span> command to link, as this configuration
|
||||
provides a (nearly) empty <code class="filename">libstdc++.a</code>.
|
||||
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.linkage.dynamic"></a>Finding Dynamic or Shared Libraries</h3></div></div></div><p>
|
||||
If the only library built is the static library
|
||||
(<code class="filename">libstdc++.a</code>), or if
|
||||
|
|
|
@ -362,7 +362,10 @@
|
|||
built. The C++ Standard also describes a
|
||||
<emphasis>freestanding</emphasis> environment, in which only a
|
||||
minimal set of headers are provided. This option builds such an
|
||||
environment.
|
||||
environment. Note that a hosted library installs headers that still can
|
||||
be used in non hosted environments, as the library checks for
|
||||
<code>__STDC_HOSTED__</code>, however, a library configured with
|
||||
<code>--disable-hosted-libstdcxx</code> will not install unusable headers.
|
||||
</para>
|
||||
</listitem></varlistentry>
|
||||
|
||||
|
|
|
@ -566,6 +566,17 @@ or any notes about the implementation.
|
|||
<entry />
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry> Easy [utilities], [ranges], and [iterators] </entry>
|
||||
<entry>
|
||||
<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1642r11.html">
|
||||
P1642R11
|
||||
</link>
|
||||
</entry>
|
||||
<entry align="center"> 13.1 </entry>
|
||||
<entry />
|
||||
</row>
|
||||
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
|
|
@ -350,6 +350,20 @@ cat 27_io/objects/char/3_xin.in | a.out</programlisting>
|
|||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If you wish to run the testsuite in a freestanding configuration, you can
|
||||
pass the <code>-ffreestanding</code> flag. Doing so will run the tests
|
||||
that do not require hosted features, and emit a
|
||||
<literal>UNSUPPORTED</literal> for those that do. To run tests in the
|
||||
freestanding configuration, you still need to build for a target you can
|
||||
run programs on, e.g. <code>x86_64-pc-linux-gnu</code>, as a few tests
|
||||
still execute the code they build. Here's an example of how to run the
|
||||
testsuite with libstdc++ in freestanding mode:
|
||||
<programlisting>
|
||||
make check-target-libstdc++-v3 RUNTESTFLAGS='--target_board=unix/-ffreestanding'
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You can run the tests with a compiler and library that have
|
||||
already been installed. Make sure that the compiler (e.g.,
|
||||
|
|
|
@ -132,6 +132,17 @@
|
|||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><literal>-ffreestanding</literal></entry>
|
||||
<entry>
|
||||
Limits the library to its freestanding subset. Headers that are
|
||||
not supported in freestanding will emit a "This header is not available
|
||||
in freestanding mode" error.
|
||||
Headers that are in the freestanding subset partially will not expose
|
||||
functionality that is not part of the freestanding subset.
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
</tbody>
|
||||
|
||||
</tgroup>
|
||||
|
@ -1523,19 +1534,60 @@ namespace gtk
|
|||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<para> There exists a library that offers runtime support for
|
||||
just these headers, and it is called
|
||||
<filename class="libraryfile">libsupc++.a</filename>. To use it, compile with <command>gcc</command> instead of <command>g++</command>, like so:
|
||||
<para>
|
||||
As of GCC 13, libstdc++ implements P1642, which brings in many more
|
||||
headers, as well a quite a few ones not covered by the paper.
|
||||
|
||||
In general, if a feature does not require traditionally libc-provided
|
||||
facilities, or dynamic memory allocation, it's enabled in the
|
||||
freestanding subset. In addition, if only a subset of a header
|
||||
requires such features, it is partially included. Some examples
|
||||
include:
|
||||
</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<filename class="headerfile">string_view</filename>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<filename class="headerfile">tuple</filename>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<filename class="headerfile">bitset</filename>
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<para>
|
||||
Currently, this subset includes all of the iterator APIs (including the
|
||||
ranges APIs) that do not involve streams, the entire C++ algorithms
|
||||
library, excluding parallel algorithms, and a large part of the
|
||||
utilities library. This is on top of the headers included in the lists
|
||||
above.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<command>gcc foo.cc -lsupc++</command>
|
||||
If you're using a libstdc++ configured for hosted environments, and
|
||||
would like to not involve the libraries libstdc++ would depend on in
|
||||
your programs, you will need to use <command>gcc</command> to link your
|
||||
application with only <filename class="libraryfile">libsupc++.a</filename>,
|
||||
like so:
|
||||
</para>
|
||||
|
||||
<para>
|
||||
No attempt is made to verify that only the minimal subset
|
||||
identified above is actually used at compile time. Violations
|
||||
are diagnosed as undefined symbols at link time.
|
||||
<command>gcc -ffreestanding foo.cc -lsupc++</command>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If you configured libstdc++ with
|
||||
<code>--disable-hosted-libstdcxx</code>, however, you can use the
|
||||
normal <command>g++</command> command to link, as this configuration
|
||||
provides a (nearly) empty <filename class="libraryfile">libstdc++.a</filename>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue