Skip to content

[libc++] Fix P1206R7 feature test macros #90914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 4, 2024

Conversation

krzysdz
Copy link
Contributor

@krzysdz krzysdz commented May 2, 2024

  • Add missing __cpp_lib_containers_ranges feature test macro
  • Constrain __cpp_lib_ranges_to_container to the <ranges> header, since the standard does not list it in containers' headers

Ref:

@krzysdz krzysdz requested a review from a team as a code owner May 2, 2024 23:08
Copy link

github-actions bot commented May 2, 2024

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label May 2, 2024
@llvmbot
Copy link
Member

llvmbot commented May 2, 2024

@llvm/pr-subscribers-libcxx

Author: None (krzysdz)

Changes
  • Add missing __cpp_lib_containers_ranges feature test macro
  • Constrain __cpp_lib_ranges_to_container to the &lt;ranges&gt; header, since the standard does not list it in containers' headers

Ref:


Patch is 68.53 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/90914.diff

15 Files Affected:

  • (modified) libcxx/docs/FeatureTestMacroTable.rst (+2)
  • (modified) libcxx/include/version (+6-4)
  • (modified) libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp (+31-31)
  • (modified) libcxx/test/std/language.support/support.limits/support.limits.general/forward_list.version.compile.pass.cpp (+31-31)
  • (modified) libcxx/test/std/language.support/support.limits/support.limits.general/list.version.compile.pass.cpp (+31-31)
  • (modified) libcxx/test/std/language.support/support.limits/support.limits.general/map.version.compile.pass.cpp (+31-31)
  • (modified) libcxx/test/std/language.support/support.limits/support.limits.general/queue.version.compile.pass.cpp (+17-17)
  • (modified) libcxx/test/std/language.support/support.limits/support.limits.general/set.version.compile.pass.cpp (+31-31)
  • (modified) libcxx/test/std/language.support/support.limits/support.limits.general/stack.version.compile.pass.cpp (+17-17)
  • (modified) libcxx/test/std/language.support/support.limits/support.limits.general/string.version.compile.pass.cpp (+31-31)
  • (modified) libcxx/test/std/language.support/support.limits/support.limits.general/unordered_map.version.compile.pass.cpp (+31-31)
  • (modified) libcxx/test/std/language.support/support.limits/support.limits.general/unordered_set.version.compile.pass.cpp (+31-31)
  • (modified) libcxx/test/std/language.support/support.limits/support.limits.general/vector.version.compile.pass.cpp (+31-31)
  • (modified) libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp (+31)
  • (modified) libcxx/utils/generate_feature_test_macro_components.py (+18-14)
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index 3197d2cd1b271c..1032a9c338f455 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -322,6 +322,8 @@ Status
     ---------------------------------------------------------- -----------------
     ``__cpp_lib_constexpr_typeinfo``                           ``202106L``
     ---------------------------------------------------------- -----------------
+    ``__cpp_lib_containers_ranges``                            ``202202L``
+    ---------------------------------------------------------- -----------------
     ``__cpp_lib_expected``                                     ``202211L``
     ---------------------------------------------------------- -----------------
     ``__cpp_lib_format_path``                                  *unimplemented*
diff --git a/libcxx/include/version b/libcxx/include/version
index 0ed77345baa71d..eb5fd5c8057843 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -79,6 +79,10 @@ __cpp_lib_constexpr_utility                             201811L <utility>
 __cpp_lib_constexpr_vector                              201907L <vector>
 __cpp_lib_constrained_equality                          202403L <optional> <tuple> <utility>
                                                                 <variant>
+__cpp_lib_containers_ranges                             202202L <deque> <forward_list> <list>
+                                                                <map> <queue> <set>
+                                                                <stack> <string> <unordered_map>
+                                                                <unordered_set> <vector>
 __cpp_lib_copyable_function                             202306L <functional>
 __cpp_lib_coroutine                                     201902L <coroutine>
 __cpp_lib_debugging                                     202311L <debugging>
@@ -184,10 +188,7 @@ __cpp_lib_ranges_join_with                              202202L <ranges>
 __cpp_lib_ranges_repeat                                 202207L <ranges>
 __cpp_lib_ranges_slide                                  202202L <ranges>
 __cpp_lib_ranges_starts_ends_with                       202106L <algorithm>
-__cpp_lib_ranges_to_container                           202202L <deque> <forward_list> <list>
-                                                                <map> <queue> <ranges>
-                                                                <set> <stack> <string>
-                                                                <unordered_map> <unordered_set> <vector>
+__cpp_lib_ranges_to_container                           202202L <ranges>
 __cpp_lib_ranges_zip                                    202110L <ranges> <tuple> <utility>
 __cpp_lib_ratio                                         202306L <ratio>
 __cpp_lib_raw_memory_algorithms                         201606L <memory>
