public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libstdc++: Define __cpp_lib_ranges in <algorithm>
@ 2024-06-08 14:52 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2024-06-08 14:52 UTC (permalink / raw)
  To: libstdc++, gcc-patches

Tested x86_64-linux. Pushed to trunk.

-- >8 --

The __cpp_lib_ranges macro is missing from <algorithm>.

libstdc++-v3/ChangeLog:

	* include/std/algorithm: Define __glibcxx_want_ranges.
	* testsuite/25_algorithms/headers/algorithm/synopsis.cc: Check
	feature test macro in C++20 mode.
---
 libstdc++-v3/include/std/algorithm                        | 1 +
 .../testsuite/25_algorithms/headers/algorithm/synopsis.cc | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/libstdc++-v3/include/std/algorithm b/libstdc++-v3/include/std/algorithm
index a4602a8807e..163e6b5dca7 100644
--- a/libstdc++-v3/include/std/algorithm
+++ b/libstdc++-v3/include/std/algorithm
@@ -67,6 +67,7 @@
 #define __glibcxx_want_constexpr_algorithms
 #define __glibcxx_want_freestanding_algorithm
 #define __glibcxx_want_parallel_algorithm
+#define __glibcxx_want_ranges
 #define __glibcxx_want_ranges_contains
 #define __glibcxx_want_ranges_find_last
 #define __glibcxx_want_ranges_fold
diff --git a/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc
index 8c61a614a47..08a47aa95c3 100644
--- a/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc
@@ -19,6 +19,14 @@
 
 #include <algorithm>
 
+#if __cplusplus >= 202002L
+#ifndef __cpp_lib_ranges
+# error "Feature test macro for ranges is missing in <algorithm>"
+#elif __cpp_lib_ranges < 201911L
+# error "Feature test macro for ranges has wrong value in <algorithm>"
+#endif
+#endif
+
 namespace std
  {
   // 25.1, non-modifying sequence operations:
-- 
2.45.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-06-08 14:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-08 14:52 [committed] libstdc++: Define __cpp_lib_ranges in <algorithm> Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).