]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Add missing feature test macros
authorJonathan Wakely <jwakely@redhat.com>
Thu, 23 Apr 2020 16:39:21 +0000 (17:39 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 23 Apr 2020 17:54:45 +0000 (18:54 +0100)
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.

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/ptr_traits.h
libstdc++-v3/include/std/memory
libstdc++-v3/include/std/memory_resource
libstdc++-v3/include/std/string_view
libstdc++-v3/include/std/type_traits
libstdc++-v3/include/std/version
libstdc++-v3/testsuite/20_util/to_address/1_neg.cc

index a481c9f79503a33e6cf69872f8bbe7e039ff3664..4589039deb5969901e294c2373a3f8d725469eeb 100644 (file)
@@ -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):
index cff56feb66fa5af5d37c95e79e689981c53b53dd..80ecf5b420d2736dd9bab202c4439b7cc0118bf8 100644 (file)
@@ -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
index b6950c76089a3a11ef9d38575906de48a72670ea..cb8be4dc12934ef55414749ba4337b84d65be4ca 100644 (file)
@@ -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__]]
index 7ff5d17afe7920158623de7055333e6a6f3ed079..5b6ec60268aa1d49bd822ee218331af2edc277d2 100644 (file)
@@ -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
index 42822cc41abbd1c7fc54b3bd47bba46703aba796..bca3af89836c784441b189a378df28fcecef3e90 100644 (file)
@@ -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; }
index 993f7e3153c831988d895a1751b11c44de582b0a..18bcac824c38e3d5f619d95f403dbd9ceaf65c16 100644 (file)
@@ -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; };
index a37ee0d5072d1f8bd58c27275bf4dcc8c8d87eba..fb0440d4e126b0d04eb412793aabd335f4640763 100644 (file)
 // 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
 #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
index 33a0e32711aaeeb363004f65a5331a52460f3f1f..092413e6581013548b6bc5289d422609ce63497f 100644 (file)
@@ -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>