[gcc(refs/vendors/ARM/heads/arm-9-branch)] libstdc++: Add missing feature test macros

Vidya Praveen vp@gcc.gnu.org
Mon May 11 18:53:16 GMT 2020


https://gcc.gnu.org/g:46790405c5204d0c00501b1b972138d1d5481ba9

commit 46790405c5204d0c00501b1b972138d1d5481ba9
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Apr 23 17:39:21 2020 +0100

    libstdc++: Add missing feature test macros
    
    These macros all correspond to features that are already supported, but
    the macro was not defined when the feature was implemented.
    
    Backport from mainline
    2020-04-22  Jonathan Wakely  <jwakely@redhat.com>
    
            * include/bits/ptr_traits.h (__cpp_lib_constexpr_memory): Define to
            indicate P1006R1 support.
            (__cpp_lib_to_address): Define to indicate P0653R2 support.
            * include/std/memory (__cpp_lib_assume_aligned): Define to indicate
            P1007R3 support.
            * include/std/memory_resource (__cpp_lib_polymorphic_allocator):
            Define to indicate P0339R6 support.
            * include/std/string_view (__cpp_lib_starts_ends_with): Define to
            indicate P0457R2 support.
            * include/std/type_traits (__cpp_lib_is_nothrow_convertible): Define
            to indicate P0758R1 support.
            (__cpp_lib_remove_cvref): Define to indicate P0550R2 support.
            (__cpp_lib_type_identity): Define to indicate P0887R1 support.
            * include/std/version (__cpp_lib_is_nothrow_convertible)
            (__cpp_lib_remove_cvref, __cpp_lib_type_identity)
            (__cpp_lib_assume_aligned, __cpp_lib_constexpr_memory)
            (__cpp_lib_polymorphic_allocator, __cpp_lib_starts_ends_with)
            (__cpp_lib_to_address): Define.
            * testsuite/20_util/to_address/1_neg.cc: Adjust dg-error line number.

Diff:
---
 libstdc++-v3/ChangeLog                             | 23 ++++++++++++++++++++++
 libstdc++-v3/include/bits/ptr_traits.h             |  3 +++
 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                   |  9 +++++++++
 libstdc++-v3/testsuite/20_util/to_address/1_neg.cc |  2 +-
 8 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index a481c9f7950..4589039deb5 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,28 @@
 2020-04-23  Jonathan Wakely  <jwakely@redhat.com>
 
+	Backport from mainline
+	2020-04-22  Jonathan Wakely  <jwakely@redhat.com>
+
+	* include/bits/ptr_traits.h (__cpp_lib_constexpr_memory): Define to
+	indicate P1006R1 support.
+	(__cpp_lib_to_address): Define to indicate P0653R2 support.
+	* include/std/memory (__cpp_lib_assume_aligned): Define to indicate
+	P1007R3 support.
+	* include/std/memory_resource (__cpp_lib_polymorphic_allocator):
+	Define to indicate P0339R6 support.
+	* include/std/string_view (__cpp_lib_starts_ends_with): Define to
+	indicate P0457R2 support.
+	* include/std/type_traits (__cpp_lib_is_nothrow_convertible): Define
+	to indicate P0758R1 support.
+	(__cpp_lib_remove_cvref): Define to indicate P0550R2 support.
+	(__cpp_lib_type_identity): Define to indicate P0887R1 support.
+	* include/std/version (__cpp_lib_is_nothrow_convertible)
+	(__cpp_lib_remove_cvref, __cpp_lib_type_identity)
+	(__cpp_lib_assume_aligned, __cpp_lib_constexpr_memory)
+	(__cpp_lib_polymorphic_allocator, __cpp_lib_starts_ends_with)
+	(__cpp_lib_to_address): Define.
+	* testsuite/20_util/to_address/1_neg.cc: Adjust dg-error line number.
+
 	* include/bits/stl_map.h (__cpp_lib_map_insertion): Add comment to
 	non-standard macro.
 	* 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 cff56feb66f..80ecf5b420d 100644
--- a/libstdc++-v3/include/bits/ptr_traits.h
+++ b/libstdc++-v3/include/bits/ptr_traits.h
@@ -35,6 +35,7 @@
 #include <bits/move.h>
 
 #if __cplusplus > 201703L
