From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id CB4533954C4F for ; Wed, 22 Apr 2020 21:59:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CB4533954C4F Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-288-w_RLsFsXMyWT379XvCrCmw-1; Wed, 22 Apr 2020 17:59:26 -0400 X-MC-Unique: w_RLsFsXMyWT379XvCrCmw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B66998017FE; Wed, 22 Apr 2020 21:59:25 +0000 (UTC) Received: from localhost (unknown [10.33.36.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3DFA65D70A; Wed, 22 Apr 2020 21:59:25 +0000 (UTC) Date: Wed, 22 Apr 2020 22:59:24 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed 8/8] libstdc++: Define __cpp_lib_execution feature test macro Message-ID: References: MIME-Version: 1.0 In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Spam-Status: No, score=-28.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Apr 2020 21:59:32 -0000 This macro has never been defined by libstdc++, despite supporting the parallel algorithms. It should have a different value for C++17 and C++20, because P1001R2 should not be supported in C++17, but unsequenced_policy is defined for C++17 (see PR p4702). =09* include/std/execution (__cpp_lib_execution): Define to indicate =09support for P0024R2 and P1001R2. =09* include/std/version (__cpp_lib_execution): Define. =09* testsuite/25_algorithms/pstl/feature_test.cc: Only test macro =09defined by , move other tests to new tests ... =09* testsuite/25_algorithms/pstl/feature_test-2.cc: New test. =09* testsuite/25_algorithms/pstl/feature_test-3.cc: New test. =09* testsuite/25_algorithms/pstl/feature_test-4.cc: New test. =09* testsuite/25_algorithms/pstl/feature_test-5.cc: New test. --- libstdc++-v3/ChangeLog | 10 ++++++ libstdc++-v3/include/std/execution | 1 + libstdc++-v3/include/std/version | 2 ++ .../25_algorithms/pstl/feature_test-2.cc | 27 +++++++++++++++ .../25_algorithms/pstl/feature_test-3.cc | 34 +++++++++++++++++++ .../25_algorithms/pstl/feature_test-4.cc | 33 ++++++++++++++++++ .../25_algorithms/pstl/feature_test-5.cc | 28 +++++++++++++++ .../25_algorithms/pstl/feature_test.cc | 27 ++------------- 8 files changed, 137 insertions(+), 25 deletions(-) create mode 100644 libstdc++-v3/testsuite/25_algorithms/pstl/feature_test-= 2.cc create mode 100644 libstdc++-v3/testsuite/25_algorithms/pstl/feature_test-= 3.cc create mode 100644 libstdc++-v3/testsuite/25_algorithms/pstl/feature_test-= 4.cc create mode 100644 libstdc++-v3/testsuite/25_algorithms/pstl/feature_test-= 5.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index cce254968fb..fb0c1acd268 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,15 @@ 2020-04-22 Jonathan Wakely =20 +=09* include/std/execution (__cpp_lib_execution): Define to indicate +=09support for P0024R2 and P1001R2. +=09* include/std/version (__cpp_lib_execution): Define. +=09* testsuite/25_algorithms/pstl/feature_test.cc: Only test macro +=09defined by , move other tests to new tests ... +=09* testsuite/25_algorithms/pstl/feature_test-2.cc: New test. +=09* testsuite/25_algorithms/pstl/feature_test-3.cc: New test. +=09* testsuite/25_algorithms/pstl/feature_test-4.cc: New test. +=09* testsuite/25_algorithms/pstl/feature_test-5.cc: New test. + =09* include/bits/stl_iterator.h (__cpp_lib_array_constexpr): Define =09different values for C++17 and C++20, to indicate different feature =09sets. Update value for C++20 to indicate P1032R1 support. diff --git a/libstdc++-v3/include/std/execution b/libstdc++-v3/include/std/= execution index ac78af8eac3..cdd852deb14 100644 --- a/libstdc++-v3/include/std/execution +++ b/libstdc++-v3/include/std/execution @@ -50,6 +50,7 @@ =20 // Feature test macro for parallel algorithms # define __cpp_lib_parallel_algorithm 201603L +# define __cpp_lib_execution 201902L =20 #endif // C++17 =20 diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/ve= rsion index 57a05259d98..3024f1caf8b 100644 --- a/libstdc++-v3/include/std/version +++ b/libstdc++-v3/include/std/version @@ -127,6 +127,7 @@ #define __cpp_lib_clamp 201603 #define __cpp_lib_constexpr_char_traits 201611 #define __cpp_lib_enable_shared_from_this 201603 +#define __cpp_lib_execution 201902L // FIXME: should be 201603L #define __cpp_lib_filesystem 201703 #define __cpp_lib_gcd 201606 #define __cpp_lib_gcd_lcm 201606 @@ -188,6 +189,7 @@ #define __cpp_lib_array_constexpr 201811L #define __cpp_lib_assume_aligned 201811L #define __cpp_lib_bind_front 201907L +// FIXME: #define __cpp_lib_execution 201902L #define __cpp_lib_integer_comparison_functions 202002L #define __cpp_lib_constexpr_algorithms 201806L #define __cpp_lib_constexpr_complex 201711L diff --git a/libstdc++-v3/testsuite/25_algorithms/pstl/feature_test-2.cc b/= libstdc++-v3/testsuite/25_algorithms/pstl/feature_test-2.cc new file mode 100644 index 00000000000..3e74f89bc41 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/pstl/feature_test-2.cc @@ -0,0 +1,27 @@ +// Copyright (C) 2020 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 +// . + +// { dg-options "-std=3Dgnu++17" } +// { dg-do preprocess { target c++17 } } + +#include + +#ifndef __cpp_lib_parallel_algorithm +# error "Feature-test macro for parallel algorithms missing in " +#elif __cpp_lib_parallel_algorithm !=3D 201603L +# error "Feature-test macro for parallel algorithms has wrong value in " +#endif diff --git a/libstdc++-v3/testsuite/25_algorithms/pstl/feature_test-3.cc b/= libstdc++-v3/testsuite/25_algorithms/pstl/feature_test-3.cc new file mode 100644 index 00000000000..7693fe03548 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/pstl/feature_test-3.cc @@ -0,0 +1,34 @@ +// Copyright (C) 2020 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 +// . + +// { dg-options "-std=3Dgnu++17" } +// { dg-do preprocess { target c++17 } } + +#include + +#ifndef __cpp_lib_execution +# error "Feature-test macro for execution policies is missing in " +#elif __cpp_lib_execution !=3D 201902L +# error "Feature-test macro for parallel algorithms has wrong value in " +#endif + +// Neither SD-6 nor C++20 requires this macro to be defined in = . +#ifndef __cpp_lib_parallel_algorithm +# error "Feature-test macro for parallel algorithms missing in = " +#elif __cpp_lib_parallel_algorithm !=3D 201603L +# error "Feature-test macro for parallel algorithms has wrong value in " +#endif diff --git a/libstdc++-v3/testsuite/25_algorithms/pstl/feature_test-4.cc b/= libstdc++-v3/testsuite/25_algorithms/pstl/feature_test-4.cc new file mode 100644 index 00000000000..e7bbf920499 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/pstl/feature_test-4.cc @@ -0,0 +1,33 @@ +// Copyright (C) 2020 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 +// . + +// { dg-options "-std=3Dgnu++17" } +// { dg-do preprocess { target c++17 } } + +#include + +#ifndef __cpp_lib_parallel_algorithm +# error "Feature-test macro for parallel algorithms missing in " +#elif __cpp_lib_parallel_algorithm !=3D 201603L +# error "Feature-test macro for parallel algorithms has wrong value in " +#endif + +#ifndef __cpp_lib_execution +# error "Feature-test macro for execution policies is missing in = " +#elif __cpp_lib_execution !=3D 201902L +# error "Feature-test macro for parallel algorithms has wrong value in " +#endif diff --git a/libstdc++-v3/testsuite/25_algorithms/pstl/feature_test-5.cc b/= libstdc++-v3/testsuite/25_algorithms/pstl/feature_test-5.cc new file mode 100644 index 00000000000..2d991958e75 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/pstl/feature_test-5.cc @@ -0,0 +1,28 @@ +// Copyright (C) 2020 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 +// . + +// { dg-options "-std=3Dgnu++17" } +// { dg-do preprocess { target c++17 } } + +#include + +// Neither SD-6 nor C++20 requires this macro to be defined in . +#ifndef __cpp_lib_parallel_algorithm +# error "Feature-test macro for parallel algorithms missing in " +#elif __cpp_lib_parallel_algorithm !=3D 201603L +# error "Feature-test macro for parallel algorithms has wrong value in " +#endif diff --git a/libstdc++-v3/testsuite/25_algorithms/pstl/feature_test.cc b/li= bstdc++-v3/testsuite/25_algorithms/pstl/feature_test.cc index ce41f538c83..c3a9be5e45a 100644 --- a/libstdc++-v3/testsuite/25_algorithms/pstl/feature_test.cc +++ b/libstdc++-v3/testsuite/25_algorithms/pstl/feature_test.cc @@ -19,32 +19,9 @@ // { dg-do preprocess { target c++17 } } =20 #include + #ifndef __cpp_lib_parallel_algorithm -# error "Feature-test macro for parallel algorithms missing" +# error "Feature-test macro for parallel algorithms missing in = " #elif __cpp_lib_parallel_algorithm !=3D 201603L # error "Feature-test macro for parallel algorithms has wrong value in " #endif - -#include -#if __cpp_lib_parallel_algorithm !=3D 201603L -# error "Feature-test macro for parallel algorithms has wrong value in " -#endif - -#include -#if __cpp_lib_parallel_algorithm !=3D 201603L -# error "Feature-test macro for parallel algorithms has wrong value in " -#endif - -// The N4810 draft does not require the macro to be defined in = . -#include -#if __cpp_lib_parallel_algorithm !=3D 201603L -# error "Feature-test macro for parallel algorithms has wrong value in " -#endif - -// The N4810 draft does not require the macro to be defined in = . -// Include this last, because it will trigger the inclusion of TBB headers= , -// which then include , so we need to have already checked . -#include -#if __cpp_lib_parallel_algorithm !=3D 201603L -# error "Feature-test macro for parallel algorithms has wrong value in " -#endif --=20 2.25.3