[llvm-branch-commits] [libcxx] f488968 - [libc++][ranges] Sets ranges feature-test macro.
Tobias Hieta via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Aug 11 23:37:08 PDT 2022
Author: Mark de Wever
Date: 2022-08-12T08:36:00+02:00
New Revision: f48896875e8210d0abe192e1060ee07cb5bfdc97
URL: https://github.com/llvm/llvm-project/commit/f48896875e8210d0abe192e1060ee07cb5bfdc97
DIFF: https://github.com/llvm/llvm-project/commit/f48896875e8210d0abe192e1060ee07cb5bfdc97.diff
LOG: [libc++][ranges] Sets ranges feature-test macro.
D131234 marked the ranges papers as complete, but it didn't set the
feature-test macro.
Reviewed By: ldionne, var-const, #libc
Differential Revision: https://reviews.llvm.org/D131326
(cherry picked from commit 195287d90afb1b97a0fb869da501370e7c3e67c6)
Added:
Modified:
libcxx/docs/FeatureTestMacroTable.rst
libcxx/include/version
libcxx/test/std/language.support/support.limits/support.limits.general/algorithm.version.compile.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.compile.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.compile.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/ranges.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 9aa183aff9fc5..e5a06dcced65a 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -262,7 +262,7 @@ Status
------------------------------------------------- -----------------
``__cpp_lib_polymorphic_allocator`` *unimplemented*
------------------------------------------------- -----------------
- ``__cpp_lib_ranges`` *unimplemented*
+ ``__cpp_lib_ranges`` ``201811L``
------------------------------------------------- -----------------
``__cpp_lib_remove_cvref`` ``201711L``
------------------------------------------------- -----------------
diff --git a/libcxx/include/version b/libcxx/include/version
index 3ea1d8f768af6..8ffb1747eb276 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -351,7 +351,9 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_list_remove_return_type 201806L
# define __cpp_lib_math_constants 201907L
// # define __cpp_lib_polymorphic_allocator 201902L
-// # define __cpp_lib_ranges 201811L
+# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+# define __cpp_lib_ranges 201811L
+# endif
# define __cpp_lib_remove_cvref 201711L
# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore)
# define __cpp_lib_semaphore 201907L
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 020f78d25c5b9..4f9e8f52ffcad 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
@@ -181,16 +181,16 @@
# endif
# endif
-# if !defined(_LIBCPP_VERSION)
+# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
# ifndef __cpp_lib_ranges
# error "__cpp_lib_ranges should be defined in c++20"
# endif
# if __cpp_lib_ranges != 201811L
# error "__cpp_lib_ranges should have the value 201811L in c++20"
# endif
-# else // _LIBCPP_VERSION
+# else
# ifdef __cpp_lib_ranges
-# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# error "__cpp_lib_ranges should not be defined when !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) is not defined!"
# endif
# endif
@@ -248,16 +248,16 @@
# endif
# endif
-# if !defined(_LIBCPP_VERSION)
+# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
# ifndef __cpp_lib_ranges
# error "__cpp_lib_ranges should be defined in c++2b"
# endif
# if __cpp_lib_ranges != 201811L
# error "__cpp_lib_ranges should have the value 201811L in c++2b"
# endif
-# else // _LIBCPP_VERSION
+# else
# ifdef __cpp_lib_ranges
-# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# error "__cpp_lib_ranges should not be defined when !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) is not defined!"
# endif
# endif
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 0f9b668fe700a..4061d99f9c48e 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
@@ -254,16 +254,16 @@
# error "__cpp_lib_not_fn should have the value 201603L in c++20"
# endif
-# if !defined(_LIBCPP_VERSION)
+# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
# ifndef __cpp_lib_ranges
# error "__cpp_lib_ranges should be defined in c++20"
# endif
# if __cpp_lib_ranges != 201811L
# error "__cpp_lib_ranges should have the value 201811L in c++20"
# endif
-# else // _LIBCPP_VERSION
+# else
# ifdef __cpp_lib_ranges
-# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# error "__cpp_lib_ranges should not be defined when !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) is not defined!"
# endif
# endif
@@ -364,16 +364,16 @@
# error "__cpp_lib_not_fn should have the value 201603L in c++2b"
# endif
-# if !defined(_LIBCPP_VERSION)
+# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
# ifndef __cpp_lib_ranges
# error "__cpp_lib_ranges should be defined in c++2b"
# endif
# if __cpp_lib_ranges != 201811L
# error "__cpp_lib_ranges should have the value 201811L in c++2b"
# endif
-# else // _LIBCPP_VERSION
+# else
# ifdef __cpp_lib_ranges
-# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# error "__cpp_lib_ranges should not be defined when !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) is not defined!"
# endif
# endif
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 dc8a25a18ee9a..ccad13440cc9c 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
@@ -174,16 +174,16 @@
# error "__cpp_lib_null_iterators should have the value 201304L in c++20"
# endif
-# if !defined(_LIBCPP_VERSION)
+# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
# ifndef __cpp_lib_ranges
# error "__cpp_lib_ranges should be defined in c++20"
# endif
# if __cpp_lib_ranges != 201811L
# error "__cpp_lib_ranges should have the value 201811L in c++20"
# endif
-# else // _LIBCPP_VERSION
+# else
# ifdef __cpp_lib_ranges
-# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# error "__cpp_lib_ranges should not be defined when !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) is not defined!"
# endif
# endif
@@ -231,16 +231,16 @@
# error "__cpp_lib_null_iterators should have the value 201304L in c++2b"
# endif
-# if !defined(_LIBCPP_VERSION)
+# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
# ifndef __cpp_lib_ranges
# error "__cpp_lib_ranges should be defined in c++2b"
# endif
# if __cpp_lib_ranges != 201811L
# error "__cpp_lib_ranges should have the value 201811L in c++2b"
# endif
-# else // _LIBCPP_VERSION
+# else
# ifdef __cpp_lib_ranges
-# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# error "__cpp_lib_ranges should not be defined when !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) is not defined!"
# endif
# endif
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 b63ed4329cde3..485f2b7842831 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
@@ -346,16 +346,16 @@
# error "__cpp_lib_out_ptr should not be defined before c++2b"
# endif
-# if !defined(_LIBCPP_VERSION)
+# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
# ifndef __cpp_lib_ranges
# error "__cpp_lib_ranges should be defined in c++20"
# endif
# if __cpp_lib_ranges != 201811L
# error "__cpp_lib_ranges should have the value 201811L in c++20"
# endif
-# else // _LIBCPP_VERSION
+# else
# ifdef __cpp_lib_ranges
-# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# error "__cpp_lib_ranges should not be defined when !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) is not defined!"
# endif
# endif
@@ -485,16 +485,16 @@
# endif
# endif
-# if !defined(_LIBCPP_VERSION)
+# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
# ifndef __cpp_lib_ranges
# error "__cpp_lib_ranges should be defined in c++2b"
# endif
# if __cpp_lib_ranges != 201811L
# error "__cpp_lib_ranges should have the value 201811L in c++2b"
# endif
-# else // _LIBCPP_VERSION
+# else
# ifdef __cpp_lib_ranges
-# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# error "__cpp_lib_ranges should not be defined when !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) is not defined!"
# endif
# endif
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 a3042b9ac9182..328b69cdccb52 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
@@ -109,16 +109,16 @@
#elif TEST_STD_VER == 20
-# if !defined(_LIBCPP_VERSION)
+# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
# ifndef __cpp_lib_ranges
# error "__cpp_lib_ranges should be defined in c++20"
# endif
# if __cpp_lib_ranges != 201811L
# error "__cpp_lib_ranges should have the value 201811L in c++20"
# endif
-# else // _LIBCPP_VERSION
+# else
# ifdef __cpp_lib_ranges
-# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# error "__cpp_lib_ranges should not be defined when !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) is not defined!"
# endif
# endif
@@ -144,16 +144,16 @@
#elif TEST_STD_VER > 20
-# if !defined(_LIBCPP_VERSION)
+# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
# ifndef __cpp_lib_ranges
# error "__cpp_lib_ranges should be defined in c++2b"
# endif
# if __cpp_lib_ranges != 201811L
# error "__cpp_lib_ranges should have the value 201811L in c++2b"
# endif
-# else // _LIBCPP_VERSION
+# else
# ifdef __cpp_lib_ranges
-# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# error "__cpp_lib_ranges should not be defined when !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) is not defined!"
# endif
# endif
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 dcf8ce8f4158b..d9a340e52ef9a 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
@@ -3194,16 +3194,16 @@
# error "__cpp_lib_quoted_string_io should have the value 201304L in c++20"
# endif
-# if !defined(_LIBCPP_VERSION)
+# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
# ifndef __cpp_lib_ranges
# error "__cpp_lib_ranges should be defined in c++20"
# endif
# if __cpp_lib_ranges != 201811L
# error "__cpp_lib_ranges should have the value 201811L in c++20"
# endif
-# else // _LIBCPP_VERSION
+# else
# ifdef __cpp_lib_ranges
-# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# error "__cpp_lib_ranges should not be defined when !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) is not defined!"
# endif
# endif
@@ -4461,16 +4461,16 @@
# error "__cpp_lib_quoted_string_io should have the value 201304L in c++2b"
# endif
-# if !defined(_LIBCPP_VERSION)
+# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
# ifndef __cpp_lib_ranges
# error "__cpp_lib_ranges should be defined in c++2b"
# endif
# if __cpp_lib_ranges != 201811L
# error "__cpp_lib_ranges should have the value 201811L in c++2b"
# endif
-# else // _LIBCPP_VERSION
+# else
# ifdef __cpp_lib_ranges
-# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# error "__cpp_lib_ranges should not be defined when !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) is not defined!"
# endif
# endif
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index f9bfa13cc2991..b6078c002f446 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -522,7 +522,8 @@ def add_version_header(tc):
"name": "__cpp_lib_ranges",
"values": { "c++20": 201811 },
"headers": ["algorithm", "functional", "iterator", "memory", "ranges"],
- "unimplemented": True,
+ "test_suite_guard": "!defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)",
+ "libcxx_guard": "!defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)",
}, {
"name": "__cpp_lib_ranges_chunk",
"values": { "c++2b": 202202 },
More information about the llvm-branch-commits
mailing list