From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id BD0283954419 for ; Wed, 22 Apr 2020 21:58:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BD0283954419 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-280-9k4h5h-CONWpCn8xsOZxtg-1; Wed, 22 Apr 2020 17:58:48 -0400 X-MC-Unique: 9k4h5h-CONWpCn8xsOZxtg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D25C08015CF; Wed, 22 Apr 2020 21:58:47 +0000 (UTC) Received: from localhost (unknown [10.33.36.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7AD8C60C87; Wed, 22 Apr 2020 21:58:47 +0000 (UTC) Date: Wed, 22 Apr 2020 22:58:46 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed 3/8] libstdc++: Add missing feature test macros Message-ID: <56772f623e2270f0c6bfaf64e0bb41d4b6085dc4.1587592482.git.jwakely@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.12 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.5 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, 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: Wed, 22 Apr 2020 21:58:52 -0000 These macros all correspond to features that are already supported, but the macro was not defined when the feature was implemented. =09* include/bits/ptr_traits.h (__cpp_lib_constexpr_memory): Define to =09indicate P1006R1 support. =09(__cpp_lib_to_address): Define to indicate P0653R2 support. =09* include/bits/range_access.h (__cpp_lib_ssize): Define to indicate =09P1227R2 support. =09* include/bits/ranges_algo.h (__cpp_lib_shift): Define to indicate =09P0769R2 support. =09* include/std/atomic (__cpp_lib_atomic_float): Define to indicate =09P0020R6 support. =09* include/std/memory (__cpp_lib_assume_aligned): Define to indicate =09P1007R3 support. =09* include/std/memory_resource (__cpp_lib_polymorphic_allocator): =09Define to indicate P0339R6 support. =09* include/std/string_view (__cpp_lib_starts_ends_with): Define to =09indicate P0457R2 support. =09* include/std/type_traits (__cpp_lib_is_nothrow_convertible): Define =09to indicate P0758R1 support. =09(__cpp_lib_remove_cvref): Define to indicate P0550R2 support. =09(__cpp_lib_type_identity): Define to indicate P0887R1 support. =09* include/std/version (__cpp_lib_atomic_float) =09(__cpp_lib_is_nothrow_convertible, __cpp_lib_remove_cvref) =09(__cpp_lib_type_identity, __cpp_lib_assume_aligned) =09(__cpp_lib_constexpr_memory, __cpp_lib_polymorphic_allocator) =09(__cpp_lib_shift, __cpp_lib_ssize, __cpp_lib_starts_ends_with) =09(__cpp_lib_to_address): Define. =09* testsuite/20_util/to_address/1_neg.cc: Adjust dg-error line number. --- libstdc++-v3/ChangeLog | 27 +++++++++++++++++++ libstdc++-v3/include/bits/ptr_traits.h | 3 +++ libstdc++-v3/include/bits/range_access.h | 1 + libstdc++-v3/include/bits/ranges_algo.h | 1 + libstdc++-v3/include/std/atomic | 1 + libstdc++-v3/include/std/memory | 1 + libstdc++-v3/include/std/memory_resource | 1 + libstdc++-v3/include/std/string_view | 1 + libstdc++-v3/include/std/type_traits | 4 +++ libstdc++-v3/include/std/version | 12 +++++++++ .../testsuite/20_util/to_address/1_neg.cc | 2 +- 11 files changed, 53 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 4fd72daa942..182f5dc4b7e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,32 @@ 2020-04-22 Jonathan Wakely =20 +=09* include/bits/ptr_traits.h (__cpp_lib_constexpr_memory): Define to +=09indicate P1006R1 support. +=09(__cpp_lib_to_address): Define to indicate P0653R2 support. +=09* include/bits/range_access.h (__cpp_lib_ssize): Define to indicate +=09P1227R2 support. +=09* include/bits/ranges_algo.h (__cpp_lib_shift): Define to indicate +=09P0769R2 support. +=09* include/std/atomic (__cpp_lib_atomic_float): Define to indicate +=09P0020R6 support. +=09* include/std/memory (__cpp_lib_assume_aligned): Define to indicate +=09P1007R3 support. +=09* include/std/memory_resource (__cpp_lib_polymorphic_allocator): +=09Define to indicate P0339R6 support. +=09* include/std/string_view (__cpp_lib_starts_ends_with): Define to +=09indicate P0457R2 support. +=09* include/std/type_traits (__cpp_lib_is_nothrow_convertible): Define +=09to indicate P0758R1 support. +=09(__cpp_lib_remove_cvref): Define to indicate P0550R2 support. +=09(__cpp_lib_type_identity): Define to indicate P0887R1 support. +=09* include/std/version (__cpp_lib_atomic_float) +=09(__cpp_lib_is_nothrow_convertible, __cpp_lib_remove_cvref) +=09(__cpp_lib_type_identity, __cpp_lib_assume_aligned) +=09(__cpp_lib_constexpr_memory, __cpp_lib_polymorphic_allocator) +=09(__cpp_lib_shift, __cpp_lib_ssize, __cpp_lib_starts_ends_with) +=09(__cpp_lib_to_address): Define. +=09* testsuite/20_util/to_address/1_neg.cc: Adjust dg-error line number. + =09* include/bits/stl_map.h (__cpp_lib_map_insertion): Remove old =09macro. =09* include/bits/unordered_map.h (__cpp_lib_unordered_map_insertion): diff --git a/libstdc++-v3/include/bits/ptr_traits.h b/libstdc++-v3/include/= bits/ptr_traits.h index 8fd91bf7bf2..541abab29e1 100644 --- a/libstdc++-v3/include/bits/ptr_traits.h +++ b/libstdc++-v3/include/bits/ptr_traits.h @@ -35,6 +35,7 @@ #include =20 #if __cplusplus > 201703L +#define __cpp_lib_constexpr_memory 201811L namespace __gnu_debug { struct _Safe_iterator_base; } #endif =20 @@ -180,6 +181,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION =09return std::__to_address(__ptr.operator->()); } =20 +#define __cpp_lib_to_address 201711L + /** * @brief Obtain address referenced by a pointer to an object * @param __ptr A pointer to an object diff --git a/libstdc++-v3/include/bits/range_access.h b/libstdc++-v3/includ= e/bits/range_access.h index acd701e1385..82d9e2180c5 100644 --- a/libstdc++-v3/include/bits/range_access.h +++ b/libstdc++-v3/include/bits/range_access.h @@ -322,6 +322,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif // C++17 =20 #if __cplusplus > 201703L +#define __cpp_lib_ssize 201902L template constexpr auto ssize(const _Container& __cont) diff --git a/libstdc++-v3/include/bits/ranges_algo.h b/libstdc++-v3/include= /bits/ranges_algo.h index 56fbd50ce8e..aa07cb97ea6 100644 --- a/libstdc++-v3/include/bits/ranges_algo.h +++ b/libstdc++-v3/include/bits/ranges_algo.h @@ -3691,6 +3691,7 @@ namespace ranges =20 } // namespace ranges =20 +#define __cpp_lib_shift 201806L template constexpr ForwardIterator shift_left(ForwardIterator __first, ForwardIterator __last, diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/ato= mic index 40f23bdfc96..a455286a784 100644 --- a/libstdc++-v3/include/std/atomic +++ b/libstdc++-v3/include/std/atomic @@ -1477,6 +1477,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); } =20 #if __cplusplus > 201703L +#define __cpp_lib_atomic_float 201711L template<> struct atomic : __atomic_float { diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/mem= ory index aaee6e42c1a..1e8eebd731c 100644 --- a/libstdc++-v3/include/std/memory +++ b/libstdc++-v3/include/std/memory @@ -180,6 +180,7 @@ get_pointer_safety() noexcept { return pointer_safety::= relaxed; } // @} =20 #if __cplusplus > 201703L +#define __cpp_lib_assume_aligned 201811L /** @brief Inform the compiler that a pointer is aligned. * * @tparam _Align An alignment value (i.e. a power of two) diff --git a/libstdc++-v3/include/std/memory_resource b/libstdc++-v3/includ= e/std/memory_resource index f87ef9688f3..514c9888e7a 100644 --- a/libstdc++-v3/include/std/memory_resource +++ b/libstdc++-v3/include/std/memory_resource @@ -61,6 +61,7 @@ namespace pmr template class polymorphic_allocator; #else // C++20 +# define __cpp_lib_polymorphic_allocator 201902L template class polymorphic_allocator; #endif diff --git a/libstdc++-v3/include/std/string_view b/libstdc++-v3/include/st= d/string_view index b5d8eab2f33..289d4743548 100644 --- a/libstdc++-v3/include/std/string_view +++ b/libstdc++-v3/include/std/string_view @@ -322,6 +322,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } =20 #if __cplusplus > 201703L +#define __cpp_lib_starts_ends_with 201711L constexpr bool starts_with(basic_string_view __x) const noexcept { return this->substr(0, __x.size()) =3D=3D __x; } diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/st= d/type_traits index f96b5297b83..75a98e38c0a 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -1489,6 +1489,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { }; =20 #if __cplusplus > 201703L +#define __cpp_lib_is_nothrow_convertible 201806L /// is_nothrow_convertible template struct is_nothrow_convertible @@ -3221,6 +3222,8 @@ template #endif // C++17 =20 #if __cplusplus > 201703L +#define __cpp_lib_remove_cvref 201711L + /// Remove references and cv-qualifiers. template struct remove_cvref @@ -3231,6 +3234,7 @@ template template using remove_cvref_t =3D __remove_cvref_t<_Tp>; =20 +#define __cpp_lib_type_identity 201806L /// Identity metafunction. template struct type_identity { using type =3D _Tp; }; diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/ve= rsion index 48547c63014..3b1fd700069 100644 --- a/libstdc++-v3/include/std/version +++ b/libstdc++-v3/include/std/version @@ -161,10 +161,12 @@ =20 #if __cplusplus > 201703L // c++2a +#define __cpp_lib_atomic_float 201711L #define __cpp_lib_atomic_ref 201806L #define __cpp_lib_atomic_value_initialization 201911L #define __cpp_lib_bitops 201907L #define __cpp_lib_bounded_array_traits 201902L +// __cpp_lib_char8_t is defined in #if __cpp_concepts >=3D 201907L # define __cpp_lib_concepts 201806L #endif @@ -176,15 +178,20 @@ #ifdef _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED # define __cpp_lib_is_constant_evaluated 201811L #endif +#define __cpp_lib_is_nothrow_convertible 201806L +#define __cpp_lib_remove_cvref 201711L +#define __cpp_lib_type_identity 201806L #define __cpp_lib_unwrap_ref 201811L =20 #if _GLIBCXX_HOSTED +#define __cpp_lib_assume_aligned 201811L #define __cpp_lib_bind_front 201907L #define __cpp_lib_integer_comparison_functions 202002L #define __cpp_lib_constexpr_algorithms 201806L #define __cpp_lib_constexpr_complex 201711L #define __cpp_lib_constexpr_dynamic_alloc 201907L #define __cpp_lib_constexpr_invoke 201907L +#define __cpp_lib_constexpr_memory 201811L #define __cpp_lib_constexpr_numeric 201911L #define __cpp_lib_erase_if 202002L #define __cpp_lib_interpolate 201902L @@ -193,13 +200,18 @@ #endif #define __cpp_lib_list_remove_return_type 201806L #define __cpp_lib_math_constants 201907L +#define __cpp_lib_polymorphic_allocator 201902L #if __cpp_lib_concepts # define __cpp_lib_ranges 201911L #endif +#define __cpp_lib_shift 201806L #define __cpp_lib_span 202002L +#define __cpp_lib_ssize 201902L +#define __cpp_lib_starts_ends_with 201711L #if __cpp_impl_three_way_comparison >=3D 201907L && __cpp_lib_concepts # define __cpp_lib_three_way_comparison 201907L #endif +#define __cpp_lib_to_address 201711L #define __cpp_lib_to_array 201907L #endif #endif // C++2a diff --git a/libstdc++-v3/testsuite/20_util/to_address/1_neg.cc b/libstdc++= -v3/testsuite/20_util/to_address/1_neg.cc index ee64a2281fb..cb9f8dc0681 100644 --- a/libstdc++-v3/testsuite/20_util/to_address/1_neg.cc +++ b/libstdc++-v3/testsuite/20_util/to_address/1_neg.cc @@ -17,7 +17,7 @@ =20 // { dg-options "-std=3Dgnu++2a" } // { dg-do compile { target c++2a } } -// { dg-error "not a function pointer" "" { target *-*-* } 157 } +// { dg-error "not a function pointer" "" { target *-*-* } 158 } =20 #include =20 --=20 2.25.3