Skip to content

Commit

Permalink
[libc++] Updates C++2b to C++23.
Browse files Browse the repository at this point in the history
During the ISO C++ Committee meeting plenary session the C++23 Standard
has been voted as technical complete.

This updates the reference to c++2b to c++23 and updates the __cplusplus
macro.

Note since we use clang-tidy 16 a small work-around is needed. Clang
knows -std=c++23 but clang-tidy not so for now force the lit compiler
flag to use -std=c++2b instead of -std=c++23.

Reviewed By: #libc, philnik, jloser, ldionne

Differential Revision: https://reviews.llvm.org/D150795
  • Loading branch information
mordante committed May 23, 2023
1 parent 90418dc commit 7140050
Show file tree
Hide file tree
Showing 95 changed files with 1,335 additions and 1,327 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set(LIBCXX_TEST_PARAMS "std=c++2b" CACHE STRING "")
set(LIBCXX_TEST_PARAMS "std=c++23" CACHE STRING "")
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
2 changes: 1 addition & 1 deletion libcxx/docs/FeatureTestMacroTable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ Status
------------------------------------------------- -----------------
``__cpp_lib_unwrap_ref`` ``201811L``
------------------------------------------------- -----------------
**C++ 2b**
**C++ 23**
-------------------------------------------------------------------
``__cpp_lib_adaptor_iterator_pair_constructor`` ``202106L``
------------------------------------------------- -----------------
Expand Down
2 changes: 1 addition & 1 deletion libcxx/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Deprecations and Removals
includes are removed based on the language version used. Incidental transitive
inclusions of the following headers have been removed:

- C++2b: ``atomic``, ``bit``, ``cstdint``, ``cstdlib``, ``cstring``, ``initializer_list``, ``limits``, ``new``,
- C++23: ``atomic``, ``bit``, ``cstdint``, ``cstdlib``, ``cstring``, ``initializer_list``, ``limits``, ``new``,
``stdexcept``, ``system_error``, ``type_traits``, ``typeinfo``

- ``<algorithm>`` no longer includes ``<chrono>`` in any C++ version (it was previously included in C++17 and earlier).
Expand Down
13 changes: 7 additions & 6 deletions libcxx/docs/Status/Cxx2b.rst → libcxx/docs/Status/Cxx23.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _cxx2b-status:
.. _cxx23-status:

================================
libc++ C++2b Status
libc++ C++23 Status
================================

.. include:: ../Helpers/Styles.rst
Expand All @@ -14,6 +14,7 @@ Overview
================================

In November 2020, the C++ standard committee adopted the first changes to the next version of the C++ standard, known here as "C++2b" (probably to be C++23).
In February 2023, the C++ standard committee approved this draft, and sent it to ISO for approval as C++23.

This page shows the status of libc++; the status of clang's support of the language features is `here <https://clang.llvm.org/cxx_status.html#cxx23>`__.

Expand All @@ -27,13 +28,13 @@ The groups that have contributed papers:

.. note:: "Nothing to do" means that no library changes were needed to implement this change.

.. _paper-status-cxx2b:
.. _paper-status-cxx23:

Paper Status
====================================

.. csv-table::
:file: Cxx2bPapers.csv
:file: Cxx23Papers.csv
:header-rows: 1
:widths: auto

Expand All @@ -48,13 +49,13 @@ Paper Status
The formatter for ``stacktrace`` is not implemented, since ``stacktrace`` is
not implemented yet.
.. _issues-status-cxx2b:
.. _issues-status-cxx23:

Library Working Group Issues Status
====================================

.. csv-table::
:file: Cxx2bIssues.csv
:file: Cxx23Issues.csv
:header-rows: 1
:widths: auto

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion libcxx/docs/Status/Zip.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ libc++ Zip Status (P2321R2)
Overview
========

This document contains the status of the C++2b zip implementation in libc++.
This document contains the status of the C++23 zip implementation in libc++.
It is used to track both the status of the sub-projects of the effort and who
is assigned to these sub-projects. This avoids duplicating effort.

