xref: /openbsd-src/gnu/llvm/libcxx/docs/index.rst (revision 4bdff4bed0e3d54e55670334c7d0077db4170f86)
146035553Spatrick.. _index:
246035553Spatrick
346035553Spatrick=============================
446035553Spatrick"libc++" C++ Standard Library
546035553Spatrick=============================
646035553Spatrick
746035553SpatrickOverview
846035553Spatrick========
946035553Spatrick
1046035553Spatricklibc++ is a new implementation of the C++ standard library, targeting C++11 and
1146035553Spatrickabove.
1246035553Spatrick
1346035553Spatrick* Features and Goals
1446035553Spatrick
1546035553Spatrick  * Correctness as defined by the C++11 standard.
1646035553Spatrick  * Fast execution.
1746035553Spatrick  * Minimal memory use.
1846035553Spatrick  * Fast compile times.
1946035553Spatrick  * ABI compatibility with gcc's libstdc++ for some low-level features
2046035553Spatrick    such as exception objects, rtti and memory allocation.
2146035553Spatrick  * Extensive unit tests.
2246035553Spatrick
2346035553Spatrick* Design and Implementation:
2446035553Spatrick
2546035553Spatrick  * Extensive unit tests
2646035553Spatrick  * Internal linker model can be dumped/read to textual format
2746035553Spatrick  * Additional linking features can be plugged in as "passes"
2846035553Spatrick  * OS specific and CPU specific code factored out
2946035553Spatrick
3046035553Spatrick
3146035553SpatrickGetting Started with libc++
3276d0caaeSpatrick===========================
3346035553Spatrick
3446035553Spatrick.. toctree::
3576d0caaeSpatrick   :maxdepth: 1
3646035553Spatrick
3746035553Spatrick   ReleaseNotes
3846035553Spatrick   UsingLibcxx
3946035553Spatrick   BuildingLibcxx
4046035553Spatrick   TestingLibcxx
4176d0caaeSpatrick   Contributing
4276d0caaeSpatrick   Status/Cxx14
4376d0caaeSpatrick   Status/Cxx17
4476d0caaeSpatrick   Status/Cxx20
4576d0caaeSpatrick   Status/Cxx2b
4676d0caaeSpatrick   Status/Format
47*4bdff4beSrobert   Status/Ranges
48*4bdff4beSrobert   Status/Spaceship
49*4bdff4beSrobert   Status/Zip
5046035553Spatrick
5146035553Spatrick
5246035553Spatrick.. toctree::
5346035553Spatrick    :hidden:
5446035553Spatrick
5576d0caaeSpatrick    AddingNewCIJobs
5646035553Spatrick    FeatureTestMacroTable
5746035553Spatrick
5876d0caaeSpatrick
5946035553SpatrickCurrent Status
6076d0caaeSpatrick==============
6146035553Spatrick
6246035553SpatrickAfter its initial introduction, many people have asked "why start a new
6346035553Spatricklibrary instead of contributing to an existing library?" (like Apache's
6446035553Spatricklibstdcxx, GNU's libstdc++, STLport, etc).  There are many contributing
6546035553Spatrickreasons, but some of the major ones are:
6646035553Spatrick
6746035553Spatrick* From years of experience (including having implemented the standard
6846035553Spatrick  library before), we've learned many things about implementing
6946035553Spatrick  the standard containers which require ABI breakage and fundamental changes
7046035553Spatrick  to how they are implemented.  For example, it is generally accepted that
7146035553Spatrick  building std::string using the "short string optimization" instead of
7246035553Spatrick  using Copy On Write (COW) is a superior approach for multicore
7346035553Spatrick  machines (particularly in C++11, which has rvalue references).  Breaking
7446035553Spatrick  ABI compatibility with old versions of the library was
7546035553Spatrick  determined to be critical to achieving the performance goals of
7646035553Spatrick  libc++.
7746035553Spatrick
7846035553Spatrick* Mainline libstdc++ has switched to GPL3, a license which the developers
7946035553Spatrick  of libc++ cannot use.  libstdc++ 4.2 (the last GPL2 version) could be
8046035553Spatrick  independently extended to support C++11, but this would be a fork of the
8146035553Spatrick  codebase (which is often seen as worse for a project than starting a new
8246035553Spatrick  independent one).  Another problem with libstdc++ is that it is tightly
8346035553Spatrick  integrated with G++ development, tending to be tied fairly closely to the
8446035553Spatrick  matching version of G++.
8546035553Spatrick
8646035553Spatrick* STLport and the Apache libstdcxx library are two other popular
8746035553Spatrick  candidates, but both lack C++11 support.  Our experience (and the
8846035553Spatrick  experience of libstdc++ developers) is that adding support for C++11 (in
8946035553Spatrick  particular rvalue references and move-only types) requires changes to
9046035553Spatrick  almost every class and function, essentially amounting to a rewrite.
9146035553Spatrick  Faced with a rewrite, we decided to start from scratch and evaluate every
9246035553Spatrick  design decision from first principles based on experience.
9346035553Spatrick  Further, both projects are apparently abandoned: STLport 5.2.1 was
9446035553Spatrick  released in Oct'08, and STDCXX 4.2.1 in May'08.
9546035553Spatrick
96*4bdff4beSrobert.. _SupportedPlatforms:
9776d0caaeSpatrick
9846035553SpatrickPlatform and Compiler Support
9976d0caaeSpatrick=============================
10046035553Spatrick
10176d0caaeSpatrickLibc++ aims to support common compilers that implement the C++11 Standard. In order to strike a
10276d0caaeSpatrickgood balance between stability for users and maintenance cost, testing coverage and development
10376d0caaeSpatrickvelocity, libc++ drops support for older compilers as newer ones are released.
104037e7968Spatrick
10576d0caaeSpatrick============ =============== ========================== =====================
10676d0caaeSpatrickCompiler     Versions        Restrictions               Support policy
10776d0caaeSpatrick============ =============== ========================== =====================
108*4bdff4beSrobertClang        14, 15, 16-git                             latest two stable releases per `LLVM's release page <https://releases.llvm.org>`_ and the development version
109*4bdff4beSrobertAppleClang   14                                         latest stable release per `Xcode's release page <https://developer.apple.com/documentation/xcode-release-notes>`_
110*4bdff4beSrobertOpen XL      17.1 (AIX)                                 latest stable release per `Open XL's documentation page <https://www.ibm.com/docs/en/openxl-c-and-cpp-aix>`_
111*4bdff4beSrobertGCC          12              In C++11 or later only     latest stable release per `GCC's release page <https://gcc.gnu.org/releases.html>`_
11276d0caaeSpatrick============ =============== ========================== =====================
113037e7968Spatrick
11476d0caaeSpatrickLibc++ also supports common platforms and architectures:
11546035553Spatrick
11646035553Spatrick=============== ========================= ============================
11776d0caaeSpatrickTarget platform Target architecture       Notes
11846035553Spatrick=============== ========================= ============================
11976d0caaeSpatrickmacOS 10.9+     i386, x86_64, arm64       Building the shared library itself requires targetting macOS 10.11+
12076d0caaeSpatrickFreeBSD 10+     i386, x86_64, arm
12176d0caaeSpatrickLinux           i386, x86_64, arm, arm64
122*4bdff4beSrobertWindows         i386, x86_64              Both MSVC and MinGW style environments
123*4bdff4beSrobertAIX             powerpc, powerpc64
12446035553Spatrick=============== ========================= ============================
12546035553Spatrick
12676d0caaeSpatrickGenerally speaking, libc++ should work on any platform that provides a fairly complete
12776d0caaeSpatrickC Standard Library. It is also possible to turn off parts of the library for use on
12876d0caaeSpatricksystems that provide incomplete support.
12946035553Spatrick
13076d0caaeSpatrickHowever, libc++ aims to provide a high-quality implementation of the C++ Standard
13176d0caaeSpatrickLibrary, especially when it comes to correctness. As such, we aim to have test coverage
13276d0caaeSpatrickfor all the platforms and compilers that we claim to support. If a platform or compiler
13376d0caaeSpatrickis not listed here, it is not officially supported. It may happen to work, and
13476d0caaeSpatrickin practice the library is known to work on some platforms not listed here, but
13576d0caaeSpatrickwe don't make any guarantees. If you would like your compiler and/or platform
136*4bdff4beSrobertto be formally supported and listed here, please work with the libc++ team to set
137*4bdff4beSrobertup testing for your configuration.
13846035553Spatrick
13946035553Spatrick
14046035553SpatrickC++ Dialect Support
14176d0caaeSpatrick===================
14246035553Spatrick
14346035553Spatrick* C++11 - Complete
14476d0caaeSpatrick* :ref:`C++14 - Complete <cxx14-status>`
14576d0caaeSpatrick* :ref:`C++17 - In Progress <cxx17-status>`
14676d0caaeSpatrick* :ref:`C++20 - In Progress <cxx20-status>`
14776d0caaeSpatrick* :ref:`C++2b - In Progress <cxx2b-status>`
14846035553Spatrick* :ref:`C++ Feature Test Macro Status <feature-status>`
14946035553Spatrick
15076d0caaeSpatrick
15146035553SpatrickNotes and Known Issues
15276d0caaeSpatrick======================
15346035553Spatrick
15446035553SpatrickThis list contains known issues with libc++
15546035553Spatrick
15646035553Spatrick* Building libc++ with ``-fno-rtti`` is not supported. However
15746035553Spatrick  linking against it with ``-fno-rtti`` is supported.
15846035553Spatrick
15946035553Spatrick
16046035553SpatrickA full list of currently open libc++ bugs can be `found here`__.
16146035553Spatrick
162*4bdff4beSrobert.. __:  https://github.com/llvm/llvm-project/labels/libc%2B%2B
16346035553Spatrick
16476d0caaeSpatrick
16546035553SpatrickDesign Documents
16676d0caaeSpatrick================
16746035553Spatrick
16846035553Spatrick.. toctree::
16946035553Spatrick   :maxdepth: 1
17046035553Spatrick
17146035553Spatrick   DesignDocs/ABIVersioning
17276d0caaeSpatrick   DesignDocs/AtomicDesign
17376d0caaeSpatrick   DesignDocs/CapturingConfigInfo
17476d0caaeSpatrick   DesignDocs/DebugMode
17546035553Spatrick   DesignDocs/ExperimentalFeatures
17646035553Spatrick   DesignDocs/ExtendedCXX03Support
17776d0caaeSpatrick   DesignDocs/FeatureTestMacros
17876d0caaeSpatrick   DesignDocs/FileTimeType
179*4bdff4beSrobert   DesignDocs/HeaderRemovalPolicy
18076d0caaeSpatrick   DesignDocs/NoexceptPolicy
18176d0caaeSpatrick   DesignDocs/ThreadingSupportAPI
18276d0caaeSpatrick   DesignDocs/UniquePtrTrivialAbi
183*4bdff4beSrobert   DesignDocs/UnspecifiedBehaviorRandomization
18476d0caaeSpatrick   DesignDocs/VisibilityMacros
18546035553Spatrick
18646035553Spatrick
18746035553SpatrickBuild Bots and Test Coverage
18876d0caaeSpatrick============================
18946035553Spatrick
19076d0caaeSpatrick* `Buildkite CI pipeline <https://buildkite.com/llvm-project/libcxx-ci>`_
191*4bdff4beSrobert* `LLVM Buildbot Builders <https://lab.llvm.org/buildbot>`_
19276d0caaeSpatrick* :ref:`Adding New CI Jobs <AddingNewCIJobs>`
19376d0caaeSpatrick
19446035553Spatrick
19546035553SpatrickGetting Involved
19646035553Spatrick================
19746035553Spatrick
198037e7968SpatrickFirst please review our `Developer's Policy <https://llvm.org/docs/DeveloperPolicy.html>`__
199037e7968Spatrickand `Getting started with LLVM <https://llvm.org/docs/GettingStarted.html>`__.
20046035553Spatrick
20146035553Spatrick**Bug Reports**
20246035553Spatrick
20346035553SpatrickIf you think you've found a bug in libc++, please report it using
204*4bdff4beSrobertthe `LLVM bug tracker`_. If you're not sure, you
205*4bdff4beSrobertcan ask for support on the `libcxx forum`_ or on IRC.
20646035553Spatrick
20746035553Spatrick**Patches**
20846035553Spatrick
20946035553SpatrickIf you want to contribute a patch to libc++, the best place for that is
210037e7968Spatrick`Phabricator <https://llvm.org/docs/Phabricator.html>`_. Please add `libcxx-commits` as a subscriber.
211*4bdff4beSrobertAlso make sure you are subscribed to the `libcxx-commits mailing list`_.
21246035553Spatrick
21346035553Spatrick**Discussion and Questions**
21446035553Spatrick
215*4bdff4beSrobertSend discussions and questions to the `libcxx forum`_.
21646035553Spatrick
21746035553Spatrick
21846035553SpatrickQuick Links
21946035553Spatrick===========
220037e7968Spatrick* `LLVM Homepage <https://llvm.org/>`_
22146035553Spatrick* `libc++abi Homepage <http://libcxxabi.llvm.org/>`_
222*4bdff4beSrobert* `LLVM Bug Tracker <https://github.com/llvm/llvm-project/labels/libc++/>`_
223*4bdff4beSrobert* `libcxx-commits Mailing List <http://lists.llvm.org/mailman/listinfo/libcxx-commits>`_
224*4bdff4beSrobert* `libcxx Forum <https://discourse.llvm.org/c/runtimes/libcxx/>`_
22576d0caaeSpatrick* `Browse libc++ Sources <https://github.com/llvm/llvm-project/tree/main/libcxx/>`_
226