From 93759029ce8f6743d22bdbce5244b6420291d8d9 Mon Sep 17 00:00:00 2001 From: Jakub Mazurkiewicz Date: Wed, 10 Apr 2024 23:12:22 +0200 Subject: [PATCH] [libc++] Follow-up to "Poison Pills are Too Toxic" * Some docs should've been updated in #74534, this PR does this. * #89148 should've bumped `__cpp_lib_ranges` macro to 202211 (value mentioned by "P2602R2 Poison Pills are Too Toxic") * Drive-by: fix order of notes in `Cxx23.rst` --- libcxx/docs/FeatureTestMacroTable.rst | 2 ++ libcxx/docs/ReleaseNotes/19.rst | 1 + libcxx/docs/Status/Cxx23.rst | 3 ++- libcxx/docs/Status/Cxx23Papers.csv | 2 +- libcxx/include/version | 5 ++++- .../algorithm.version.compile.pass.cpp | 9 +++++---- .../functional.version.compile.pass.cpp | 9 +++++---- .../iterator.version.compile.pass.cpp | 9 +++++---- .../memory.version.compile.pass.cpp | 9 +++++---- .../ranges.version.compile.pass.cpp | 9 +++++---- .../version.version.compile.pass.cpp | 9 +++++---- libcxx/utils/generate_feature_test_macro_components.py | 5 ++++- 12 files changed, 44 insertions(+), 28 deletions(-) diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst index 17b3476d2c869e..44401f7db5ed64 100644 --- a/libcxx/docs/FeatureTestMacroTable.rst +++ b/libcxx/docs/FeatureTestMacroTable.rst @@ -350,6 +350,8 @@ Status ---------------------------------------------------------- ----------------- ``__cpp_lib_print`` ``202207L`` ---------------------------------------------------------- ----------------- + ``__cpp_lib_ranges`` ``202211L`` + ---------------------------------------------------------- ----------------- ``__cpp_lib_ranges_as_const`` *unimplemented* ---------------------------------------------------------- ----------------- ``__cpp_lib_ranges_as_rvalue`` ``202207L`` diff --git a/libcxx/docs/ReleaseNotes/19.rst b/libcxx/docs/ReleaseNotes/19.rst index 83fcd40bb80cc6..9d3f4b6aff9bc2 100644 --- a/libcxx/docs/ReleaseNotes/19.rst +++ b/libcxx/docs/ReleaseNotes/19.rst @@ -53,6 +53,7 @@ Implemented Papers - P2387R3 - Pipe support for user-defined range adaptors - P2713R1 - Escaping improvements in ``std::format`` - P2231R1 - Missing ``constexpr`` in ``std::optional`` and ``std::variant`` +- P2602R2 - Poison Pills are Too Toxic (as DR against C++20) Improvements and New Features ----------------------------- diff --git a/libcxx/docs/Status/Cxx23.rst b/libcxx/docs/Status/Cxx23.rst index 23d30c8128d71e..e9395fae141e2e 100644 --- a/libcxx/docs/Status/Cxx23.rst +++ b/libcxx/docs/Status/Cxx23.rst @@ -44,8 +44,9 @@ Paper Status .. [#note-P1413R3] P1413R3: ``std::aligned_storage_t`` and ``std::aligned_union_t`` are marked deprecated, but clang doesn't issue a diagnostic for deprecated using template declarations. .. [#note-P2520R0] P2520R0: Libc++ implemented this paper as a DR in C++20 as well. - .. [#note-P2711R1] P2711R1: ``join_with_view`` hasn't been done yet since this type isn't implemented yet. + .. [#note-P2602R2] P2602R2: Libc++ implemented this paper as a DR in C++20 as well. .. [#note-P2770R0] P2770R0: ``join_with_view`` hasn't been done yet since this type isn't implemented yet. + .. [#note-P2711R1] P2711R1: ``join_with_view`` hasn't been done yet since this type isn't implemented yet. .. [#note-P2693R1] P2693R1: The formatter for ``std::thread::id`` is implemented. The formatter for ``stacktrace`` is not implemented, since ``stacktrace`` is not implemented yet. diff --git a/libcxx/docs/Status/Cxx23Papers.csv b/libcxx/docs/Status/Cxx23Papers.csv index 01387a404f5d67..c03eed1b4d37e8 100644 --- a/libcxx/docs/Status/Cxx23Papers.csv +++ b/libcxx/docs/Status/Cxx23Papers.csv @@ -100,7 +100,7 @@ "`P2396R1 `__","LWG", "Concurrency TS 2 fixes ", "November 2022","","","|concurrency TS|" "`P2505R5 `__","LWG", "Monadic Functions for ``std::expected``", "November 2022","|Complete|","17.0","" "`P2539R4 `__","LWG", "Should the output of ``std::print`` to a terminal be synchronized with the underlying stream?", "November 2022","|Complete|","18.0","|format|" -"`P2602R2 `__","LWG", "Poison Pills are Too Toxic", "November 2022","|Complete|","19.0","|ranges|" +"`P2602R2 `__","LWG", "Poison Pills are Too Toxic", "November 2022","|Complete| [#note-P2602R2]_","19.0","|ranges| |DR|" "`P2708R1 `__","LWG", "No Further Fundamentals TSes", "November 2022","|Nothing to do|","","" "","","","","","","" "`P0290R4 `__","LWG", "``apply()`` for ``synchronized_value``","February 2023","","","|concurrency TS|" diff --git a/libcxx/include/version b/libcxx/include/version index ba116957b033f5..281a70e371bba1 100644 --- a/libcxx/include/version +++ b/libcxx/include/version @@ -175,8 +175,9 @@ __cpp_lib_parallel_algorithm 201603L __cpp_lib_print 202207L __cpp_lib_quoted_string_io 201304L -__cpp_lib_ranges 202207L +__cpp_lib_ranges 202211L + 202207L // C++20 __cpp_lib_ranges_as_const 202207L __cpp_lib_ranges_as_rvalue 202207L __cpp_lib_ranges_chunk 202202L @@ -472,6 +473,8 @@ __cpp_lib_within_lifetime 202306L # define __cpp_lib_optional 202110L // # define __cpp_lib_out_ptr 202106L # define __cpp_lib_print 202207L +# undef __cpp_lib_ranges +# define __cpp_lib_ranges 202211L // # define __cpp_lib_ranges_as_const 202207L # define __cpp_lib_ranges_as_rvalue 202207L // # define __cpp_lib_ranges_chunk 202202L diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/algorithm.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/algorithm.version.compile.pass.cpp index 8ccd252115ac82..3562eaf87cb6b7 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/algorithm.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/algorithm.version.compile.pass.cpp @@ -22,6 +22,7 @@ __cpp_lib_freestanding_algorithm 202311L [C++26] __cpp_lib_parallel_algorithm 201603L [C++17] __cpp_lib_ranges 202207L [C++20] + 202211L [C++23] __cpp_lib_ranges_contains 202207L [C++23] __cpp_lib_ranges_starts_ends_with 202106L [C++23] __cpp_lib_robust_nonmodifying_seq_ops 201304L [C++14] @@ -304,8 +305,8 @@ # ifndef __cpp_lib_ranges # error "__cpp_lib_ranges should be defined in c++23" # endif -# if __cpp_lib_ranges != 202207L -# error "__cpp_lib_ranges should have the value 202207L in c++23" +# if __cpp_lib_ranges != 202211L +# error "__cpp_lib_ranges should have the value 202211L in c++23" # endif # ifndef __cpp_lib_ranges_contains @@ -401,8 +402,8 @@ # ifndef __cpp_lib_ranges # error "__cpp_lib_ranges should be defined in c++26" # endif -# if __cpp_lib_ranges != 202207L -# error "__cpp_lib_ranges should have the value 202207L in c++26" +# if __cpp_lib_ranges != 202211L +# error "__cpp_lib_ranges should have the value 202211L in c++26" # endif # ifndef __cpp_lib_ranges_contains diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.compile.pass.cpp index 27e76e5b2b05a3..3c6a23aadc449b 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.compile.pass.cpp @@ -28,6 +28,7 @@ __cpp_lib_move_only_function 202110L [C++23] __cpp_lib_not_fn 201603L [C++17] __cpp_lib_ranges 202207L [C++20] + 202211L [C++23] __cpp_lib_reference_wrapper 202403L [C++26] __cpp_lib_result_of_sfinae 201210L [C++14] __cpp_lib_transparent_operators 201210L [C++14] @@ -409,8 +410,8 @@ # ifndef __cpp_lib_ranges # error "__cpp_lib_ranges should be defined in c++23" # endif -# if __cpp_lib_ranges != 202207L -# error "__cpp_lib_ranges should have the value 202207L in c++23" +# if __cpp_lib_ranges != 202211L +# error "__cpp_lib_ranges should have the value 202211L in c++23" # endif # ifdef __cpp_lib_reference_wrapper @@ -531,8 +532,8 @@ # ifndef __cpp_lib_ranges # error "__cpp_lib_ranges should be defined in c++26" # endif -# if __cpp_lib_ranges != 202207L -# error "__cpp_lib_ranges should have the value 202207L in c++26" +# if __cpp_lib_ranges != 202211L +# error "__cpp_lib_ranges should have the value 202211L in c++26" # endif # ifndef __cpp_lib_reference_wrapper diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.compile.pass.cpp index 700907ce9bb071..0ea31289e32615 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.compile.pass.cpp @@ -24,6 +24,7 @@ __cpp_lib_nonmember_container_access 201411L [C++17] __cpp_lib_null_iterators 201304L [C++14] __cpp_lib_ranges 202207L [C++20] + 202211L [C++23] __cpp_lib_ssize 201902L [C++20] */ @@ -255,8 +256,8 @@ # ifndef __cpp_lib_ranges # error "__cpp_lib_ranges should be defined in c++23" # endif -# if __cpp_lib_ranges != 202207L -# error "__cpp_lib_ranges should have the value 202207L in c++23" +# if __cpp_lib_ranges != 202211L +# error "__cpp_lib_ranges should have the value 202211L in c++23" # endif # ifndef __cpp_lib_ssize @@ -313,8 +314,8 @@ # ifndef __cpp_lib_ranges # error "__cpp_lib_ranges should be defined in c++26" # endif -# if __cpp_lib_ranges != 202207L -# error "__cpp_lib_ranges should have the value 202207L in c++26" +# if __cpp_lib_ranges != 202211L +# error "__cpp_lib_ranges should have the value 202211L in c++26" # endif # ifndef __cpp_lib_ssize diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp index 45d9271faa5783..8dbef8d64f1f22 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp @@ -29,6 +29,7 @@ __cpp_lib_out_ptr 202106L [C++23] 202311L [C++26] __cpp_lib_ranges 202207L [C++20] + 202211L [C++23] __cpp_lib_raw_memory_algorithms 201606L [C++17] __cpp_lib_shared_ptr_arrays 201611L [C++17] 201707L [C++20] @@ -501,8 +502,8 @@ # ifndef __cpp_lib_ranges # error "__cpp_lib_ranges should be defined in c++23" # endif -# if __cpp_lib_ranges != 202207L -# error "__cpp_lib_ranges should have the value 202207L in c++23" +# if __cpp_lib_ranges != 202211L +# error "__cpp_lib_ranges should have the value 202211L in c++23" # endif # ifndef __cpp_lib_raw_memory_algorithms @@ -638,8 +639,8 @@ # ifndef __cpp_lib_ranges # error "__cpp_lib_ranges should be defined in c++26" # endif -# if __cpp_lib_ranges != 202207L -# error "__cpp_lib_ranges should have the value 202207L in c++26" +# if __cpp_lib_ranges != 202211L +# error "__cpp_lib_ranges should have the value 202211L in c++26" # endif # ifndef __cpp_lib_raw_memory_algorithms diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/ranges.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/ranges.version.compile.pass.cpp index 30feacd796d8e1..75b2ef57143fcd 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/ranges.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/ranges.version.compile.pass.cpp @@ -18,6 +18,7 @@ /* Constant Value __cpp_lib_default_template_type_for_algorithm_values 202403L [C++26] __cpp_lib_ranges 202207L [C++20] + 202211L [C++23] __cpp_lib_ranges_as_const 202207L [C++23] __cpp_lib_ranges_as_rvalue 202207L [C++23] __cpp_lib_ranges_chunk 202202L [C++23] @@ -245,8 +246,8 @@ # ifndef __cpp_lib_ranges # error "__cpp_lib_ranges should be defined in c++23" # endif -# if __cpp_lib_ranges != 202207L -# error "__cpp_lib_ranges should have the value 202207L in c++23" +# if __cpp_lib_ranges != 202211L +# error "__cpp_lib_ranges should have the value 202211L in c++23" # endif # if !defined(_LIBCPP_VERSION) @@ -364,8 +365,8 @@ # ifndef __cpp_lib_ranges # error "__cpp_lib_ranges should be defined in c++26" # endif -# if __cpp_lib_ranges != 202207L -# error "__cpp_lib_ranges should have the value 202207L in c++26" +# if __cpp_lib_ranges != 202211L +# error "__cpp_lib_ranges should have the value 202211L in c++26" # endif # if !defined(_LIBCPP_VERSION) diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp index d7035d7e5e3ad8..8a412f78f12a6a 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp @@ -159,6 +159,7 @@ __cpp_lib_print 202207L [C++23] __cpp_lib_quoted_string_io 201304L [C++14] __cpp_lib_ranges 202207L [C++20] + 202211L [C++23] __cpp_lib_ranges_as_const 202207L [C++23] __cpp_lib_ranges_as_rvalue 202207L [C++23] __cpp_lib_ranges_chunk 202202L [C++23] @@ -5495,8 +5496,8 @@ # ifndef __cpp_lib_ranges # error "__cpp_lib_ranges should be defined in c++23" # endif -# if __cpp_lib_ranges != 202207L -# error "__cpp_lib_ranges should have the value 202207L in c++23" +# if __cpp_lib_ranges != 202211L +# error "__cpp_lib_ranges should have the value 202211L in c++23" # endif # if !defined(_LIBCPP_VERSION) @@ -7287,8 +7288,8 @@ # ifndef __cpp_lib_ranges # error "__cpp_lib_ranges should be defined in c++26" # endif -# if __cpp_lib_ranges != 202207L -# error "__cpp_lib_ranges should have the value 202207L in c++26" +# if __cpp_lib_ranges != 202211L +# error "__cpp_lib_ranges should have the value 202211L in c++26" # endif # if !defined(_LIBCPP_VERSION) diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py index d0171c84acbc32..6bdc555771c5ca 100755 --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -938,7 +938,10 @@ def add_version_header(tc): }, { "name": "__cpp_lib_ranges", - "values": {"c++20": 202207}, + "values": { + "c++20": 202207, + "c++23": 202211, # P2602R2 Poison Pills are Too Toxic + }, "headers": ["algorithm", "functional", "iterator", "memory", "ranges"], }, {