From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id 6D9983953421 for ; Tue, 28 Apr 2020 22:52:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6D9983953421 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-224-Rwz1xlRPPlK-JchKRy6nvw-1; Tue, 28 Apr 2020 18:52:29 -0400 X-MC-Unique: Rwz1xlRPPlK-JchKRy6nvw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 891BE464; Tue, 28 Apr 2020 22:52:28 +0000 (UTC) Received: from localhost (unknown [10.33.37.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2FDEE60D53; Tue, 28 Apr 2020 22:52:27 +0000 (UTC) Date: Tue, 28 Apr 2020 23:52:27 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed 10/8] libstdc++: Fixes for feature test macros (PR 91480) Message-ID: <20200428225227.GO71320@redhat.com> References: MIME-Version: 1.0 In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="yUmmepPgoWmUqRhm" Content-Disposition: inline X-Spam-Status: No, score=-28.1 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=ham 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: Tue, 28 Apr 2020 22:52:37 -0000 --yUmmepPgoWmUqRhm Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Remove the non-standard __cpp_lib_allocator_is_always_equal macro and add the missing macros for P1032R1. PR libstdc++/91480 * include/bits/allocator.h (__cpp_lib_allocator_is_always_equal): Remove non-standard macro. * include/bits/stl_iterator.h (__cpp_lib_constexpr_iterator): Defi= ne to indicate P1032R1 support. * include/bits/stl_pair.h (__cpp_lib_constexpr_utility): Likewise. * include/std/string_view (__cpp_lib_constexpr_string_view): Likew= ise. * include/std/tuple (__cpp_lib_constexpr_tuple): Likewise. * include/std/version (__cpp_lib_allocator_is_always_equal): Remov= e. (__cpp_lib_constexpr_iterator, __cpp_lib_constexpr_string_view) (__cpp_lib_constexpr_tuple, __cpp_lib_constexpr_utility): Define. * testsuite/20_util/function_objects/constexpr_searcher.cc: Check feature test macro. * testsuite/20_util/tuple/cons/constexpr_allocator_arg_t.cc: Likew= ise. * testsuite/21_strings/basic_string_view/operations/copy/char/ constexpr.cc: Likewise. * testsuite/24_iterators/insert_iterator/constexpr.cc: Likewise. Tested powerpc64le-linux, committed to master. I think with Iain's recent addition of __cpp_lib_coroutine and this, all our feature test macros are present and correct (except for some still being defined as int values rather than long). Thanks to Alisdair Meredith for checking them and bringing the four missing __cpp_lib_constexpr_xxx ones to my attention. --yUmmepPgoWmUqRhm Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" Content-Transfer-Encoding: quoted-printable commit d0330a03606d06dc4084e9c8734a549d22676463 Author: Jonathan Wakely Date: Tue Apr 28 23:31:04 2020 +0100 libstdc++: Fixes for feature test macros (PR 91480) =20 Remove the non-standard __cpp_lib_allocator_is_always_equal macro and add the missing macros for P1032R1. =20 PR libstdc++/91480 * include/bits/allocator.h (__cpp_lib_allocator_is_always_equal= ): Remove non-standard macro. * include/bits/stl_iterator.h (__cpp_lib_constexpr_iterator): D= efine to indicate P1032R1 support. * include/bits/stl_pair.h (__cpp_lib_constexpr_utility): Likewi= se. * include/std/string_view (__cpp_lib_constexpr_string_view): Li= kewise. * include/std/tuple (__cpp_lib_constexpr_tuple): Likewise. * include/std/version (__cpp_lib_allocator_is_always_equal): Re= move. (__cpp_lib_constexpr_iterator, __cpp_lib_constexpr_string_view) (__cpp_lib_constexpr_tuple, __cpp_lib_constexpr_utility): Defin= e. * testsuite/20_util/function_objects/constexpr_searcher.cc: Che= ck feature test macro. * testsuite/20_util/tuple/cons/constexpr_allocator_arg_t.cc: Li= kewise. * testsuite/21_strings/basic_string_view/operations/copy/char/ constexpr.cc: Likewise. * testsuite/24_iterators/insert_iterator/constexpr.cc: Likewise= . diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/b= its/allocator.h index ee564791dfa..dcca769938c 100644 --- a/libstdc++-v3/include/bits/allocator.h +++ b/libstdc++-v3/include/bits/allocator.h @@ -50,9 +50,6 @@ #endif =20 #define __cpp_lib_incomplete_container_elements 201505 -#if __cplusplus >=3D 201103L -# define __cpp_lib_allocator_is_always_equal 201411 -#endif =20 namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/includ= e/bits/stl_iterator.h index cc0b3e0a766..fdb1121f823 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -71,6 +71,7 @@ =20 #if __cplusplus > 201703L # define __cpp_lib_array_constexpr 201811L +# define __cpp_lib_constexpr_iterator 201811L #elif __cplusplus =3D=3D 201703L # define __cpp_lib_array_constexpr 201803L #endif diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bi= ts/stl_pair.h index 505bcc32e67..491c599076e 100644 --- a/libstdc++-v3/include/bits/stl_pair.h +++ b/libstdc++-v3/include/bits/stl_pair.h @@ -63,6 +63,7 @@ #endif #if __cplusplus > 201703L # include +# define __cpp_lib_constexpr_utility 201811L #endif =20 namespace std _GLIBCXX_VISIBILITY(default) diff --git a/libstdc++-v3/include/std/string_view b/libstdc++-v3/include/st= d/string_view index 289d4743548..7c7c1b3b5dd 100644 --- a/libstdc++-v3/include/std/string_view +++ b/libstdc++-v3/include/std/string_view @@ -48,7 +48,10 @@ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION =20 -#define __cpp_lib_string_view 201803 +# define __cpp_lib_string_view 201803L +#if __cplusplus > 201703L +# define __cpp_lib_constexpr_string_view 201811L +#endif =20 // Helper for basic_string and basic_string_view members. constexpr size_t diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tupl= e index 808947781ae..db4872d3a52 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -41,6 +41,7 @@ #include #if __cplusplus > 201703L # include +# define __cpp_lib_constexpr_tuple 201811L #endif =20 namespace std _GLIBCXX_VISIBILITY(default) diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/ve= rsion index fa505f25e98..c3a5bd26e63 100644 --- a/libstdc++-v3/include/std/version +++ b/libstdc++-v3/include/std/version @@ -50,7 +50,6 @@ #define __cpp_lib_result_of_sfinae 201210 =20 #if _GLIBCXX_HOSTED -# define __cpp_lib_allocator_is_always_equal 201411 # define __cpp_lib_allocator_traits_is_always_equal 201411 # define __cpp_lib_shared_ptr_arrays 201611L #endif @@ -157,7 +156,7 @@ # define __cpp_lib_shared_mutex 201505 #endif #define __cpp_lib_shared_ptr_weak_type 201606 -#define __cpp_lib_string_view 201803 +#define __cpp_lib_string_view 201803L // #define __cpp_lib_to_chars 201611L #define __cpp_lib_unordered_map_try_emplace 201411 #define __cpp_lib_variant 201606L @@ -201,8 +200,12 @@ #define __cpp_lib_constexpr_complex 201711L #define __cpp_lib_constexpr_dynamic_alloc 201907L #define __cpp_lib_constexpr_functional 201907L +# define __cpp_lib_constexpr_iterator 201811L #define __cpp_lib_constexpr_memory 201811L #define __cpp_lib_constexpr_numeric 201911L +#define __cpp_lib_constexpr_string_view 201811L +#define __cpp_lib_constexpr_tuple 201811L +#define __cpp_lib_constexpr_utility 201811L #define __cpp_lib_erase_if 202002L #define __cpp_lib_interpolate 201902L #ifdef _GLIBCXX_HAS_GTHREADS diff --git a/libstdc++-v3/testsuite/20_util/function_objects/constexpr_sear= cher.cc b/libstdc++-v3/testsuite/20_util/function_objects/constexpr_searche= r.cc index 642d0a388fb..f9ecbb365a4 100644 --- a/libstdc++-v3/testsuite/20_util/function_objects/constexpr_searcher.cc +++ b/libstdc++-v3/testsuite/20_util/function_objects/constexpr_searcher.cc @@ -19,6 +19,13 @@ // { dg-do compile { target c++2a } } =20 #include + +#ifndef __cpp_lib_constexpr_functional +# error "Feature test macro for constexpr searcher is missing in " +#elif __cpp_lib_constexpr_functional < 201811L +# error "Feature test macro for constexpr searcher has wrong value in " +#endif + #include =20 const std::string_view diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/constexpr_allocator_= arg_t.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/constexpr_allocator_ar= g_t.cc index e8423b48cdb..8821932ca97 100644 --- a/libstdc++-v3/testsuite/20_util/tuple/cons/constexpr_allocator_arg_t.c= c +++ b/libstdc++-v3/testsuite/20_util/tuple/cons/constexpr_allocator_arg_t.c= c @@ -18,9 +18,16 @@ // with this library; see the file COPYING3. If not see // . =20 -#include #include =20 +#ifndef __cpp_lib_constexpr_tuple +# error "Feature test macro for constexpr allocator constructors is missin= g in " +#elif __cpp_lib_constexpr_tuple < 201811L +# error "Feature test macro for constexpr allocator constructors has wrong= value in " +#endif + +#include + const std::allocator alloc{}; =20 constexpr bool diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations= /copy/char/constexpr.cc b/libstdc++-v3/testsuite/21_strings/basic_string_vi= ew/operations/copy/char/constexpr.cc index 86a78108696..64a0766281d 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/copy/c= har/constexpr.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/copy/c= har/constexpr.cc @@ -20,6 +20,12 @@ =20 #include =20 +#ifndef __cpp_lib_constexpr_string_view +# error "Feature test macro for constexpr copy is missing in = " +#elif __cpp_lib_constexpr_iterator < 201811L +# error "Feature test macro for constexpr copy has wrong value in " +#endif + constexpr bool test01() { diff --git a/libstdc++-v3/testsuite/24_iterators/insert_iterator/constexpr.= cc b/libstdc++-v3/testsuite/24_iterators/insert_iterator/constexpr.cc index b4fc1b5e4e7..b061bc96848 100644 --- a/libstdc++-v3/testsuite/24_iterators/insert_iterator/constexpr.cc +++ b/libstdc++-v3/testsuite/24_iterators/insert_iterator/constexpr.cc @@ -20,6 +20,12 @@ =20 #include =20 +#ifndef __cpp_lib_constexpr_iterator +# error "Feature test macro for constexpr insert iterators is missing in <= iterator>" +#elif __cpp_lib_constexpr_iterator < 201811L +# error "Feature test macro for constexpr insert iterators has wrong value= in " +#endif + struct container { using value_type =3D int; --yUmmepPgoWmUqRhm--