+#define __cpp_lib_constexpr_memory 201811L
 namespace __gnu_debug { struct _Safe_iterator_base; }
 #endif
 
@@ -180,6 +181,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	return std::__to_address(__ptr.operator->());
     }
 
+#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/std/memory b/libstdc++-v3/include/std/memory
index b6950c76089..cb8be4dc129 100644
--- a/libstdc++-v3/include/std/memory
+++ b/libstdc++-v3/include/std/memory
@@ -157,6 +157,7 @@ inline pointer_safety
 get_pointer_safety() noexcept { return pointer_safety::relaxed; }
 
 #if __cplusplus > 201703L
+#define __cpp_lib_assume_aligned 201811L
   /// Inform the compiler that a pointer is aligned.
   template<size_t _Align, class _Tp>
     [[nodiscard,__gnu__::__always_inline__]]
diff --git a/libstdc++-v3/include/std/memory_resource b/libstdc++-v3/include/std/memory_resource
index 7ff5d17afe7..5b6ec60268a 100644
--- a/libstdc++-v3/include/std/memory_resource
+++ b/libstdc++-v3/include/std/memory_resource
@@ -61,6 +61,7 @@ namespace pmr
   template<typename _Tp>
     class polymorphic_allocator;
 #else // C++20
+# define __cpp_lib_polymorphic_allocator 201902L
   template<typename _Tp = std::byte>
     class polymorphic_allocator;
 #endif
diff --git a/libstdc++-v3/include/std/string_view b/libstdc++-v3/include/std/string_view
index 42822cc41ab..bca3af89836 100644
--- a/libstdc++-v3/include/std/string_view
+++ b/libstdc++-v3/include/std/string_view
@@ -310,6 +310,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       }
 
 #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()) == __x; }
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 993f7e3153c..18bcac824c3 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -1362,6 +1362,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using type = decltype(__test<_From, _To>(0));
     };
 
+#define __cpp_lib_is_nothrow_convertible 201806L
   /// is_nothrow_convertible
   template<typename _From, typename _To>
     struct is_nothrow_convertible
@@ -3027,6 +3028,8 @@ template <typename _From, typename _To>
 #endif // C++17
 
 #if __cplusplus > 201703L
+#define __cpp_lib_remove_cvref 201711L
+
   /// Remove references and cv-qualifiers.
   template<typename _Tp>
     struct remove_cvref
@@ -3037,6 +3040,7 @@ template <typename _From, typename _To>
   template<typename _Tp>
     using remove_cvref_t = __remove_cvref_t<_Tp>;
 
+#define __cpp_lib_type_identity 201806L
   /// Identity metafunction.
   template<typename _Tp>
     struct type_identity { using type = _Tp; };
diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
index a37ee0d5072..fb0440d4e12 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -165,6 +165,7 @@
 // c++2a
 #define __cpp_lib_bitops 201907L
 #define __cpp_lib_bounded_array_traits 201902L
+// __cpp_lib_char8_t is defined in <bits/c++config.h>
 #if __cpp_impl_destroying_delete
 # define __cpp_lib_destroying_delete 201806L
 #endif
@@ -173,14 +174,22 @@
 #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
 
 #if _GLIBCXX_HOSTED
+#define __cpp_lib_assume_aligned 201811L
 #define __cpp_lib_bind_front 201907L
 #define __cpp_lib_constexpr_complex 201711L
+#define __cpp_lib_constexpr_memory 201811L
 #define __cpp_lib_erase_if 202002L
 #define __cpp_lib_interpolate 201902L
 #define __cpp_lib_list_remove_return_type 201806L
+#define __cpp_lib_polymorphic_allocator 201902L
+#define __cpp_lib_starts_ends_with 201711L
+#define __cpp_lib_to_address 201711L
 #endif
 #endif // C++2a
 #endif // C++17
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 33a0e32711a..092413e6581 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 @@
 
 // { dg-options "-std=gnu++2a" }
 // { dg-do compile { target c++2a } }
-// { dg-error "not a function pointer" "" { target *-*-* } 157 }
+// { dg-error "not a function pointer" "" { target *-*-* } 158 }
 
 #include <memory>


More information about the Libstdc++-cvs mailing list