@@ -456,6 +457,7 @@ __cpp_lib_within_lifetime                               202306L <type_traits>
 # undef  __cpp_lib_constexpr_memory
 # define __cpp_lib_constexpr_memory                     202202L
 # define __cpp_lib_constexpr_typeinfo                   202106L
+# define __cpp_lib_containers_ranges                    202202L
 # define __cpp_lib_expected                             202211L
 // # define __cpp_lib_format_path                          202403L
 # define __cpp_lib_format_ranges                        202207L
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp
index 720557f33e2a14..d0e4ac130c60eb 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp
@@ -17,10 +17,10 @@
 
 /*  Constant                                                Value
     __cpp_lib_allocator_traits_is_always_equal              201411L [C++17]
+    __cpp_lib_containers_ranges                             202202L [C++23]
     __cpp_lib_default_template_type_for_algorithm_values    202403L [C++26]
     __cpp_lib_erase_if                                      202002L [C++20]
     __cpp_lib_nonmember_container_access                    201411L [C++17]
-    __cpp_lib_ranges_to_container                           202202L [C++23]
 */
 
 #include <deque>
@@ -32,6 +32,10 @@
 #   error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
 # endif
 
+# ifdef __cpp_lib_containers_ranges
+#   error "__cpp_lib_containers_ranges should not be defined before c++23"
+# endif
+
 # ifdef __cpp_lib_default_template_type_for_algorithm_values
 #   error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
 # endif
@@ -44,16 +48,16 @@
 #   error "__cpp_lib_nonmember_container_access should not be defined before c++17"
 # endif
 
-# ifdef __cpp_lib_ranges_to_container
-#   error "__cpp_lib_ranges_to_container should not be defined before c++23"
-# endif
-
 #elif TEST_STD_VER == 14
 
 # ifdef __cpp_lib_allocator_traits_is_always_equal
 #   error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
 # endif
 
+# ifdef __cpp_lib_containers_ranges
+#   error "__cpp_lib_containers_ranges should not be defined before c++23"
+# endif
+
 # ifdef __cpp_lib_default_template_type_for_algorithm_values
 #   error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
 # endif
@@ -66,10 +70,6 @@
 #   error "__cpp_lib_nonmember_container_access should not be defined before c++17"
 # endif
 
-# ifdef __cpp_lib_ranges_to_container
-#   error "__cpp_lib_ranges_to_container should not be defined before c++23"
-# endif
-
 #elif TEST_STD_VER == 17
 
 # ifndef __cpp_lib_allocator_traits_is_always_equal
@@ -79,6 +79,10 @@
 #   error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
 # endif
 
+# ifdef __cpp_lib_containers_ranges
+#   error "__cpp_lib_containers_ranges should not be defined before c++23"
+# endif
+
 # ifdef __cpp_lib_default_template_type_for_algorithm_values
 #   error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
 # endif
@@ -94,10 +98,6 @@
 #   error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
 # endif
 
-# ifdef __cpp_lib_ranges_to_container
-#   error "__cpp_lib_ranges_to_container should not be defined before c++23"
-# endif
-
 #elif TEST_STD_VER == 20
 
 # ifndef __cpp_lib_allocator_traits_is_always_equal
@@ -107,6 +107,10 @@
 #   error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++20"
 # endif
 
+# ifdef __cpp_lib_containers_ranges
+#   error "__cpp_lib_containers_ranges should not be defined before c++23"
+# endif
+
 # ifdef __cpp_lib_default_template_type_for_algorithm_values
 #   error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
 # endif
@@ -125,10 +129,6 @@
 #   error "__cpp_lib_nonmember_container_access should have the value 201411L in c++20"
 # endif
 
-# ifdef __cpp_lib_ranges_to_container
-#   error "__cpp_lib_ranges_to_container should not be defined before c++23"
-# endif
-
 #elif TEST_STD_VER == 23
 
 # ifndef __cpp_lib_allocator_traits_is_always_equal
@@ -138,6 +138,13 @@
 #   error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++23"
 # endif
 
+# ifndef __cpp_lib_containers_ranges
+#   error "__cpp_lib_containers_ranges should be defined in c++23"
+# endif
+# if __cpp_lib_containers_ranges != 202202L
+#   error "__cpp_lib_containers_ranges should have the value 202202L in c++23"
+# endif
+
 # ifdef __cpp_lib_default_template_type_for_algorithm_values
 #   error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
 # endif
