[PATCH] libstdc++: Add some missing ranges feature-test macro tests

Patrick Palka ppalka@redhat.com
Thu Aug 22 13:31:03 GMT 2024


Tested on x86_64-pc-linux-gnu, does this look OK for trunk and
perhaps 14?

-- >8 --

libstdc++-v3/ChangeLog:

	* testsuite/25_algorithms/contains/1.cc: Verify value of
	__cpp_lib_ranges_contains.
	* testsuite/25_algorithms/find_last/1.cc: Verify value of
	__cpp_lib_ranges_find_last.
	* testsuite/26_numerics/iota/2.cc: Verify value of
	__cpp_lib_ranges_iota.
---
 libstdc++-v3/testsuite/25_algorithms/contains/1.cc  | 4 ++++
 libstdc++-v3/testsuite/25_algorithms/find_last/1.cc | 4 ++++
 libstdc++-v3/testsuite/26_numerics/iota/2.cc        | 4 ++++
 3 files changed, 12 insertions(+)

diff --git a/libstdc++-v3/testsuite/25_algorithms/contains/1.cc b/libstdc++-v3/testsuite/25_algorithms/contains/1.cc
index 7d3fa048ef6..b44c06032e8 100644
--- a/libstdc++-v3/testsuite/25_algorithms/contains/1.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/contains/1.cc
@@ -4,6 +4,10 @@
 #include <testsuite_hooks.h>
 #include <testsuite_iterators.h>
 
+#if __cpp_lib_ranges_contains != 202207L
+# error "Feature-test macro __cpp_lib_ranges_contains has wrong value in <algorithm>"
+#endif
+
 namespace ranges = std::ranges;
 
 void
diff --git a/libstdc++-v3/testsuite/25_algorithms/find_last/1.cc b/libstdc++-v3/testsuite/25_algorithms/find_last/1.cc
index 911e22887d1..8a40bb1a6b3 100644
--- a/libstdc++-v3/testsuite/25_algorithms/find_last/1.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/find_last/1.cc
@@ -4,6 +4,10 @@
 #include <testsuite_hooks.h>
 #include <testsuite_iterators.h>
 
+#if __cpp_lib_ranges_find_last != 202207L
+# error "Feature-test macro __cpp_lib_ranges_find_last has wrong value in <algorithm>"
+#endif
+
 namespace ranges = std::ranges;
 
 constexpr bool
diff --git a/libstdc++-v3/testsuite/26_numerics/iota/2.cc b/libstdc++-v3/testsuite/26_numerics/iota/2.cc
index 040c48d91ce..b14580b8be1 100644
--- a/libstdc++-v3/testsuite/26_numerics/iota/2.cc
+++ b/libstdc++-v3/testsuite/26_numerics/iota/2.cc
@@ -4,6 +4,10 @@
 #include <testsuite_hooks.h>
 #include <testsuite_iterators.h>
 
+#if __cpp_lib_ranges_iota != 202202L
+# error "Feature-test macro __cpp_lib_ranges_iota has wrong value in <numeric>"
+#endif
+
 namespace ranges = std::ranges;
 
 void
-- 
2.46.0.288.g3a7362eb9f



More information about the Libstdc++ mailing list