diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst --- a/libcxx/docs/FeatureTestMacroTable.rst +++ b/libcxx/docs/FeatureTestMacroTable.rst @@ -262,7 +262,7 @@ ------------------------------------------------- ----------------- ``__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 --- a/libcxx/include/version +++ b/libcxx/include/version @@ -351,7 +351,9 @@ # 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 --- 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 --- 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 --- 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 --- 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 --- 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 --- 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 --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -522,7 +522,8 @@ "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 },