mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-03 14:36:07 +00:00

Microsoft would like to contribute its implementation of floating-point to_chars to libc++. This uses the impossibly fast Ryu and Ryu Printf algorithms invented by Ulf Adams at Google. Upstream repos: https://github.com/microsoft/STL and https://github.com/ulfjack/ryu . Licensing notes: MSVC's STL is available under the Apache License v2.0 with LLVM Exception, intentionally chosen to match libc++. We've used Ryu under the Boost Software License. This patch contains minor changes from Jorg Brown at Google, to adapt the code to libc++. He verified that it works in Google's Linux-based environment, but then I applied more changes on top of his, so any compiler errors are my fault. (I haven't tried to build and test libc++ yet.) Please tell me if we need to do anything else in order to follow https://llvm.org/docs/DeveloperPolicy.html#attribution-of-changes . Notes: * libc++'s integer charconv is unchanged (except for a small refactoring). MSVC's integer charconv hasn't been tuned for performance yet, so you're not missing anything. * Floating-point from_chars isn't part of this patch because Jorg found that MSVC's implementation (derived from our CRT's strtod) was slower than Abseil's. If you're unable to use Abseil or another implementation due to licensing or technical considerations, Microsoft would be delighted if you used MSVC's from_chars (and you can just take it, or ask us to provide a patch like this). Ulf is also working on a novel algorithm for from_chars. * This assumes that float is IEEE 32-bit, double is IEEE 64-bit, and long double is also IEEE 64-bit. * I have added MSVC's charconv tests (the whole thing: integer/floating from_chars/to_chars), but haven't adapted them to libcxx's harness at all. (These tests will be available in the microsoft/STL repo soon.) * Jorg added int128 codepaths. These were originally present in upstream Ryu, and I removed them from microsoft/STL purely for performance reasons (MSVC doesn't support int128; Clang on Windows does, but I found that x64 intrinsics were slightly faster). * The implementation is split into 3 headers. In MSVC's STL, charconv contains only Microsoft-written code. xcharconv_ryu.h contains code derived from Ryu (with significant modifications and additions). xcharconv_ryu_tables.h contains Ryu's large lookup tables (they were sufficiently large to make editing inconvenient, hence the separate file). The xmeow.h convention is MSVC's for internal headers; you may wish to rename them. * You should consider separately compiling the lookup tables (see https://github.com/microsoft/STL/issues/172 ) for compiler throughput and reduced object file size. * See https://github.com/StephanTLavavej/llvm-project/commits/charconv for fine-grained history. (If necessary, I can perform some rebase surgery to show you what Jorg changed relative to the microsoft/STL repo; currently that's all fused into the first commit.) Differential Revision: https://reviews.llvm.org/D70631
164 lines
7.8 KiB
ReStructuredText
164 lines
7.8 KiB
ReStructuredText
=========================================
|
|
Libc++ 14.0.0 (In-Progress) Release Notes
|
|
=========================================
|
|
|
|
.. contents::
|
|
:local:
|
|
:depth: 2
|
|
|
|
Written by the `Libc++ Team <https://libcxx.llvm.org>`_
|
|
|
|
.. warning::
|
|
|
|
These are in-progress notes for the upcoming libc++ 14 release.
|
|
Release notes for previous releases can be found on
|
|
`the Download Page <https://releases.llvm.org/download.html>`_.
|
|
|
|
Introduction
|
|
============
|
|
|
|
This document contains the release notes for the libc++ C++ Standard Library,
|
|
part of the LLVM Compiler Infrastructure, release 14.0.0. Here we describe the
|
|
status of libc++ in some detail, including major improvements from the previous
|
|
release and new feature work. For the general LLVM release notes, see `the LLVM
|
|
documentation <https://llvm.org/docs/ReleaseNotes.html>`_. All LLVM releases may
|
|
be downloaded from the `LLVM releases web site <https://llvm.org/releases/>`_.
|
|
|
|
For more information about libc++, please see the `Libc++ Web Site
|
|
<https://libcxx.llvm.org>`_ or the `LLVM Web Site <https://llvm.org>`_.
|
|
|
|
Note that if you are reading this file from a Git checkout or the
|
|
main Libc++ web page, this document applies to the *next* release, not
|
|
the current one. To see the release notes for a specific release, please
|
|
see the `releases page <https://llvm.org/releases/>`_.
|
|
|
|
What's New in Libc++ 14.0.0?
|
|
============================
|
|
|
|
New Features
|
|
------------
|
|
|
|
- There's initial support for the C++20 header ``<format>``. The implementation
|
|
is incomplete. Some functions are known to be inefficient; both in memory
|
|
usage and performance. The implementation is considered experimental and isn't
|
|
considered ABI stable.
|
|
|
|
- There's a new CMake option ``LIBCXX_ENABLE_UNICODE`` to disable Unicode
|
|
support in the ``<format>`` header. This only affects the estimation of the
|
|
output width of the format functions.
|
|
|
|
- Support for building libc++ on top of a C Standard Library that does not support ``wchar_t`` was
|
|
added. This is useful for building libc++ in an embedded setting, and it adds itself to the various
|
|
freestanding-friendly options provided by libc++.
|
|
|
|
- ``_LIBCPP_DEBUG`` equals to ``1`` enables the randomization of unspecified
|
|
behavior of standard algorithms (e.g. equal elements in ``std::sort`` or
|
|
randomization of both sides of partition for ``std::nth_element``)
|
|
|
|
- Floating-point support for ``std::to_chars`` support has been added.
|
|
Thanks to Stephan T. Lavavej and Microsoft for providing their implemention
|
|
to libc++.
|
|
|
|
API Changes
|
|
-----------
|
|
|
|
- The functions ``std::atomic<T*>::fetch_(add|sub)`` and
|
|
``std::atomic_fetch_(add|sub)`` no longer accept a function pointer. While
|
|
this is technically an API break, the invalid syntax isn't supported by
|
|
libstc++ and MSVC STL. See https://godbolt.org/z/49fvzz98d.
|
|
|
|
- The call of the functions ``std::atomic_(add|sub)(std::atomic<T*>*, ...)``
|
|
with the explicit template argument ``T`` are now ill-formed. While this is
|
|
technically an API break, the invalid syntax isn't supported by libstc++ and
|
|
MSVC STL. See https://godbolt.org/z/v9959re3v.
|
|
|
|
Due to this change it's now possible to call these functions with the
|
|
explicit template argument ``T*``. This allows using the same syntax on the
|
|
major Standard library implementations.
|
|
See https://godbolt.org/z/oEfzPhTTb.
|
|
|
|
Calls to these functions where the template argument was deduced by the
|
|
compiler are unaffected by this change.
|
|
|
|
- The functions ``std::allocator<T>::allocate`` and
|
|
``std::experimental::pmr::polymorphic_allocator<T>::allocate`` now throw
|
|
an exception of type ``std::bad_array_new_length`` when the requested size
|
|
exceeds the maximum supported size, as required by the C++ standard.
|
|
Previously the type ``std::length_error`` was used.
|
|
|
|
- Removed the nonstandard methods ``std::chrono::file_clock::to_time_t`` and
|
|
``std::chrono::file_clock::from_time_t``; neither libstdc++ nor MSVC STL
|
|
had such methods. Instead, in C++20, you can use ``std::chrono::file_clock::from_sys``
|
|
and ``std::chrono::file_clock::to_sys``, which are specified in the Standard.
|
|
If you are not using C++20, you should move to it.
|
|
|
|
- The declarations of functions ``declare_reachable``, ``undeclare_reachable``, ``declare_no_pointers``,
|
|
``undeclare_no_pointers``, and ``get_pointer_safety`` have been removed not only from C++2b but
|
|
from all modes. Their symbols are still provided by the dynamic library for the benefit of
|
|
existing compiled code. All of these functions have always behaved as no-ops.
|
|
|
|
ABI Changes
|
|
-----------
|
|
|
|
- The C++17 variable templates ``is_error_code_enum_v`` and
|
|
``is_error_condition_enum_v`` are now of type ``bool`` instead of ``size_t``.
|
|
|
|
- The C++03 emulation type for ``std::nullptr_t`` has been removed in favor of
|
|
using ``decltype(nullptr)`` in all standard modes. This is an ABI break for
|
|
anyone compiling in C++03 mode and who has ``std::nullptr_t`` as part of their
|
|
ABI. However, previously, these users' ABI would be incompatible with any other
|
|
binary or static archive compiled with C++11 or later. If you start seeing linker
|
|
errors involving ``std::nullptr_t`` against previously compiled binaries, this may
|
|
be the cause. You can define the ``_LIBCPP_ABI_USE_CXX03_NULLPTR_EMULATION`` macro
|
|
to return to the previous behavior. That macro will be removed in LLVM 15. Please
|
|
comment `here <https://reviews.llvm.org/D109459>`_ if you are broken by this change
|
|
and need to define the macro.
|
|
|
|
Build System Changes
|
|
--------------------
|
|
|
|
- Building the libc++ shared or static library requires a C++ 20 capable compiler.
|
|
Consider using a Bootstrapping build to build libc++ with a fresh Clang if you
|
|
can't use the system compiler to build libc++ anymore.
|
|
|
|
- Historically, there has been numerous ways of building libc++ and libc++abi. This has
|
|
culminated in over 5 different ways to build the runtimes, which made it impossible to
|
|
maintain with a good level of support. Starting with this release, the runtimes support
|
|
exactly two ways of being built, which should cater to all use-cases. Furthermore,
|
|
these builds are as lightweight as possible and will work consistently even when targetting
|
|
embedded platforms, which used not to be the case. Please see the documentation on building
|
|
libc++ to see those two ways of building and migrate over to the appropriate build instructions
|
|
as soon as possible.
|
|
|
|
All other ways to build are deprecated and will not be supported in the next release.
|
|
We understand that making these changes can be daunting. For that reason, here's a
|
|
summary of how to migrate from the two most common ways to build:
|
|
|
|
- If you were rooting your CMake invocation at ``<monorepo>/llvm`` and passing ``-DLLVM_ENABLE_PROJECTS=<...>``
|
|
(which was the previously advertised way to build the runtimes), please simply root your CMake invocation at
|
|
``<monorepo>/runtimes`` and pass ``-DLLVM_ENABLE_RUNTIMES=<...>``.
|
|
|
|
- If you were doing two CMake invocations, one rooted at ``<monorepo>/libcxx`` and one rooted at
|
|
``<monorepo>/libcxxabi`` (this used to be called a "Standalone build"), please move them to a
|
|
single invocation like so:
|
|
|
|
.. code-block:: bash
|
|
|
|
$ cmake -S <monorepo>/libcxx -B libcxx-build <LIBCXX-OPTIONS>
|
|
$ cmake -S <monorepo>/libcxxabi -B libcxxabi-build <LIBCXXABI-OPTIONS>
|
|
|
|
should become
|
|
|
|
.. code-block:: bash
|
|
|
|
$ cmake -S <monorepo>/runtimes -B build -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" <LIBCXX-OPTIONS> <LIBCXXABI-OPTIONS>
|
|
|
|
- Support for building the runtimes using the GCC 32 bit multilib flag (``-m32``) has been removed. Support
|
|
for this had been flaky for a while, and we didn't know of anyone depending on this. Instead, please perform
|
|
a normal cross-compilation of the runtimes using the appropriate target, such as passing the following to
|
|
your bootstrapping build:
|
|
|
|
.. code-block:: bash
|
|
|
|
-DLLVM_RUNTIME_TARGETS=i386-unknown-linux
|