]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix incorrect __cpp_lib_parallel_algorithm macro definitions
authorJonathan Wakely <jwakely@redhat.com>
Fri, 14 Jun 2019 18:11:02 +0000 (19:11 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 14 Jun 2019 18:11:02 +0000 (19:11 +0100)
Backport from mainline
2019-06-12  Jonathan Wakely  <jwakely@redhat.com>

* include/std/algorithm (__cpp_lib_parallel_algorithm): Fix value.
* include/std/memory (__cpp_lib_parallel_algorithm): Likewise.
* include/std/numeric (__cpp_lib_parallel_algorithm): Likewise.
* testsuite/25_algorithms/pstl/feature_test.cc: New test.

From-SVN: r272300

libstdc++-v3/ChangeLog
libstdc++-v3/include/std/algorithm
libstdc++-v3/include/std/memory
libstdc++-v3/include/std/numeric
libstdc++-v3/testsuite/25_algorithms/pstl/feature_test.cc [new file with mode: 0644]

index 93e39e95427059d3a1adc4ffea0e3d47d88e31b3..fcf4880c7f0503d6be7eeae88bf2ed475c572af7 100644 (file)
@@ -1,3 +1,13 @@
+2019-06-14  Jonathan Wakely  <jwakely@redhat.com>
+
+       Backport from mainline
+       2019-06-12  Jonathan Wakely  <jwakely@redhat.com>
+
+       * include/std/algorithm (__cpp_lib_parallel_algorithm): Fix value.
+       * include/std/memory (__cpp_lib_parallel_algorithm): Likewise.
+       * include/std/numeric (__cpp_lib_parallel_algorithm): Likewise.
+       * testsuite/25_algorithms/pstl/feature_test.cc: New test.
+
 2019-06-14  Jonathan Wakely  <jwakely@redhat.com>
 
        Backport from mainline
index 73c87d5fcba99a976e776d81f40b1e49396f7049..b5013a226e3286b17132acb1b0c9f616ff0df7c5 100644 (file)
@@ -73,7 +73,7 @@
 #  endif
 
 // Feature test macro for parallel algorithms
-# define __cpp_lib_parallel_algorithm 201703L
+# define __cpp_lib_parallel_algorithm 201603L
 #endif // C++17
 
 #ifdef _GLIBCXX_PARALLEL
index 6677fe782dea311411571019577a036a79dbcad0..81e9ea3518b7c5132d027c4bac3f4ff5a705e226 100644 (file)
@@ -376,7 +376,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
 # endif
 
 // Feature test macro for parallel algorithms
-# define __cpp_lib_parallel_algorithm 201703L
+# define __cpp_lib_parallel_algorithm 201603L
 #endif // C++17
 
 #endif /* _GLIBCXX_MEMORY */
index 9dff247538ac6c324610ca905d9992d35c412298..3babfaa81079e28720aaba24d03ceec561b669b2 100644 (file)
@@ -216,7 +216,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
 # endif
 
 // Feature test macro for parallel algorithms
-# define __cpp_lib_parallel_algorithm 201703L
+# define __cpp_lib_parallel_algorithm 201603L
 #endif // C++17
 
 #endif /* _GLIBCXX_NUMERIC */
diff --git a/libstdc++-v3/testsuite/25_algorithms/pstl/feature_test.cc b/libstdc++-v3/testsuite/25_algorithms/pstl/feature_test.cc
new file mode 100644 (file)
index 0000000..d9d558b
--- /dev/null
@@ -0,0 +1,51 @@
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17" }
+// { dg-do preprocess { target c++17 } }
+// { dg-require-effective-target tbb-backend }
+
+#include <algorithm>
+#ifndef __cpp_lib_parallel_algorithm
+# error "Feature-test macro for parallel algorithms missing"
+#elif __cpp_lib_parallel_algorithm != 201603L
+# error "Feature-test macro for parallel algorithms has wrong value in <algorithm>"
+#endif
+
+#include <numeric>
+#if __cpp_lib_parallel_algorithm != 201603L
+# error "Feature-test macro for parallel algorithms has wrong value in <numeric>"
+#endif
+
+#include <version>
+#if __cpp_lib_parallel_algorithm != 201603L
+# error "Feature-test macro for parallel algorithms has wrong value in <version>"
+#endif
+
+// The N4810 draft does not require the macro to be defined in <execution>.
+#include <memory>
+#if __cpp_lib_parallel_algorithm != 201603L
+# error "Feature-test macro for parallel algorithms has wrong value in <memory>"
+#endif
+
+// The N4810 draft does not require the macro to be defined in <execution>.
+// Include this last, because it will trigger the inclusion of TBB headers,
+// which then include <memory>, so we need to have already checked <memory>.
+#include <execution>
+#if __cpp_lib_parallel_algorithm != 201603L
+# error "Feature-test macro for parallel algorithms has wrong value in <execution>"
+#endif