aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2024-06-07 17:44:29 +0100
committerJonathan Wakely <jwakely@redhat.com>2024-06-08 15:51:40 +0100
commit77e84dc4e4e60ec5e7d6d1124e226452aa558108 (patch)
tree9df0a7ad110b10566740d919d374f8782f950666
parente91cf26a954a5c1bf431e36f3a1e69f94e9fa4fe (diff)
downloadgcc-77e84dc4e4e60ec5e7d6d1124e226452aa558108.zip
gcc-77e84dc4e4e60ec5e7d6d1124e226452aa558108.tar.gz
gcc-77e84dc4e4e60ec5e7d6d1124e226452aa558108.tar.bz2
libstdc++: Define __cpp_lib_ranges in <algorithm>
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.
-rw-r--r--libstdc++-v3/include/std/algorithm1
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc8
2 files changed, 9 insertions, 0 deletions
diff --git a/libstdc++-v3/include/std/algorithm b/libstdc++-v3/include/std/algorithm
index a4602a88..163e6b5 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 8c61a61..08a47aa 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: