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 | |
Mark de Wever | 833949d | 2023-01-09 19:06:25 +0100 | [diff] [blame] | 38 | The main focus of the libc++ team has been to implement new C++20 and C++23 |
| 39 | features. |
| 40 | |
| 41 | The C++20 format library has improved but it not yet considered stable. The |
| 42 | main improvements are additional formatters for the chrono calendar types. Work |
| 43 | on formatting ranges has started. |
| 44 | |
| 45 | The C++20 ranges library has been completed and is no longer experimental. Some |
| 46 | ``views`` have not been implemented yet. Work on C++23 ranges has started. |
| 47 | |
| 48 | The C++20 spaceship operator has been added to more types, the work is still |
| 49 | ongoing. |
| 50 | |
Nikolas Klauser | 4f4a9bd | 2022-06-17 20:20:48 +0200 | [diff] [blame] | 51 | Implemented Papers |
| 52 | ------------------ |
Igor Zhukov | a925f62 | 2022-08-02 12:46:31 +0200 | [diff] [blame] | 53 | - P2499R0 - ``string_view`` range constructor should be ``explicit`` |
Nikolas Klauser | 73015c1 | 2022-08-13 13:52:35 +0200 | [diff] [blame] | 54 | - P2417R2 - A more constexpr bitset |
Igor Zhukov | 57ea60e | 2022-08-21 22:21:08 +0700 | [diff] [blame] | 55 | - P2445R1 - ``std::forward_like`` |
Igor Zhukov | 85a3363 | 2022-09-03 18:49:50 +0700 | [diff] [blame] | 56 | - P2273R3 - Making ``std::unique_ptr`` constexpr |
Nikolas Klauser | 96fa413 | 2022-10-04 17:55:42 +0200 | [diff] [blame] | 57 | - P0591R4 - Utility functions to implement uses-allocator construction |
Mark de Wever | 790768c | 2022-08-06 10:47:53 +0200 | [diff] [blame] | 58 | - P2291R3 - Add Constexpr Modifiers to Functions ``to_chars`` and |
| 59 | ``from_chars`` for Integral Types in ``<charconv>`` Header |
Nikolas Klauser | f8ff297 | 2022-10-18 21:33:32 +0200 | [diff] [blame] | 60 | - P0220R1 - Adopt Library Fundamentals V1 TS Components for C++17 |
| 61 | - P0482R6 - char8_t: A type for UTF-8 characters and strings |
Nikolas Klauser | 1b531cf | 2022-08-09 13:17:30 +0200 | [diff] [blame] | 62 | - P2438R2 - ``std::string::substr() &&`` |
Nikolas Klauser | e75f799 | 2022-11-29 19:42:16 +0100 | [diff] [blame] | 63 | - P0600R1 - ``nodiscard`` in the library |
Nikolas Klauser | e4e39ce | 2022-12-01 23:17:53 +0100 | [diff] [blame] | 64 | - P0339R6 - ``polymorphic_allocator<>`` as a vocabulary type |
Nikolas Klauser | 2948540 | 2022-10-01 21:25:13 +0200 | [diff] [blame] | 65 | - P1169R4 - ``static operator()`` |
Marek Kurdej | 4d6c6e5 | 2022-12-15 02:19:59 +0100 | [diff] [blame] | 66 | - P0415R1 - ``constexpr`` for ``std::complex`` |
James Y Knight | b35329a | 2023-01-11 15:53:03 -0500 | [diff] [blame] | 67 | - P1208R6 - ``std::source_location`` |
Mark de Wever | 833949d | 2023-01-09 19:06:25 +0100 | [diff] [blame] | 68 | - P0323R12 - ``std::expected`` |
Hui Xie | 885d5d1 | 2022-11-04 11:53:38 +0000 | [diff] [blame] | 69 | - P1035R7 - Input Range Adaptors |
Konstantin Varlamov | fad0eab | 2023-01-17 22:45:46 -0800 | [diff] [blame] | 70 | - P2325R3 - Views should not be required to be default constructible |
Nikolas Klauser | 0e3d3a0 | 2022-12-11 11:32:54 +0100 | [diff] [blame] | 71 | - P2446R2 - ``views::as_rvalue`` |
Louis Dionne | 4222207 | 2018-09-06 14:46:22 +0000 | [diff] [blame] | 72 | |
Louis Dionne | 1ce86ad | 2022-07-21 12:48:14 -0400 | [diff] [blame] | 73 | Improvements and New Features |
| 74 | ----------------------------- |
Tom Honermann | 8a07d8c | 2022-09-10 10:16:20 -0400 | [diff] [blame] | 75 | - Declarations of ``std::c8rtomb()`` and ``std::mbrtoc8()`` from P0482R6 are |
| 76 | now provided when implementations in the global namespace are provided by |
| 77 | the C library. |
Arthur O'Dwyer | ebf2d34 | 2022-10-06 16:53:30 -0400 | [diff] [blame] | 78 | - Implemented ``<memory_resource>`` header from C++17 |
Mark de Wever | 833949d | 2023-01-09 19:06:25 +0100 | [diff] [blame] | 79 | - `D122780 <https://reviews.llvm.org/D122780>`_ Improved the performance of std::sort |
Nikolas Klauser | bb446e8 | 2022-11-20 23:16:20 +0100 | [diff] [blame] | 80 | - The ``ranges`` versions of ``copy``, ``move``, ``copy_backward`` and ``move_backward`` are now also optimized for |
| 81 | ``std::deque<>::iterator``, which can lead to up to 20x performance improvements on certain algorithms. |
Nikolas Klauser | cf03da9 | 2022-11-21 12:41:15 +0100 | [diff] [blame^] | 82 | - The ``std`` and ``ranges`` versions of ``copy``, ``move``, ``copy_backward`` and ``move_backward`` are now also |
| 83 | optimized for ``join_view::iterator``, which can lead to up to 20x performance improvements on certain combinations of |
| 84 | iterators and algorithms. |
Nikolas Klauser | 4f4a9bd | 2022-06-17 20:20:48 +0200 | [diff] [blame] | 85 | |
Louis Dionne | 1ce86ad | 2022-07-21 12:48:14 -0400 | [diff] [blame] | 86 | Deprecations and Removals |
| 87 | ------------------------- |
Louis Dionne | eafd6fb | 2022-09-26 09:45:14 -0400 | [diff] [blame] | 88 | - ``unary_function`` and ``binary_function`` are no longer provided in C++17 and newer Standard modes. |
| 89 | They can be re-enabled with ``_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION``. |
| 90 | |
Mark de Wever | f6df9e8 | 2022-08-20 10:34:26 +0200 | [diff] [blame] | 91 | - Several incidental transitive includes have been removed from libc++. Those |
| 92 | includes are removed based on the language version used. Incidental transitive |
| 93 | inclusions of the following headers have been removed: |
| 94 | |
Mark de Wever | 833949d | 2023-01-09 19:06:25 +0100 | [diff] [blame] | 95 | - C++11, C++14, C++17, and C++20: ``chrono`` |
Mark de Wever | f6df9e8 | 2022-08-20 10:34:26 +0200 | [diff] [blame] | 96 | - C++2b: ``algorithm``, ``array``, ``atomic``, ``bit``, ``chrono``, |
Mark de Wever | 19ffb9c | 2022-12-10 15:28:15 +0100 | [diff] [blame] | 97 | ``climits``, ``cmath``, ``compare``, ``concepts``, ``cstdarg``, ``cstddef``, |
Mark de Wever | adc1d1c | 2022-09-03 13:37:09 +0200 | [diff] [blame] | 98 | ``cstdint``, ``cstdlib``, ``cstring``, ``ctime``, ``exception``, |
| 99 | ``functional``, ``initializer_list``, ``iosfwd``, ``iterator``, ``limits``, |
| 100 | ``memory``, ``new``, ``numeric``, ``optional``, ``ratio``, ``stdexcept``, |
| 101 | ``string``, ``tuple``, ``type_traits``, ``typeinfo``, ``unordered_map``, |
| 102 | ``utility``, ``variant``, ``vector``. |
Mark de Wever | f6df9e8 | 2022-08-20 10:34:26 +0200 | [diff] [blame] | 103 | |
| 104 | Users can also remove all incidental transitive includes by defining |
| 105 | ``_LIBCPP_REMOVE_TRANSITIVE_INCLUDES`` regardless of the language version |
| 106 | in use. Note that in the future, libc++ reserves the right to remove |
| 107 | incidental transitive includes more aggressively, in particular regardless |
| 108 | of the language version in use. |
| 109 | |
Mark de Wever | 833949d | 2023-01-09 19:06:25 +0100 | [diff] [blame] | 110 | - The legacy testing system for libc++, libc++abi, and libunwind has been removed. |
Louis Dionne | 591c991 | 2022-05-26 10:58:28 -0400 | [diff] [blame] | 111 | All known clients have been migrated to the new configuration system, but please |
| 112 | reach out to the libc++ developers if you find something missing in the new |
| 113 | configuration system. |
Louis Dionne | 12507ef | 2022-03-07 09:00:17 -0500 | [diff] [blame] | 114 | |
Mark de Wever | 625a5eb | 2022-09-02 18:46:59 +0200 | [diff] [blame] | 115 | - The functions ``to_chars`` and ``from_chars`` for integral types are |
| 116 | available starting with C++17. Libc++ offered these functions in C++11 and |
| 117 | C++14 as an undocumented extension. This extension makes it hard to implement |
| 118 | the C++23 paper that makes these functions ``constexpr``, therefore the |
| 119 | extension has been removed. |
| 120 | |
Nikolas Klauser | cc9c0de | 2022-10-19 11:07:34 +0200 | [diff] [blame] | 121 | - The ``_LIBCPP_ENABLE_CXX03_FUNCTION`` macro that allowed re-enabling the now-deprecated C++03 implementation of |
| 122 | ``std::function`` has been removed. Users who need to use ``std::function`` should switch to C++11 and above. |
| 123 | |
Nikolas Klauser | f8571ea | 2022-10-19 11:06:12 +0200 | [diff] [blame] | 124 | - The contents of ``<experimental/memory_resource>`` are now deprecated since libc++ ships ``<memory_resource>`` now. |
| 125 | Please migrate to ``<memory_resource>`` instead. Per libc++'s TS deprecation policy, |
| 126 | ``<experimental/memory_resource>`` will be removed in LLVM 18. |
| 127 | |
Louis Dionne | 8192593 | 2022-11-14 09:56:35 -1000 | [diff] [blame] | 128 | - The ``_LIBCPP_DEBUG`` macro is not honored anymore, and it is an error to try to use it. Please migrate to |
| 129 | ``_LIBCPP_ENABLE_DEBUG_MODE`` instead. |
| 130 | |
Louis Dionne | 1ce86ad | 2022-07-21 12:48:14 -0400 | [diff] [blame] | 131 | Upcoming Deprecations and Removals |
| 132 | ---------------------------------- |
Louis Dionne | e2872e3 | 2022-11-23 14:06:14 -0500 | [diff] [blame] | 133 | - The base template for ``std::char_traits`` has been marked as deprecated and will be removed in LLVM 18. If |
| 134 | you are using ``std::char_traits`` with types other than ``char``, ``wchar_t``, ``char8_t``, ``char16_t``, |
| 135 | ``char32_t`` or a custom character type for which you specialized ``std::char_traits``, your code will stop |
| 136 | working when we remove the base template. The Standard does not mandate that a base template is provided, |
| 137 | and such a base template is bound to be incorrect for some types, which could currently cause unexpected |
| 138 | behavior while going undetected. |
Louis Dionne | 1ce86ad | 2022-07-21 12:48:14 -0400 | [diff] [blame] | 139 | |
Adrian Vogelsgesang | 55e0c49 | 2022-07-31 16:12:42 -0700 | [diff] [blame] | 140 | API Changes |
| 141 | ----------- |
| 142 | - The comparison operators on ``thread::id`` are now defined as free-standing |
| 143 | functions instead of as hidden friends, in conformance with the C++ standard. |
| 144 | Also see `issue 56187 <https://github.com/llvm/llvm-project/issues/56187>`_. |
| 145 | |
Nikolas Klauser | 3e7bca1 | 2022-08-19 15:41:56 +0200 | [diff] [blame] | 146 | - ``_LIBCPP_ENABLE_NODISCARD`` and ``_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17`` are no longer respected. |
| 147 | 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] | 148 | 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] | 149 | |
Louis Dionne | c23f69f | 2022-09-19 15:38:18 -0400 | [diff] [blame] | 150 | - ``_LIBCPP_VERSION`` was previously defined to e.g. ``15001`` to represent LLVM 15.0.01, but this value had been |
| 151 | left undocumented. Starting with LLVM 16, ``_LIBCPP_VERSION`` will contain the version of LLVM represented as |
| 152 | ``XXYYZZ``. In other words, ``_LIBCPP_VERSION`` is gaining a digit. This should not be an issue for existing |
| 153 | code, since using e.g. ``_LIBCPP_VERSION > 15000`` will still give the right answer now that ``_LIBCPP_VERSION`` |
| 154 | is defined as e.g. ``160000`` (with one more digit). |
| 155 | |
Louis Dionne | 1ce86ad | 2022-07-21 12:48:14 -0400 | [diff] [blame] | 156 | ABI Affecting Changes |
| 157 | --------------------- |
Louis Dionne | ade70ff | 2022-09-06 17:07:18 -0400 | [diff] [blame] | 158 | - In freestanding mode, ``atomic<small enum class>`` does not contain a lock byte anymore if the platform |
| 159 | can implement lockfree atomics for that size. More specifically, in LLVM <= 11.0.1, an ``atomic<small enum class>`` |
| 160 | would not contain a lock byte. This was broken in LLVM >= 12.0.0, where it started including a lock byte despite |
| 161 | the platform supporting lockfree atomics for that size. Starting in LLVM 15.0.1, the ABI for these types has been |
| 162 | restored to what it used to be (no lock byte), which is the most efficient implementation. |
| 163 | |
| 164 | This ABI break only affects users that compile with ``-ffreestanding``, and only for ``atomic<T>`` where ``T`` |
| 165 | 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] | 166 | |
Alex Richardson | f7e00ca | 2022-06-20 15:44:57 +0100 | [diff] [blame] | 167 | - When building libc++ against newlib/picolibc, the type of ``regex_type_traits::char_class_type`` was changed to |
| 168 | ``uint16_t`` since all values of ``ctype_base::mask`` are taken. This is technically an ABI break, but including |
| 169 | ``<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] | 170 | problems for existing users. |
Alex Richardson | f7e00ca | 2022-06-20 15:44:57 +0100 | [diff] [blame] | 171 | |
Louis Dionne | 14918c8 | 2021-10-18 13:58:31 -0400 | [diff] [blame] | 172 | Build System Changes |
| 173 | -------------------- |
Louis Dionne | 6a0104e | 2022-09-21 09:50:53 -0400 | [diff] [blame] | 174 | - Support for ``libcxx``, ``libcxxabi`` and ``libunwind`` in ``LLVM_ENABLE_PROJECTS`` has officially |
| 175 | been removed. Instead, please build according to :ref:`these instructions <build instructions>`. |