@@ -156,13 +163,6 @@
 #   error "__cpp_lib_nonmember_container_access should have the value 201411L in c++23"
 # endif
 
-# ifndef __cpp_lib_ranges_to_container
-#   error "__cpp_lib_ranges_to_container should be defined in c++23"
-# endif
-# if __cpp_lib_ranges_to_container != 202202L
-#   error "__cpp_lib_ranges_to_container should have the value 202202L in c++23"
-# endif
-
 #elif TEST_STD_VER > 23
 
 # ifndef __cpp_lib_allocator_traits_is_always_equal
@@ -172,6 +172,13 @@
 #   error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++26"
 # endif
 
+# ifndef __cpp_lib_containers_ranges
+#   error "__cpp_lib_containers_ranges should be defined in c++26"
+# endif
+# if __cpp_lib_containers_ranges != 202202L
+#   error "__cpp_lib_containers_ranges should have the value 202202L in c++26"
+# endif
+
 # if !defined(_LIBCPP_VERSION)
 #   ifndef __cpp_lib_default_template_type_for_algorithm_values
 #     error "__cpp_lib_default_template_type_for_algorithm_values should be defined in c++26"
@@ -199,12 +206,5 @@
 #   error "__cpp_lib_nonmember_container_access should have the value 201411L in c++26"
 # endif
 
-# ifndef __cpp_lib_ranges_to_container
-#   error "__cpp_lib_ranges_to_container should be defined in c++26"
-# endif
-# if __cpp_lib_ranges_to_container != 202202L
-#   error "__cpp_lib_ranges_to_container should have the value 202202L in c++26"
-# endif
-
 #endif // TEST_STD_VER > 23
 
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/forward_list.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/forward_list.version.compile.pass.cpp
index 9305cf0c54b959..bcb606451b27f6 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/forward_list.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/forward_list.version.compile.pass.cpp
@@ -17,12 +17,12 @@
 
 /*  Constant                                                Value
     __cpp_lib_allocator_traits_is_always_equal              201411L [C++17]
+    __cpp_lib_containers_ranges                             202202L [C++23]
     __cpp_lib_default_template_type_for_algorithm_values    202403L [C++26]
     __cpp_lib_erase_if                                      202002L [C++20]
     __cpp_lib_incomplete_container_elements                 201505L [C++17]
     __cpp_lib_list_remove_return_type                       201806L [C++20]
     __cpp_lib_nonmember_container_access                    201411L [C++17]
-    __cpp_lib_ranges_to_container                           202202L [C++23]
 */
 
 #include <forward_list>
@@ -34,6 +34,10 @@
 #   error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
 # endif
 
+# ifdef __cpp_lib_containers_ranges
+#   error "__cpp_lib_containers_ranges should not be defined before c++23"
+# endif
+
 # ifdef __cpp_lib_default_template_type_for_algorithm_values
 #   error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
 # endif
@@ -54,16 +58,16 @@
 #   error "__cpp_lib_nonmember_container_access should not be defined before c++17"
 # endif
 
-# ifdef __cpp_lib_ranges_to_container
-#   error "__cpp_lib_ranges_to_container should not be defined before c++23"
-# endif
-
 #elif TEST_STD_VER == 14
 
 # ifdef __cpp_lib_allocator_traits_is_always_equal
 #   error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
 # endif
 
+# ifdef __cpp_lib_containers_ranges
+#   error "__cpp_lib_containers_ranges should not be defined before c++23"
+# endif
+
 # ifdef __cpp_lib_default_template_type_for_algorithm_values
 #   error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
 # endif
@@ -84,10 +88,6 @@
 #   error "__cpp_lib_nonmember_container_access should not be defined before c++17"
 # endif
 
-# ifdef __cpp_lib_ranges_to_container
-#   error "__cpp_lib_ranges_to_container should not be defined before c++23"
-# endif
-
 #elif TEST_STD_VER == 17
 
 # ifndef __cpp_lib_allocator_traits_is_always_equal
@@ -97,6 +97,10 @@
 #   error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
 # endif
 
+# ifdef __cpp_lib_containers_ranges
+#   error "__cpp_lib_containers_ranges should not be defined before c++23"
+# endif
+
 # ifdef __cpp_lib_default_template_type_for_algorithm_values
 #   error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
 # endif
@@ -123,10 +127,6 @@
 #   error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
 # endif
 
