diff --git a/libcxx/docs/DesignDocs/ExperimentalFeatures.rst b/libcxx/docs/DesignDocs/ExperimentalFeatures.rst --- a/libcxx/docs/DesignDocs/ExperimentalFeatures.rst +++ b/libcxx/docs/DesignDocs/ExperimentalFeatures.rst @@ -143,7 +143,8 @@ `FileSystem TS `__ ------------------------------------------- The FileSystem TS was accepted (in totality) for C++17. -The FileSystem TS implementation was shipped in namespace ``std`` in LLVM 7.0, and will be removed in LLVM 11.0 (due to the lack of deprecation warnings before LLVM 9.0). +The FileSystem TS implementation was shipped in namespace ``std`` in LLVM 7.0, and was +removed in LLVM 11.0 (due to the lack of deprecation warnings before LLVM 9.0). Parallelism TS `V1 `__ and `V2 `__ ------------------------------------------------------------------------------------ @@ -152,8 +153,10 @@ `Coroutines TS `__ ------------------------------------------- -The Coroutines TS is not yet part of a shipping standard. -We are shipping (as of v5.0) an implementation of the Coroutines TS in namespace ``std::experimental``. +The Coroutines TS was accepted for C++20. +An implementation of the Coroutines TS was shipped in LLVM 5.0 in namespace ``std::experimental``, +and C++20 Coroutines shipped in LLVM 14.0. The implementation of the Coroutines TS in ``std::experimental`` +will be removed in LLVM 16.0. `Networking TS `__ ------------------------------------------- @@ -162,13 +165,15 @@ `Ranges TS `__ --------------------------------------- -The Ranges TS is not yet part of a shipping standard. -We have not yet shipped an implementation of the Ranges TS. +The Ranges TS was accepted for C++20. +We will not ship an implementation of the Ranges TS, however we are actively working on +the implementation of C++20 Ranges. `Concepts TS `__ ----------------------------------------- -The Concepts TS is not yet part of a shipping standard, but it has been adopted into the C++20 working draft. -We have not yet shipped an implementation of the Concepts TS. +The Concepts TS was accepted for C++20. +We will not ship an implementation of the Concepts TS, however we are shipping an +implementation of C++20 Concepts. `Concurrency TS `__ -------------------------------------------- diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst --- a/libcxx/docs/ReleaseNotes.rst +++ b/libcxx/docs/ReleaseNotes.rst @@ -89,6 +89,13 @@ should include assertions or not by default. For details, see :ref:`the documentation ` about this new feature. +- Clang now implements the ``-fexperimental-library`` flag. This flag can be used to + enable experimental library features such as TSes and other in-progress work like + ```` and ````. Using this flag makes it unnecessary to manually link + against ``libc++experimental.a`` -- just use ``-fexperimental-library`` and the + compiler will do what's needed to make experimental features work. However, be + aware that experimental features are not stable! + - The implementation of the function ``std::to_chars`` for integral types using base 10 has moved from the dylib to the header. This means the function no longer has a minimum deployment target. diff --git a/libcxx/docs/Status/Cxx20.rst b/libcxx/docs/Status/Cxx20.rst --- a/libcxx/docs/Status/Cxx20.rst +++ b/libcxx/docs/Status/Cxx20.rst @@ -42,7 +42,7 @@ .. [#note-P0600] P0600: The missing bits in P0600 are in |sect|\ [mem.res.class] and |sect|\ [mem.poly.allocator.class]. .. [#note-P0645] P0645: The paper is implemented but still marked as an incomplete feature - (the feature-test macro is not set and the libary is only available when built with ``-D_LIBCPP_ENABLE_EXPERIMENTAL``). + (the feature-test macro is not set and the libary is only available when built with ``-fexperimental-library``). Not yet implemented LWG-issues will cause API and ABI breakage. .. [#note-P0966] P0966: It was previously erroneously marked as complete in version 8.0. See `bug 45368 `__. .. [#note-P0619] P0619: Only sections D.8, D.9, D.10 and D.13 are implemented. Sections D.4, D.7, D.11, D.12, and D.14 remain undone. diff --git a/libcxx/docs/UsingLibcxx.rst b/libcxx/docs/UsingLibcxx.rst --- a/libcxx/docs/UsingLibcxx.rst +++ b/libcxx/docs/UsingLibcxx.rst @@ -41,12 +41,10 @@ are either Technical Specifications (TSes) or official features that were voted to the Standard but whose implementation is not complete or stable yet in libc++. Those are disabled by default because they are neither API nor ABI stable. However, the -``_LIBCPP_ENABLE_EXPERIMENTAL`` macro can be defined to turn those features on. Note -that you will also need to link to the appropriate ``libc++experimental.a`` static -archive. +``-fexperimental-library`` compiler flag can be defined to turn those features on. .. warning:: - Experimental libraries are Experimental. + Experimental libraries are experimental. * The contents of the ```` headers and the associated static library will not remain compatible between versions. * No guarantees of API or ABI stability are provided. @@ -54,6 +52,12 @@ the experimental feature is removed two releases after the non-experimental version has shipped. The full policy is explained :ref:`here `. +.. note:: + On compilers that do not support the ``-fexperimental-library`` flag, users can + define the ``_LIBCPP_ENABLE_EXPERIMENTAL`` macro and manually link against the + appropriate static library (usually shipped as ``libc++experimental.a``) to get + access to experimental library features. + Using libc++ when it is not the system default ============================================== diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -243,6 +243,12 @@ # define _LIBCPP_ABI_VCRUNTIME # endif +# if __has_feature(experimental_library) +# ifndef _LIBCPP_ENABLE_EXPERIMENTAL +# define _LIBCPP_ENABLE_EXPERIMENTAL +# endif +# endif + // Incomplete features get their own specific disabling flags. This makes it // easier to grep for target specific flags once the feature is complete. # if !defined(_LIBCPP_ENABLE_EXPERIMENTAL) && !defined(_LIBCPP_BUILDING_LIBRARY) diff --git a/libcxx/test/libcxx/experimental/fexperimental-library.compile.pass.cpp b/libcxx/test/libcxx/experimental/fexperimental-library.compile.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/libcxx/experimental/fexperimental-library.compile.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// This test ensures that passing `-fexperimental-library` results in experimental +// library features being enabled. + +// GCC does not support the -fexperimental-library flag +// UNSUPPORTED: gcc + +// Clang does not support the -fexperimental-library flag before LLVM 15.0 +// UNSUPPORTED: clang-13, clang-14 + +// AppleClang does not support the -fexperimental-library flag yet +// UNSUPPORTED: apple-clang-13 + +// Clang on AIX currently pretends that it is Clang 15, even though it is not (as of writing +// this, LLVM 15 hasn't even been branched yet). +// UNSUPPORTED: clang-15 && buildhost=aix + +// ADDITIONAL_COMPILE_FLAGS: -fexperimental-library + +#include + +#ifdef _LIBCPP_HAS_NO_INCOMPLETE_FORMAT +# error "-fexperimental-library should enable " +#endif + +#ifdef _LIBCPP_HAS_NO_INCOMPLETE_RANGES +# error "-fexperimental-library should enable " +#endif diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py --- a/libcxx/utils/libcxx/test/params.py +++ b/libcxx/utils/libcxx/test/params.py @@ -166,9 +166,6 @@ # to make it link against the static libc++experimental.lib. # We can't check for the feature 'msvc' in available_features # as those features are added after processing parameters. - # - # TODO: Switch to using the appropriate experimental compiler flag once - # all compilers we support implement that flag. AddFeature('c++experimental'), PrependLinkFlag(lambda cfg: '-llibc++experimental' if _isMSVC(cfg) else '-lc++experimental'), AddCompileFlag('-D_LIBCPP_ENABLE_EXPERIMENTAL'),