[libcxx-commits] [libcxx] b237354 - [libc++][format] Mark range formaters as complete.
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Apr 11 09:47:16 PDT 2023
Author: Mark de Wever
Date: 2023-04-11T18:47:11+02:00
New Revision: b23735407008948829ab24036d979427ddbbe121
URL: https://github.com/llvm/llvm-project/commit/b23735407008948829ab24036d979427ddbbe121
DIFF: https://github.com/llvm/llvm-project/commit/b23735407008948829ab24036d979427ddbbe121.diff
LOG: [libc++][format] Mark range formaters as complete.
The __cpp_lib_format_ranges feature-test macro only depends on P2286R8
and P2585R0. Note since LWG3750 only affects these two C++23 papers
there is nothing to do for older language versions.
(The __cpp_lib_format feature-test macro depends on the incomplete
formatting for chrono. So this part can't be marked as complete yet.)
This completes
- P2286R8 Formatting ranges
- P2585R0 Improving default container formatting
This partly implements
- LWG3750 Too many papers bump __cpp_lib_format
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D147880
Added:
Modified:
libcxx/docs/FeatureTestMacroTable.rst
libcxx/docs/Status/Cxx2b.rst
libcxx/docs/Status/Cxx2bIssues.csv
libcxx/docs/Status/Cxx2bPapers.csv
libcxx/docs/Status/FormatIssues.csv
libcxx/include/version
libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
libcxx/utils/generate_feature_test_macro_components.py
Removed:
################################################################################
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index c3be76bd7697a..677a71922bd0b 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -322,6 +322,8 @@ Status
------------------------------------------------- -----------------
``__cpp_lib_expected`` ``202202L``
------------------------------------------------- -----------------
+ ``__cpp_lib_format_ranges`` ``202207L``
+ ------------------------------------------------- -----------------
``__cpp_lib_formatters`` *unimplemented*
------------------------------------------------- -----------------
``__cpp_lib_forward_like`` ``202207L``
diff --git a/libcxx/docs/Status/Cxx2b.rst b/libcxx/docs/Status/Cxx2b.rst
index cd425b1667a03..df915d828e6d9 100644
--- a/libcxx/docs/Status/Cxx2b.rst
+++ b/libcxx/docs/Status/Cxx2b.rst
@@ -60,4 +60,5 @@ Library Working Group Issues Status
.. note::
+ .. [#note-LWG3750] LWG3750 Only ``__cpp_lib_format_ranges`` is fully implemented.
.. [#note-LWG3798] LWG3798: ``join_with_view``, ``zip_transform_view``, and ``adjacent_transform_view`` haven't been done yet since these types aren't implemented yet.
diff --git a/libcxx/docs/Status/Cxx2bIssues.csv b/libcxx/docs/Status/Cxx2bIssues.csv
index 7354cec1509ee..8fa96fe2cb658 100644
--- a/libcxx/docs/Status/Cxx2bIssues.csv
+++ b/libcxx/docs/Status/Cxx2bIssues.csv
@@ -208,7 +208,7 @@
"`3745 <https://wg21.link/LWG3745>`__","``std::atomic_wait`` and its friends lack ``noexcept``", "November 2022","|Complete|","16.0",""
"`3746 <https://wg21.link/LWG3746>`__","``optional``'s spaceship with ``U`` with a type derived from optional causes infinite constraint meta-recursion", "November 2022","","","|spaceship|"
"`3747 <https://wg21.link/LWG3747>`__","``ranges::uninitialized_copy_n``, ``ranges::uninitialized_move_n``, and ``ranges::destroy_n`` should use ``std::move``", "November 2022","","","|ranges|"
-"`3750 <https://wg21.link/LWG3750>`__","Too many papers bump ``__cpp_lib_format``", "November 2022","","","|format|"
+"`3750 <https://wg21.link/LWG3750>`__","Too many papers bump ``__cpp_lib_format``", "November 2022","|Partial| [#note-LWG3750]_","","|format|"
"`3751 <https://wg21.link/LWG3751>`__","Missing feature macro for ``flat_set``", "November 2022","","","|flat_containers|"
"`3753 <https://wg21.link/LWG3753>`__","Clarify entity vs. freestanding entity", "November 2022","","",""
"`3754 <https://wg21.link/LWG3754>`__","Class template expected synopsis contains declarations that do not match the detailed description", "November 2022","|Nothing to do|","",""
diff --git a/libcxx/docs/Status/Cxx2bPapers.csv b/libcxx/docs/Status/Cxx2bPapers.csv
index 9bf09b36dd574..47ea734ec52f5 100644
--- a/libcxx/docs/Status/Cxx2bPapers.csv
+++ b/libcxx/docs/Status/Cxx2bPapers.csv
@@ -89,7 +89,7 @@
"`P2549R1 <https://wg21.link/P2549R1>`__","LWG","``std::unexpected`` should have ``error()`` as member accessor","July 2022","|Complete|","16.0"
"`P2553R1 <https://wg21.link/P2553R1>`__","LWG","Make ``mdspan`` ``size_type`` controllable","July 2022","",""
"`P2554R0 <https://wg21.link/P2554R0>`__","LWG","C-Array Interoperability of MDSpan","July 2022","",""
-"`P2585R0 <https://wg21.link/P2585R0>`__","LWG","Improving default container formatting","July 2022","|Partial|",""
+"`P2585R0 <https://wg21.link/P2585R0>`__","LWG","Improving default container formatting","July 2022","|Complete|","17.0"
"`P2590R2 <https://wg21.link/P2590R2>`__","LWG","Explicit lifetime management","July 2022","",""
"`P2599R2 <https://wg21.link/P2599R2>`__","LWG","``mdspan::size_type`` should be ``index_type``","July 2022","",""
"`P2604R0 <https://wg21.link/P2604R0>`__","LWG","mdspan: rename pointer and contiguous","July 2022","",""
diff --git a/libcxx/docs/Status/FormatIssues.csv b/libcxx/docs/Status/FormatIssues.csv
index 28aa60e6a6027..f072ce08ebfad 100644
--- a/libcxx/docs/Status/FormatIssues.csv
+++ b/libcxx/docs/Status/FormatIssues.csv
@@ -8,7 +8,7 @@ Number,Name,Standard,Assignee,Status,First released version
"`P2093R14 <https://wg21.link/P2093R14>`__","Formatted output","C++23"
"`P2286R8 <https://wg21.link/P2286R8>`__","Formatting Ranges","C++23","Mark de Wever","|Complete|",Clang 16
"`P2508R1 <https://wg21.link/P2508R1>`__","Exposing ``std::basic-format-string``","C++23","Mark de Wever","|Complete|", Clang 15
-"`P2585R0 <https://wg21.link/P2585R0>`__","Improving default container formatting","C++23","Mark de Wever","|In progress|"
+"`P2585R0 <https://wg21.link/P2585R0>`__","Improving default container formatting","C++23","Mark de Wever","|Complete|", Clang 17
"`P2539R4 <https://wg21.link/P2539R4>`__","Should the output of ``std::print`` to a terminal be synchronized with the underlying stream?","C++23"
"`P2713R1 <https://wg21.link/P2713R1>`__","Escaping improvements in ``std::format``","C++23","Mark de Wever",""
"`P2675R1 <https://wg21.link/P2675R1>`__","``format``'s width estimation is too approximate and not forward compatible","C++23","Mark de Wever",""
diff --git a/libcxx/include/version b/libcxx/include/version
index f9527cf2bdd83..f58b51e49feeb 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -85,6 +85,7 @@ __cpp_lib_execution 201902L <execution>
__cpp_lib_expected 202202L <expected>
__cpp_lib_filesystem 201703L <filesystem>
__cpp_lib_format 202106L <format>
+__cpp_lib_format_ranges 202207L <format>
__cpp_lib_formatters 202302L <stacktrace> <thread>
__cpp_lib_forward_like 202207L <utility>
__cpp_lib_gcd_lcm 201606L <numeric>
@@ -398,7 +399,10 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_constexpr_memory 202202L
# define __cpp_lib_constexpr_typeinfo 202106L
# define __cpp_lib_expected 202202L
-# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
+# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
+# define __cpp_lib_format_ranges 202207L
+# endif
+# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
// # define __cpp_lib_formatters 202302L
# endif
# define __cpp_lib_forward_like 202207L
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp
index 7e183311bceca..279361b6be552 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp
@@ -17,8 +17,9 @@
// Test the feature test macros defined by <format>
-/* Constant Value
- __cpp_lib_format 202106L [C++20]
+/* Constant Value
+ __cpp_lib_format 202106L [C++20]
+ __cpp_lib_format_ranges 202207L [C++2b]
*/
#include <format>
@@ -30,18 +31,30 @@
# error "__cpp_lib_format should not be defined before c++20"
# endif
+# ifdef __cpp_lib_format_ranges
+# error "__cpp_lib_format_ranges should not be defined before c++2b"
+# endif
+
#elif TEST_STD_VER == 14
# ifdef __cpp_lib_format
# error "__cpp_lib_format should not be defined before c++20"
# endif
+# ifdef __cpp_lib_format_ranges
+# error "__cpp_lib_format_ranges should not be defined before c++2b"
+# endif
+
#elif TEST_STD_VER == 17
# ifdef __cpp_lib_format
# error "__cpp_lib_format should not be defined before c++20"
# endif
+# ifdef __cpp_lib_format_ranges
+# error "__cpp_lib_format_ranges should not be defined before c++2b"
+# endif
+
#elif TEST_STD_VER == 20
# if !defined(_LIBCPP_VERSION)
@@ -57,6 +70,10 @@
# endif
# endif
+# ifdef __cpp_lib_format_ranges
+# error "__cpp_lib_format_ranges should not be defined before c++2b"
+# endif
+
#elif TEST_STD_VER > 20
# if !defined(_LIBCPP_VERSION)
@@ -72,5 +89,18 @@
# endif
# endif
+# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
+# ifndef __cpp_lib_format_ranges
+# error "__cpp_lib_format_ranges should be defined in c++2b"
+# endif
+# if __cpp_lib_format_ranges != 202207L
+# error "__cpp_lib_format_ranges should have the value 202207L in c++2b"
+# endif
+# else
+# ifdef __cpp_lib_format_ranges
+# error "__cpp_lib_format_ranges should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)' is not met!"
+# endif
+# endif
+
#endif // TEST_STD_VER > 20
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 59c9fa402579b..a289eebb43093 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
@@ -79,6 +79,7 @@
__cpp_lib_expected 202202L [C++2b]
__cpp_lib_filesystem 201703L [C++17]
__cpp_lib_format 202106L [C++20]
+ __cpp_lib_format_ranges 202207L [C++2b]
__cpp_lib_formatters 202302L [C++2b]
__cpp_lib_forward_like 202207L [C++2b]
__cpp_lib_gcd_lcm 201606L [C++17]
@@ -432,6 +433,10 @@
# error "__cpp_lib_format should not be defined before c++20"
# endif
+# ifdef __cpp_lib_format_ranges
+# error "__cpp_lib_format_ranges should not be defined before c++2b"
+# endif
+
# ifdef __cpp_lib_formatters
# error "__cpp_lib_formatters should not be defined before c++2b"
# endif
@@ -1091,6 +1096,10 @@
# error "__cpp_lib_format should not be defined before c++20"
# endif
+# ifdef __cpp_lib_format_ranges
+# error "__cpp_lib_format_ranges should not be defined before c++2b"
+# endif
+
# ifdef __cpp_lib_formatters
# error "__cpp_lib_formatters should not be defined before c++2b"
# endif
@@ -1864,6 +1873,10 @@
# error "__cpp_lib_format should not be defined before c++20"
# endif
+# ifdef __cpp_lib_format_ranges
+# error "__cpp_lib_format_ranges should not be defined before c++2b"
+# endif
+
# ifdef __cpp_lib_formatters
# error "__cpp_lib_formatters should not be defined before c++2b"
# endif
@@ -2916,6 +2929,10 @@
# endif
# endif
+# ifdef __cpp_lib_format_ranges
+# error "__cpp_lib_format_ranges should not be defined before c++2b"
+# endif
+
# ifdef __cpp_lib_formatters
# error "__cpp_lib_formatters should not be defined before c++2b"
# endif
@@ -4157,6 +4174,19 @@
# endif
# endif
+# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
+# ifndef __cpp_lib_format_ranges
+# error "__cpp_lib_format_ranges should be defined in c++2b"
+# endif
+# if __cpp_lib_format_ranges != 202207L
+# error "__cpp_lib_format_ranges should have the value 202207L in c++2b"
+# endif
+# else
+# ifdef __cpp_lib_format_ranges
+# error "__cpp_lib_format_ranges should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)' is not met!"
+# endif
+# endif
+
# if !defined(_LIBCPP_VERSION)
# ifndef __cpp_lib_formatters
# error "__cpp_lib_formatters should be defined in c++2b"
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index d617352b2cfcd..fb59395115e35 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -327,12 +327,18 @@ def add_version_header(tc):
"test_suite_guard": "!defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)",
"libcxx_guard": "!defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)",
"unimplemented": True,
+ }, {
+ "name": "__cpp_lib_format_ranges",
+ "values": { "c++2b": 202207 },
+ "headers": ["format"],
+ "test_suite_guard": "!defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)",
+ "libcxx_guard": "!defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)",
}, {
"name": "__cpp_lib_formatters",
"values": { "c++2b": 202302 },
"headers": ["stacktrace", "thread"],
- "test_suite_guard": "!defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)",
- "libcxx_guard": "!defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)",
+ "test_suite_guard": "!defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)",
+ "libcxx_guard": "!defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)",
"unimplemented": True,
}, {
"name": "__cpp_lib_forward_like",
More information about the libcxx-commits
mailing list