-# ifdef __cpp_lib_ranges_to_container
-#   error "__cpp_lib_ranges_to_container should not be defined before c++23"
-# endif
-
 #elif TEST_STD_VER == 20
 
 # ifndef __cpp_lib_allocator_traits_is_always_equal
@@ -136,6 +136,10 @@
 #   error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++20"
 # endif
 
+# ifdef __cpp_lib_containers_ranges
+#   error "__cpp_lib_containers_ranges should not be defined before c++23"
+# endif
+
 # ifdef __cpp_lib_default_template_type_for_algorithm_values
 #   error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
 # endif
@@ -168,10 +172,6 @@
 #   error "__cpp_lib_nonmember_container_access should have the value 201411L in c++20"
 # endif
 
-# ifdef __cpp_lib_ranges_to_container
-#   error "__cpp_lib_ranges_to_container should not be defined before c++23"
-# endif
-
 #elif TEST_STD_VER == 23
 
 # ifndef __cpp_lib_allocator_traits_is_always_equal
@@ -181,6 +181,13 @@
 #   error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++23"
 # endif
 
+# ifndef __cpp_lib_containers_ranges
+#   error "__cpp_lib_containers_ranges should be defined in c++23"
+# endif
+# if __cpp_lib_containers_ranges != 202202L
+#   error "__cpp_lib_containers_ranges should have the value 202202L in c++23"
+# endif
+
 # ifdef __cpp_lib_default_template_type_for_algorithm_values
 #   error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
 # endif
@@ -213,13 +220,6 @@
 #   error "__cpp_lib_nonmember_container_access should have the value 201411L in c++23"
 # endif
 
-# ifndef __cpp_lib_ranges_to_container
-#   error "__cpp_lib_ranges_to_container should be defined in c++23"
-# endif
-# if __cpp_lib_ranges_to_container != 202202L
-#   error "__cpp_lib_ranges_to_container should have the value 202202L in c++23"
-# endif
-
 #elif TEST_STD_VER > 23
 
 # ifndef __cpp_lib_allocator_traits_is_always_equal
@@ -229,6 +229,13 @@
 #   error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++26"
 # endif
 
+# ifndef __cpp_lib_containers_ranges
+#   error "__cpp_lib_containers_ranges should be defined in c++26"
+# endif
+# if __cpp_lib_containers_ranges != 202202L
+#   error "__cpp_lib_containers_ranges should have the value 202202L in c++26"
+# endif
+
 # if !defined(_LIBCPP_VERSION)
 #   ifndef __cpp_lib_default_template_type_for_algorithm_values
 #     error "__cpp_lib_default_template_type_for_algorithm_values should be defined in c++26"
@@ -270,12 +277,5 @@
 #   error "__cpp_lib_nonmember_container_access should have the value 201411L in c++26"
 # endif
 
-# ifndef __cpp_lib_ranges_to_container
-#   error "__cpp_lib_ranges_to_container should be defined in c++26"
-# endif
-# if __cpp_lib_ranges_to_container != 202202L
-#   error "__cpp_lib_ranges_to_container should have the value 202202L in c++26"
-# endif
-
 #endif // TEST_STD_VER > 23
 
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/list.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/list.version.compile.pass.cpp
index 12225612b80d80..9cd3c3bc941c08 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/list.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/list.version.compile.pass.cpp
@@ -17,12 +17,12 @@
 
 /*  Constant                                                Value
     __cpp_lib_allocator_traits_is_always_equal              201411L [C++17]
+    __cpp_lib_containers_ranges                             202202L [C++23]
     __cpp_lib_default_template_type_for_algorithm_values    202403L [C++26]
     __cpp_lib_erase_if                                      202002L [C++20]
     __cpp_lib_incomplete_container_elements                 201505L [C++17]
     __cpp_lib_list_remove_return_type                       201806L [C++20]
     __cpp_lib_nonmember_container_access                    201411L [C++17]
-    __cpp_lib_ranges_to_container                           202202L [C++23]
 */
 
 #include <list>
@@ -34,6 +34,10 @@
 #   error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
 # endif
 
+# ifdef __cpp_lib_containers_ranges
+#   error "__cpp_lib_containers_ranges should not be defined before c++23"
+# endif
+
 # ifdef __cpp_lib_default_template_type_for_algorithm_values
 #   error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
 # endif
@@ -54,16 +58,16 @@
 #   error "__cpp_lib_nonmember_container_access should not be defined before c++17"
 # endif
 
-# ifdef __cpp_lib_ranges_to_container
-#   error "__cpp_lib_ranges_to_container should not be defined before c++23"
-# endif
-
 #elif TEST_STD_VER == 14
 
 # ifdef __cpp_lib_allocator_traits_is_always_equal
 #   error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
 # endif
 
