Hans Wennborg | 003a998 | 2019-07-18 11:51:05 +0000 | [diff] [blame] | 1 | ========================================= |
Tom Stellard | f375292 | 2022-07-26 19:43:55 -0700 | [diff] [blame] | 2 | Libc++ 16.0.0 (In-Progress) Release Notes |
Hans Wennborg | 003a998 | 2019-07-18 11:51:05 +0000 | [diff] [blame] | 3 | ========================================= |
Louis Dionne | 4222207 | 2018-09-06 14:46:22 +0000 | [diff] [blame] | 4 | |
| 5 | .. contents:: |
| 6 | :local: |
| 7 | :depth: 2 |
| 8 | |
Hans Wennborg | 3329a84 | 2018-09-10 08:57:12 +0000 | [diff] [blame] | 9 | Written by the `Libc++ Team <https://libcxx.llvm.org>`_ |
Louis Dionne | 4222207 | 2018-09-06 14:46:22 +0000 | [diff] [blame] | 10 | |
| 11 | .. warning:: |
| 12 | |
Tom Stellard | f375292 | 2022-07-26 19:43:55 -0700 | [diff] [blame] | 13 | These are in-progress notes for the upcoming libc++ 16 release. |
Louis Dionne | 4222207 | 2018-09-06 14:46:22 +0000 | [diff] [blame] | 14 | Release notes for previous releases can be found on |
Hans Wennborg | 3329a84 | 2018-09-10 08:57:12 +0000 | [diff] [blame] | 15 | `the Download Page <https://releases.llvm.org/download.html>`_. |
Louis Dionne | 4222207 | 2018-09-06 14:46:22 +0000 | [diff] [blame] | 16 | |
| 17 | Introduction |
| 18 | ============ |
| 19 | |
| 20 | This document contains the release notes for the libc++ C++ Standard Library, |
Tom Stellard | f375292 | 2022-07-26 19:43:55 -0700 | [diff] [blame] | 21 | part of the LLVM Compiler Infrastructure, release 16.0.0. Here we describe the |
Louis Dionne | 4222207 | 2018-09-06 14:46:22 +0000 | [diff] [blame] | 22 | status of libc++ in some detail, including major improvements from the previous |
| 23 | release and new feature work. For the general LLVM release notes, see `the LLVM |
Hans Wennborg | 3329a84 | 2018-09-10 08:57:12 +0000 | [diff] [blame] | 24 | documentation <https://llvm.org/docs/ReleaseNotes.html>`_. All LLVM releases may |
| 25 | be downloaded from the `LLVM releases web site <https://llvm.org/releases/>`_. |
Louis Dionne | 4222207 | 2018-09-06 14:46:22 +0000 | [diff] [blame] | 26 | |
| 27 | For more information about libc++, please see the `Libc++ Web Site |
Hans Wennborg | 3329a84 | 2018-09-10 08:57:12 +0000 | [diff] [blame] | 28 | <https://libcxx.llvm.org>`_ or the `LLVM Web Site <https://llvm.org>`_. |
Louis Dionne | 4222207 | 2018-09-06 14:46:22 +0000 | [diff] [blame] | 29 | |
Hans Wennborg | fc14f4e | 2020-01-15 10:02:56 +0100 | [diff] [blame] | 30 | Note that if you are reading this file from a Git checkout or the |
Louis Dionne | 4222207 | 2018-09-06 14:46:22 +0000 | [diff] [blame] | 31 | main Libc++ web page, this document applies to the *next* release, not |
| 32 | the current one. To see the release notes for a specific release, please |
Hans Wennborg | 3329a84 | 2018-09-10 08:57:12 +0000 | [diff] [blame] | 33 | see the `releases page <https://llvm.org/releases/>`_. |
Louis Dionne | 4222207 | 2018-09-06 14:46:22 +0000 | [diff] [blame] | 34 | |
Tom Stellard | f375292 | 2022-07-26 19:43:55 -0700 | [diff] [blame] | 35 | What's New in Libc++ 16.0.0? |
Hans Wennborg | 003a998 | 2019-07-18 11:51:05 +0000 | [diff] [blame] | 36 | ============================ |
Louis Dionne | 4222207 | 2018-09-06 14:46:22 +0000 | [diff] [blame] | 37 | |
Nikolas Klauser | 4f4a9bd | 2022-06-17 20:20:48 +0200 | [diff] [blame] | 38 | Implemented Papers |
| 39 | ------------------ |
Igor Zhukov | a925f62 | 2022-08-02 12:46:31 +0200 | [diff] [blame] | 40 | - P2499R0 - ``string_view`` range constructor should be ``explicit`` |
Nikolas Klauser | 73015c1 | 2022-08-13 13:52:35 +0200 | [diff] [blame] | 41 | - P2417R2 - A more constexpr bitset |
Igor Zhukov | 57ea60e | 2022-08-21 22:21:08 +0700 | [diff] [blame] | 42 | - P2445R1 - ``std::forward_like`` |
Igor Zhukov | 85a3363 | 2022-09-03 18:49:50 +0700 | [diff] [blame] | 43 | - P2273R3 - Making ``std::unique_ptr`` constexpr |
Nikolas Klauser | 96fa413 | 2022-10-04 17:55:42 +0200 | [diff] [blame] | 44 | - P0591R4 - Utility functions to implement uses-allocator construction |
Mark de Wever | 790768c | 2022-08-06 10:47:53 +0200 | [diff] [blame] | 45 | - P2291R3 - Add Constexpr Modifiers to Functions ``to_chars`` and |
| 46 | ``from_chars`` for Integral Types in ``<charconv>`` Header |
Nikolas Klauser | f8ff297 | 2022-10-18 21:33:32 +0200 | [diff] [blame] | 47 | - P0220R1 - Adopt Library Fundamentals V1 TS Components for C++17 |
| 48 | - P0482R6 - char8_t: A type for UTF-8 characters and strings |
Nikolas Klauser | 1b531cf | 2022-08-09 13:17:30 +0200 | [diff] [blame] | 49 | - P2438R2 - ``std::string::substr() &&`` |
Louis Dionne | 4222207 | 2018-09-06 14:46:22 +0000 | [diff] [blame] | 50 | |
Louis Dionne | 1ce86ad | 2022-07-21 12:48:14 -0400 | [diff] [blame] | 51 | Improvements and New Features |
| 52 | ----------------------------- |
Tom Honermann | 8a07d8c | 2022-09-10 10:16:20 -0400 | [diff] [blame] | 53 | - Declarations of ``std::c8rtomb()`` and ``std::mbrtoc8()`` from P0482R6 are |
| 54 | now provided when implementations in the global namespace are provided by |
| 55 | the C library. |
Arthur O'Dwyer | ebf2d34 | 2022-10-06 16:53:30 -0400 | [diff] [blame] | 56 | - Implemented ``<memory_resource>`` header from C++17 |
Nikolas Klauser | 4f4a9bd | 2022-06-17 20:20:48 +0200 | [diff] [blame] | 57 | |
Louis Dionne | 1ce86ad | 2022-07-21 12:48:14 -0400 | [diff] [blame] | 58 | Deprecations and Removals |
| 59 | ------------------------- |
Louis Dionne | eafd6fb | 2022-09-26 09:45:14 -0400 | [diff] [blame] | 60 | - ``unary_function`` and ``binary_function`` are no longer provided in C++17 and newer Standard modes. |
| 61 | They can be re-enabled with ``_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION``. |
| 62 | |
Mark de Wever | f6df9e8 | 2022-08-20 10:34:26 +0200 | [diff] [blame] | 63 | - Several incidental transitive includes have been removed from libc++. Those |
| 64 | includes are removed based on the language version used. Incidental transitive |
| 65 | inclusions of the following headers have been removed: |
| 66 | |
| 67 | - C++20: ``chrono`` |
| 68 | - C++2b: ``algorithm``, ``array``, ``atomic``, ``bit``, ``chrono``, |
Mark de Wever | adc1d1c | 2022-09-03 13:37:09 +0200 | [diff] [blame] | 69 | ``climits``, ``cmath``, ``compare``, ``concepts``, ``cstdarg`, ``cstddef``, |
| 70 | ``cstdint``, ``cstdlib``, ``cstring``, ``ctime``, ``exception``, |
| 71 | ``functional``, ``initializer_list``, ``iosfwd``, ``iterator``, ``limits``, |
| 72 | ``memory``, ``new``, ``numeric``, ``optional``, ``ratio``, ``stdexcept``, |
| 73 | ``string``, ``tuple``, ``type_traits``, ``typeinfo``, ``unordered_map``, |
| 74 | ``utility``, ``variant``, ``vector``. |
Mark de Wever | f6df9e8 | 2022-08-20 10:34:26 +0200 | [diff] [blame] | 75 | |
| 76 | Users can also remove all incidental transitive includes by defining |
| 77 | ``_LIBCPP_REMOVE_TRANSITIVE_INCLUDES`` regardless of the language version |
| 78 | in use. Note that in the future, libc++ reserves the right to remove |
| 79 | incidental transitive includes more aggressively, in particular regardless |
| 80 | of the language version in use. |
| 81 | |
Louis Dionne | 591c991 | 2022-05-26 10:58:28 -0400 | [diff] [blame] | 82 | - The legacy testing system for libc++, libc++abi and libunwind has been removed. |
| 83 | All known clients have been migrated to the new configuration system, but please |
| 84 | reach out to the libc++ developers if you find something missing in the new |
| 85 | configuration system. |
Louis Dionne | 12507ef | 2022-03-07 09:00:17 -0500 | [diff] [blame] | 86 | |
Mark de Wever | 625a5eb | 2022-09-02 18:46:59 +0200 | [diff] [blame] | 87 | - The functions ``to_chars`` and ``from_chars`` for integral types are |
| 88 | available starting with C++17. Libc++ offered these functions in C++11 and |
| 89 | C++14 as an undocumented extension. This extension makes it hard to implement |
| 90 | the C++23 paper that makes these functions ``constexpr``, therefore the |
| 91 | extension has been removed. |
| 92 | |
Nikolas Klauser | cc9c0de | 2022-10-19 11:07:34 +0200 | [diff] [blame] | 93 | - The ``_LIBCPP_ENABLE_CXX03_FUNCTION`` macro that allowed re-enabling the now-deprecated C++03 implementation of |
| 94 | ``std::function`` has been removed. Users who need to use ``std::function`` should switch to C++11 and above. |
| 95 | |
Nikolas Klauser | f8571ea | 2022-10-19 11:06:12 +0200 | [diff] [blame] | 96 | - The contents of ``<experimental/memory_resource>`` are now deprecated since libc++ ships ``<memory_resource>`` now. |
| 97 | Please migrate to ``<memory_resource>`` instead. Per libc++'s TS deprecation policy, |
| 98 | ``<experimental/memory_resource>`` will be removed in LLVM 18. |
| 99 | |
Louis Dionne | 8192593 | 2022-11-14 09:56:35 -1000 | [diff] [blame] | 100 | - The ``_LIBCPP_DEBUG`` macro is not honored anymore, and it is an error to try to use it. Please migrate to |
| 101 | ``_LIBCPP_ENABLE_DEBUG_MODE`` instead. |
| 102 | |
Louis Dionne | 1ce86ad | 2022-07-21 12:48:14 -0400 | [diff] [blame] | 103 | Upcoming Deprecations and Removals |
| 104 | ---------------------------------- |
Louis Dionne | e2872e3 | 2022-11-23 14:06:14 -0500 | [diff] [blame] | 105 | - The base template for ``std::char_traits`` has been marked as deprecated and will be removed in LLVM 18. If |
| 106 | you are using ``std::char_traits`` with types other than ``char``, ``wchar_t``, ``char8_t``, ``char16_t``, |
| 107 | ``char32_t`` or a custom character type for which you specialized ``std::char_traits``, your code will stop |
| 108 | working when we remove the base template. The Standard does not mandate that a base template is provided, |
| 109 | and such a base template is bound to be incorrect for some types, which could currently cause unexpected |
| 110 | behavior while going undetected. |
Louis Dionne | 1ce86ad | 2022-07-21 12:48:14 -0400 | [diff] [blame] | 111 | |
Adrian Vogelsgesang | 55e0c49 | 2022-07-31 16:12:42 -0700 | [diff] [blame] | 112 | API Changes |
| 113 | ----------- |
| 114 | - The comparison operators on ``thread::id`` are now defined as free-standing |
| 115 | functions instead of as hidden friends, in conformance with the C++ standard. |
| 116 | Also see `issue 56187 <https://github.com/llvm/llvm-project/issues/56187>`_. |
| 117 | |
Nikolas Klauser | 3e7bca1 | 2022-08-19 15:41:56 +0200 | [diff] [blame] | 118 | - ``_LIBCPP_ENABLE_NODISCARD`` and ``_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17`` are no longer respected. |
| 119 | Any standards-required ``[[nodiscard]]`` applications in C++20 are now always enabled. Any extended applications |
Nikolas Klauser | bbb1361 | 2022-09-01 12:02:58 +0200 | [diff] [blame] | 120 | are now enabled by default and can be disabled by defining ``_LIBCPP_DISABLE_NODISCARD_EXT``. |
Nikolas Klauser | 3e7bca1 | 2022-08-19 15:41:56 +0200 | [diff] [blame] | 121 | |
Louis Dionne | c23f69f | 2022-09-19 15:38:18 -0400 | [diff] [blame] | 122 | - ``_LIBCPP_VERSION`` was previously defined to e.g. ``15001`` to represent LLVM 15.0.01, but this value had been |
| 123 | left undocumented. Starting with LLVM 16, ``_LIBCPP_VERSION`` will contain the version of LLVM represented as |
| 124 | ``XXYYZZ``. In other words, ``_LIBCPP_VERSION`` is gaining a digit. This should not be an issue for existing |
| 125 | code, since using e.g. ``_LIBCPP_VERSION > 15000`` will still give the right answer now that ``_LIBCPP_VERSION`` |
| 126 | is defined as e.g. ``160000`` (with one more digit). |
| 127 | |
Louis Dionne | 1ce86ad | 2022-07-21 12:48:14 -0400 | [diff] [blame] | 128 | ABI Affecting Changes |
| 129 | --------------------- |
Louis Dionne | ade70ff | 2022-09-06 17:07:18 -0400 | [diff] [blame] | 130 | - In freestanding mode, ``atomic<small enum class>`` does not contain a lock byte anymore if the platform |
| 131 | can implement lockfree atomics for that size. More specifically, in LLVM <= 11.0.1, an ``atomic<small enum class>`` |
| 132 | would not contain a lock byte. This was broken in LLVM >= 12.0.0, where it started including a lock byte despite |
| 133 | the platform supporting lockfree atomics for that size. Starting in LLVM 15.0.1, the ABI for these types has been |
| 134 | restored to what it used to be (no lock byte), which is the most efficient implementation. |
| 135 | |
| 136 | This ABI break only affects users that compile with ``-ffreestanding``, and only for ``atomic<T>`` where ``T`` |
| 137 | is a non-builtin type that could be lockfree on the platform. See https://llvm.org/D133377 for more details. |
Joe Loser | 8fcb1d9 | 2021-10-28 15:38:02 -0400 | [diff] [blame] | 138 | |
Alex Richardson | f7e00ca | 2022-06-20 15:44:57 +0100 | [diff] [blame] | 139 | - When building libc++ against newlib/picolibc, the type of ``regex_type_traits::char_class_type`` was changed to |
| 140 | ``uint16_t`` since all values of ``ctype_base::mask`` are taken. This is technically an ABI break, but including |
| 141 | ``<regex> `` has triggered a ``static_assert`` failure since libc++ 14, so it is unlikely that this causes |
Louis Dionne | 44ad48b | 2022-11-23 10:31:21 -0500 | [diff] [blame] | 142 | problems for existing users. |
Alex Richardson | f7e00ca | 2022-06-20 15:44:57 +0100 | [diff] [blame] | 143 | |
Louis Dionne | 14918c8 | 2021-10-18 13:58:31 -0400 | [diff] [blame] | 144 | Build System Changes |
| 145 | -------------------- |
Louis Dionne | 6a0104e | 2022-09-21 09:50:53 -0400 | [diff] [blame] | 146 | - Support for ``libcxx``, ``libcxxabi`` and ``libunwind`` in ``LLVM_ENABLE_PROJECTS`` has officially |
| 147 | been removed. Instead, please build according to :ref:`these instructions <build instructions>`. |