Expand Down
4 changes: 2 additions & 2 deletions libcxx/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Getting Started with libc++
Status/Cxx14
Status/Cxx17
Status/Cxx20
Status/Cxx2b
Status/Cxx23
Status/Format
Status/Parallelism
Status/Ranges
Expand Down Expand Up @@ -145,7 +145,7 @@ C++ Dialect Support
* :ref:`C++14 - Complete <cxx14-status>`
* :ref:`C++17 - In Progress <cxx17-status>`
* :ref:`C++20 - In Progress <cxx20-status>`
* :ref:`C++2b - In Progress <cxx2b-status>`
* :ref:`C++23 - In Progress <cxx23-status>`
* :ref:`C++ Feature Test Macro Status <feature-status>`


Expand Down
4 changes: 3 additions & 1 deletion libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@
# define _LIBCPP_STD_VER 17
# elif __cplusplus <= 202002L
# define _LIBCPP_STD_VER 20
# elif __cplusplus <= 202302L
# define _LIBCPP_STD_VER 23
# else
// Expected release year of the next C++ standard
# define _LIBCPP_STD_VER 23
# define _LIBCPP_STD_VER 26
# endif
# endif // _LIBCPP_STD_VER
// NOLINTEND(libcpp-cpp-version-check)
Expand Down
6 changes: 3 additions & 3 deletions libcxx/include/ranges
Original file line number Diff line number Diff line change
Expand Up @@ -294,13 +294,13 @@ namespace std::ranges {
// [range.zip], zip view
template<input_range... Views>
requires (view<Views> && ...) && (sizeof...(Views) > 0)
class zip_view; // C++2b
class zip_view; // C++23
template<class... Views>
inline constexpr bool enable_borrowed_range<zip_view<Views...>> = // C++2b
inline constexpr bool enable_borrowed_range<zip_view<Views...>> = // C++23
(enable_borrowed_range<Views> && ...);
namespace views { inline constexpr unspecified zip = unspecified; } // C++2b
namespace views { inline constexpr unspecified zip = unspecified; } // C++23
// [range.as.rvalue]
template <view V>
Expand Down
10 changes: 5 additions & 5 deletions libcxx/include/string
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public:
explicit basic_string(const T& t, const Allocator& a = Allocator()); // C++17, constexpr since C++20
basic_string(const value_type* s, const allocator_type& a = allocator_type()); // constexpr since C++20
basic_string(const value_type* s, size_type n, const allocator_type& a = allocator_type()); // constexpr since C++20
basic_string(nullptr_t) = delete; // C++2b
basic_string(nullptr_t) = delete; // C++23
basic_string(size_type n, value_type c, const allocator_type& a = allocator_type()); // constexpr since C++20
template<class InputIterator>
basic_string(InputIterator begin, InputIterator end,
Expand All @@ -140,7 +140,7 @@ public:
allocator_type::propagate_on_container_move_assignment::value ||
allocator_type::is_always_equal::value ); // C++17, constexpr since C++20
basic_string& operator=(const value_type* s); // constexpr since C++20
basic_string& operator=(nullptr_t) = delete; // C++2b
basic_string& operator=(nullptr_t) = delete; // C++23
basic_string& operator=(value_type c); // constexpr since C++20
basic_string& operator=(initializer_list<value_type>); // constexpr since C++20
Expand Down Expand Up @@ -342,9 +342,9 @@ public:
constexpr bool ends_with(charT c) const noexcept; // C++20
constexpr bool ends_with(const charT* s) const; // C++20
constexpr bool contains(basic_string_view<charT, traits> sv) const noexcept; // C++2b
constexpr bool contains(charT c) const noexcept; // C++2b
constexpr bool contains(const charT* s) const; // C++2b
constexpr bool contains(basic_string_view<charT, traits> sv) const noexcept; // C++23
constexpr bool contains(charT c) const noexcept; // C++23
constexpr bool contains(const charT* s) const; // C++23
};
template<class InputIterator,
Expand Down
8 changes: 4 additions & 4 deletions libcxx/include/string_view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ namespace std {
basic_string_view& operator=(const basic_string_view&) noexcept = default;
template<class Allocator>
constexpr basic_string_view(const charT* str);
basic_string_view(nullptr_t) = delete; // C++2b
basic_string_view(nullptr_t) = delete; // C++23
constexpr basic_string_view(const charT* str, size_type len);
template <class It, class End>
constexpr basic_string_view(It begin, End end); // C++20
Expand Down Expand Up @@ -168,9 +168,9 @@ namespace std {
constexpr bool ends_with(charT c) const noexcept; // C++20
constexpr bool ends_with(const charT* s) const; // C++20
constexpr bool contains(basic_string_view s) const noexcept; // C++2b
constexpr bool contains(charT c) const noexcept; // C++2b
constexpr bool contains(const charT* s) const; // C++2b
constexpr bool contains(basic_string_view s) const noexcept; // C++23
constexpr bool contains(charT c) const noexcept; // C++23
constexpr bool contains(const charT* s) const; // C++23
private:
const_pointer data_; // exposition only
Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/type_traits
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace std
template <class T> struct is_arithmetic;
template <class T> struct is_fundamental;
template <class T> struct is_member_pointer;
template <class T> struct is_scoped_enum; // C++2b
template <class T> struct is_scoped_enum; // C++23
template <class T> struct is_scalar;
template <class T> struct is_object;
template <class T> struct is_compound;
Expand Down Expand Up @@ -286,7 +286,7 @@ namespace std
template <class T> inline constexpr bool is_member_pointer_v
= is_member_pointer<T>::value; // C++17
template <class T> inline constexpr bool is_scoped_enum_v
= is_scoped_enum<T>::value; // C++2b
= is_scoped_enum<T>::value; // C++23
// See C++14 20.10.4.3, type properties
template <class T> inline constexpr bool is_const_v
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/utility
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ template <size_t I>
// [utility.underlying], to_underlying
template <class T>
constexpr underlying_type_t<T> to_underlying( T value ) noexcept; // C++2b
constexpr underlying_type_t<T> to_underlying( T value ) noexcept; // C++23
} // std
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

// Check that Clang supports constexpr <cmath> and <cstdlib> functions
// mentioned in the P0533R9 paper that is part of C++2b
// mentioned in the P0533R9 paper that is part of C++23
// (https://wg21.link/p0533r9)
//
// Every function called in this test should become constexpr. Whenever some
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

// Check that GCC supports constexpr <cmath> and <cstdlib> functions
// mentioned in the P0533R9 paper that is part of C++2b
// mentioned in the P0533R9 paper that is part of C++23
// (https://wg21.link/p0533r9)
//
// Every function called in this test should become constexpr. Whenever some
Expand Down
2 changes: 1 addition & 1 deletion libcxx/test/libcxx/transitive_includes.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import re
# To re-generate the list of expected headers, temporarily set this to True, re-generate
# the file and run this test.
# Note that this needs to be done for all supported language versions of libc++:
# for std in c++03 c++11 c++14 c++17 c++20 c++2b; do <build>/bin/llvm-lit --param std=$std ${path_to_this_file}; done
# for std in c++03 c++11 c++14 c++17 c++20 c++23; do <build>/bin/llvm-lit --param std=$std ${path_to_this_file}; done
regenerate_expected_results = False
# Used because the sequence of tokens RUN : can't appear anywhere or it'll confuse Lit.
RUN = "RUN"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
// This test fails in Windows DLL configurations, due to
// __exclude_from_explicit_instantiation__ not behaving as it should in
// combination with dllimport (https://llvm.org/PR41018), in combination
// with running tests in c++2b mode while building the library in c++20 mode.
// with running tests in c++23 mode while building the library in c++20 mode.
//
// If the library was built in c++2b mode, this test would succeed.
// If the library was built in c++23 mode, this test would succeed.
//
// Older CMake passed -std:c++latest to set C++ 20 mode on clang-cl, which
// hid this issue. With newer CMake versions, it passes -std:c++20 which
// makes this fail.
//
// Marking as UNSUPPORTED instead of XFAIL to avoid spurious failures/successes
// depending on the version of CMake used.
// TODO: Remove this when the library is built in c++2b mode.
// TODO: Remove this when the library is built in c++23 mode.
//
// UNSUPPORTED: windows-dll

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
__cpp_lib_constexpr_algorithms 201806L [C++20]
__cpp_lib_parallel_algorithm 201603L [C++17]
__cpp_lib_ranges 202106L [C++20]
__cpp_lib_ranges_starts_ends_with 202106L [C++2b]
__cpp_lib_ranges_starts_ends_with 202106L [C++23]
__cpp_lib_robust_nonmodifying_seq_ops 201304L [C++14]
__cpp_lib_sample 201603L [C++17]
__cpp_lib_shift 201806L [C++20]
Expand Down Expand Up @@ -48,7 +48,7 @@
# endif

# ifdef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++2b"
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
# endif

# ifdef __cpp_lib_robust_nonmodifying_seq_ops
Expand Down Expand Up @@ -82,7 +82,7 @@
# endif

# ifdef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++2b"
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
# endif

# ifndef __cpp_lib_robust_nonmodifying_seq_ops
Expand Down Expand Up @@ -131,7 +131,7 @@
# endif

# ifdef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++2b"
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
# endif

# ifndef __cpp_lib_robust_nonmodifying_seq_ops
Expand Down Expand Up @@ -189,7 +189,7 @@
# endif

# ifdef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++2b"
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
# endif

# ifndef __cpp_lib_robust_nonmodifying_seq_ops
Expand All @@ -216,25 +216,25 @@
#elif TEST_STD_VER > 20

# ifndef __cpp_lib_clamp
# error "__cpp_lib_clamp should be defined in c++2b"
# error "__cpp_lib_clamp should be defined in c++23"
# endif
# if __cpp_lib_clamp != 201603L
# error "__cpp_lib_clamp should have the value 201603L in c++2b"
# error "__cpp_lib_clamp should have the value 201603L in c++23"
# endif

# ifndef __cpp_lib_constexpr_algorithms
# error "__cpp_lib_constexpr_algorithms should be defined in c++2b"
# error "__cpp_lib_constexpr_algorithms should be defined in c++23"
# endif
# if __cpp_lib_constexpr_algorithms != 201806L
# error "__cpp_lib_constexpr_algorithms should have the value 201806L in c++2b"
# error "__cpp_lib_constexpr_algorithms should have the value 201806L in c++23"
# endif

# if !defined(_LIBCPP_VERSION)
# ifndef __cpp_lib_parallel_algorithm
# error "__cpp_lib_parallel_algorithm should be defined in c++2b"
# error "__cpp_lib_parallel_algorithm should be defined in c++23"
# endif
# if __cpp_lib_parallel_algorithm != 201603L
# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++2b"
# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++23"
# endif
# else // _LIBCPP_VERSION
# ifdef __cpp_lib_parallel_algorithm
Expand All @@ -243,18 +243,18 @@
# endif

# ifndef __cpp_lib_ranges
# error "__cpp_lib_ranges should be defined in c++2b"
# error "__cpp_lib_ranges should be defined in c++23"
# endif
# if __cpp_lib_ranges != 202106L
# error "__cpp_lib_ranges should have the value 202106L in c++2b"
# error "__cpp_lib_ranges should have the value 202106L in c++23"
# endif

# if !defined(_LIBCPP_VERSION)
# ifndef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should be defined in c++2b"
# error "__cpp_lib_ranges_starts_ends_with should be defined in c++23"
# endif
# if __cpp_lib_ranges_starts_ends_with != 202106L
# error "__cpp_lib_ranges_starts_ends_with should have the value 202106L in c++2b"
# error "__cpp_lib_ranges_starts_ends_with should have the value 202106L in c++23"
# endif
# else // _LIBCPP_VERSION
# ifdef __cpp_lib_ranges_starts_ends_with
Expand All @@ -263,24 +263,24 @@
# endif

# ifndef __cpp_lib_robust_nonmodifying_seq_ops
# error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++2b"
# error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++23"
# endif
# if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
# error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++2b"
# error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++23"
# endif

# ifndef __cpp_lib_sample
# error "__cpp_lib_sample should be defined in c++2b"
# error "__cpp_lib_sample should be defined in c++23"
# endif
# if __cpp_lib_sample != 201603L
# error "__cpp_lib_sample should have the value 201603L in c++2b"
# error "__cpp_lib_sample should have the value 201603L in c++23"
# endif

# ifndef __cpp_lib_shift
# error "__cpp_lib_shift should be defined in c++2b"
# error "__cpp_lib_shift should be defined in c++23"
# endif
# if __cpp_lib_shift != 201806L
# error "__cpp_lib_shift should have the value 201806L in c++2b"
# error "__cpp_lib_shift should have the value 201806L in c++23"
# endif

#endif // TEST_STD_VER > 20
Expand Down
Loading

0 comments on commit 7140050

Please sign in to comment.