+# ifdef __cpp_lib_containers_ranges
+#   error "__cpp_lib_containers_ranges should not be defined before c++23"
+# endif
+
 # ifdef __cpp_lib_default_template_type_for_algorithm_values
 #   error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
 # endif
@@ -84,10 +88,6 @@
 #   error "__cpp_lib_nonmember_container_access should not be defined before c++17"
 # endif
 
-# ifdef __cpp_lib_ranges_to_container
-#   error "__cpp_lib_ranges_to_container should not be defined before c++23"
-# endif
-
 #elif TEST_STD_VER == 17
 
 # ifndef __cpp_lib_allocator_traits_is_always_equal
@@ -97,6 +97,10 @@
 #   error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
 # endif
 
+# ifdef __cpp_lib_containers_ranges
+#   error "__cpp_lib_containers_ranges should not be defined before c++23"
+# endif
+
 # ifdef __cpp_lib_default_template_type_for_algorithm_values
 #   error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
 # endif
@@ -123,10 +127,6 @@
 #   error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
 # endif
 
-# ifdef __cpp_lib_ranges_to_container
-#   error "__cpp_lib_ranges_to_container should not be defined before c++23"
-# endif
-
 #elif TEST_STD_VER == 20
 
 # ifndef __cpp_lib_allocator_traits_is_always_equal
@@ -136,6 +136,10 @@
 #   error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++20"
 # endif
 
+# ifdef __cpp_lib_containers_ranges
+#   error "__cpp_lib_containers_ranges should not be defined before c++23"
+# endif
+
 # ifdef __cpp_lib_default_template_type_for_algorithm_values
 #   error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
 # endif
@@ -168,10 +172,6 @@
 #   error "__cpp_lib_nonmember_container_access should have the value 201411L in c++20"
 # endif
 
-# ifdef __cpp_lib_ranges_to_container
-#   error "__cpp_lib_ranges_to_container should not be defined before c++23"
-# endif
-
 #elif TEST_STD_VER == 23
 
 # ifndef __cpp_lib_allocator_traits_is_always_equal
@@ -181,6 +181,13 @@
 #   error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++23"
 # endif
 
+# ifndef __cpp_lib_containers_ranges
+#   error "__cpp_lib_containers_ranges should be defined in c++23"
+# endif
+# if __cpp_lib_containers_ranges != 202202L
+#   error "__cpp_lib_containers_ranges should have the value 202202L in c++23"
+# endif
+
 # ifdef __cpp_lib_default_template_type_for_algorithm_values
 #   error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"
 # endif
@@ -213,13 +220,6 @@
 #   e...
[truncated]

@mordante mordante self-assigned this May 3, 2024
Copy link
Member

@mordante mordante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! LGTM!

Copy link

github-actions bot commented May 3, 2024

⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.
Please turn off Keep my email addresses private setting in your account.
See LLVM Discourse for more information.

- Add missing `__cpp_lib_containers_ranges` feature test macro
- Constrain `__cpp_lib_ranges_to_container` to the `<ranges>` header, since the standard does not list it in containers' headers
@krzysdz krzysdz force-pushed the p1206r7-feature-test-macros branch from e30fc3d to 282f0c5 Compare May 3, 2024 06:57
@krzysdz
Copy link
Contributor Author

krzysdz commented May 3, 2024

Amended to use my real e-mail address and rebased.

@mordante mordante merged commit 028f1b0 into llvm:main May 4, 2024
Copy link

github-actions bot commented May 4, 2024

@krzysdz Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested
by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as
the builds can include changes from many authors. It is not uncommon for your
change to be included in a build that fails due to someone else's changes, or
infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself.
This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

@krzysdz
Copy link
Contributor Author

krzysdz commented May 13, 2024

/cherry-pick 028f1b0

@llvmbot
Copy link
Member

llvmbot commented May 13, 2024

/cherry-pick 028f1b0

Error: Command failed due to missing milestone.

@krzysdz
Copy link
Contributor Author

krzysdz commented May 13, 2024

@mordante Would it be possible to backport this to 18.x?
P1206R7 is supported since 17.0.0 (specifically 17bbb22). It would be nice to have __cpp_lib_containers_ranges in 18.x too.

@mordante
Copy link
Member

Sorry I missed this before. The last 18.1.x planned release has been released. @tstellar do you still accept PRs for LLVM 18?

@tstellar
Copy link
Collaborator

@mordante Probably not, but you can add it to the milestone just in case we do happen to do another release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants