]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Define __cpp_lib_ranges in <algorithm>
authorJonathan Wakely <jwakely@redhat.com>
Fri, 7 Jun 2024 16:44:29 +0000 (17:44 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Sat, 8 Jun 2024 14:51:40 +0000 (15:51 +0100)
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
libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc

index a4602a8807e62741009ece6d553b56ff531a80b2..163e6b5dca72bbce10d423c8de97b16e6918823b 100644 (file)
@@ -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
index 8c61a614a4779b92d0ce25bf04b57b63849b4fd6..08a47aa95c3f060d3b226132050916344a9a9e79 100644 (file)
 
 #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: