libstdc++: Add missing feature test macros
authorJonathan Wakely <jwakely@redhat.com>
Wed, 22 Apr 2020 21:54:34 +0000 (22:54 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 22 Apr 2020 21:54:34 +0000 (22:54 +0100)
These macros all correspond to features that are already supported, but
the macro was not defined when the feature was implemented.

* include/bits/ptr_traits.h (__cpp_lib_constexpr_memory): Define to
indicate P1006R1 support.
(__cpp_lib_to_address): Define to indicate P0653R2 support.
* include/bits/range_access.h (__cpp_lib_ssize): Define to indicate
P1227R2 support.
* include/bits/ranges_algo.h (__cpp_lib_shift): Define to indicate
P0769R2 support.
* include/std/atomic (__cpp_lib_atomic_float): Define to indicate
P0020R6 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_atomic_float)
(__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_shift, __cpp_lib_ssize, __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/bits/range_access.h
libstdc++-v3/include/bits/ranges_algo.h
libstdc++-v3/include/std/atomic
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 4fd72daa942c58da6d66dd72f35b1af066c1c9d1..182f5dc4b7eab25d7a7ba6769687a7bcf7442632 100644 (file)
@@ -1,5 +1,32 @@
 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/bits/range_access.h (__cpp_lib_ssize): Define to indicate
+       P1227R2 support.
+       * include/bits/ranges_algo.h (__cpp_lib_shift): Define to indicate
+       P0769R2 support.
+       * include/std/atomic (__cpp_lib_atomic_float): Define to indicate
+       P0020R6 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_atomic_float)
+       (__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_shift, __cpp_lib_ssize, __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): Remove old
        macro.
        * include/bits/unordered_map.h (__cpp_lib_unordered_map_insertion):
index 8fd91bf7bf271904682e30d9ba0675107bfebd0e..541abab29e121af61b3d93328c475ad62e5280cf 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 acd701e1385a83fb4f34d3433c43cff809374b67..82d9e2180c5265f8a07d3148cd3f16d4d787ca92 100644 (file)
@@ -322,6 +322,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif // C++17
 
 #if __cplusplus > 201703L
+#define __cpp_lib_ssize 201902L
   template<typename _Container>
     constexpr auto
     ssize(const _Container& __cont)
index 56fbd50ce8ef2e9cca04c5aae9dcfdf7c59dc947..aa07cb97ea69dc9398d9785e8ed158de759df96d 100644 (file)
@@ -3691,6 +3691,7 @@ namespace ranges
 
 } // namespace ranges
 
+#define __cpp_lib_shift 201806L
   template<class ForwardIterator>
     constexpr ForwardIterator
     shift_left(ForwardIterator __first, ForwardIterator __last,
index 40f23bdfc962887423475a9c79f30343475affa6..a455286a78417332629eb31a46da0a513cc22e27 100644 (file)
@@ -1477,6 +1477,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); }
 
 #if __cplusplus > 201703L
+#define __cpp_lib_atomic_float 201711L
   template<>
     struct atomic<float> : __atomic_float<float>
     {
index aaee6e42c1a1470162f9cd48ddefd2b651bd9b6d..1e8eebd731ca81fac10ce97ff1b184c13ea63b4d 100644 (file)
@@ -180,6 +180,7 @@ get_pointer_safety() noexcept { return pointer_safety::relaxed; }
 // @}
 
 #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)
index f87ef9688f35f17c72ba6a1b591cbc16b99733a3..514c9888e7a76ce7f73a1f9bd32616ab09172f1f 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 b5d8eab2f337d98a5e0c42e474a61d8d756c179e..289d47435486d105681fcc8286c2a8952e3c1637 100644 (file)
@@ -322,6 +322,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 f96b5297b83af75822546b2f98f9d58446ba51ca..75a98e38c0a478676b043bef50ad17ce38c30dfd 100644 (file)
@@ -1489,6 +1489,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { };
 
 #if __cplusplus > 201703L
+#define __cpp_lib_is_nothrow_convertible 201806L
   /// is_nothrow_convertible
   template<typename _From, typename _To>
     struct is_nothrow_convertible
@@ -3221,6 +3222,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
@@ -3231,6 +3234,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 48547c63014aa5e91c382f06169f3463b0f3f92b..3b1fd70006972139c3cd1b34cc4b4c4b5e06536a 100644 (file)
 
 #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 <bits/c++config.h>
 #if __cpp_concepts >= 201907L
 # define __cpp_lib_concepts 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_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
 #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 >= 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
index ee64a2281fba6c2019739c7ca4780353d0c2a467..cb9f8dc06813cb3ef8d7a3142cebaa8b6049baea 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>