diff mbox series

Fix missing or incorrect feature test macros

Message ID 20190115120111.GA16586@redhat.com
State New
Headers show
Series Fix missing or incorrect feature test macros | expand

Commit Message

Jonathan Wakely Jan. 15, 2019, 12:01 p.m. UTC
* doc/xml/manual/status_cxx2017.xml: Document P0032R3 and P0307R2
	status.
	* include/bits/stl_uninitialized.h (__cpp_lib_raw_memory_algorithms):
	Define.
	* include/std/any (__cpp_lib_any): Define as 201606L, because P0032R3
	changes are supported.
	* include/std/optional (__cpp_lib_optional): Likewise.
	* include/std/variant (__cpp_lib_variant): Likewise.
	* include/std/version [!__STRICT_ANSI__]
	(__cpp_lib_uncaught_exceptions): Define as long integer.
	[__cplusplus >= 201703L] (__cpp_lib_any)
	(__cpp_lib_raw_memory_algorithms, __cpp_lib_uncaught_exceptions)
	(__cpp_lib_variant): Define for C++17.
	[__cplusplus >= 201703L] (__cpp_lib_optional): Update value and define
	as long integer.
	* libsupc++/exception (__cpp_lib_uncaught_exceptions): Define as long
	integer.

Tested powerpc64le-linux, committed to trunk.
commit 52e40c01e58019174013a4b8e0c32e58704a0cac
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Jan 15 11:28:07 2019 +0000

    Fix missing or incorrect feature test macros
    
            * doc/xml/manual/status_cxx2017.xml: Document P0032R3 and P0307R2
            status.
            * include/bits/stl_uninitialized.h (__cpp_lib_raw_memory_algorithms):
            Define.
            * include/std/any (__cpp_lib_any): Define as 201606L, because P0032R3
            changes are supported.
            * include/std/optional (__cpp_lib_optional): Likewise.
            * include/std/variant (__cpp_lib_variant): Likewise.
            * include/std/version [!__STRICT_ANSI__]
            (__cpp_lib_uncaught_exceptions): Define as long integer.
            [__cplusplus >= 201703L] (__cpp_lib_any)
            (__cpp_lib_raw_memory_algorithms, __cpp_lib_uncaught_exceptions)
            (__cpp_lib_variant): Define for C++17.
            [__cplusplus >= 201703L] (__cpp_lib_optional): Update value and define
            as long integer.
            * libsupc++/exception (__cpp_lib_uncaught_exceptions): Define as long
            integer.

Comments

Jonathan Wakely Jan. 15, 2019, 12:59 p.m. UTC | #1
On 15/01/19 12:01 +0000, Jonathan Wakely wrote:
>	* doc/xml/manual/status_cxx2017.xml: Document P0032R3 and P0307R2
>	status.
>	* include/bits/stl_uninitialized.h (__cpp_lib_raw_memory_algorithms):
>	Define.
>	* include/std/any (__cpp_lib_any): Define as 201606L, because P0032R3
>	changes are supported.
>	* include/std/optional (__cpp_lib_optional): Likewise.
>	* include/std/variant (__cpp_lib_variant): Likewise.
>	* include/std/version [!__STRICT_ANSI__]
>	(__cpp_lib_uncaught_exceptions): Define as long integer.
>	[__cplusplus >= 201703L] (__cpp_lib_any)
>	(__cpp_lib_raw_memory_algorithms, __cpp_lib_uncaught_exceptions)
>	(__cpp_lib_variant): Define for C++17.
>	[__cplusplus >= 201703L] (__cpp_lib_optional): Update value and define
>	as long integer.
>	* libsupc++/exception (__cpp_lib_uncaught_exceptions): Define as long
>	integer.

Some more found by Jakub. Everything in <version> should be consistent
with the rest of the library headers now, for all -std modes.

Tested powerpc64le-linux, committed to trunk.
commit 40a9d96b4b6ce6d4366a9e3f0cc9f8b8bfb054a5
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Jan 15 12:39:18 2019 +0000

    Fix more missing or incorrect feature test macros
    
            * include/bits/erase_if.h [__cplusplus > 201703L]
            (__cpp_lib_erase_if): Only define for C++2a.
            * include/std/iterator [__cplusplus >= 201402L && !_GLIBCXX_DEBUG]
            (__cpp_lib_null_iterators): Define.
            * include/std/version [__cplusplus >= 201402L && !_GLIBCXX_DEBUG]
            (__cpp_lib_null_iterators): Define.
            [__cpp_impl_destroying_delete] (__cpp_lib_destroying_delete): Define.

diff --git a/libstdc++-v3/include/bits/erase_if.h b/libstdc++-v3/include/bits/erase_if.h
index d84f5ffc8ed..4641dbebd85 100644
--- a/libstdc++-v3/include/bits/erase_if.h
+++ b/libstdc++-v3/include/bits/erase_if.h
@@ -38,7 +38,9 @@ namespace std
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#define __cpp_lib_erase_if 201900L
+#if __cplusplus > 201703L
+# define __cpp_lib_erase_if 201900L
+#endif
 
   namespace __detail
   {
diff --git a/libstdc++-v3/include/std/iterator b/libstdc++-v3/include/std/iterator
index 5c6903c1cff..9d9e19c4c6b 100644
--- a/libstdc++-v3/include/std/iterator
+++ b/libstdc++-v3/include/std/iterator
@@ -67,4 +67,8 @@
 #include <bits/streambuf_iterator.h>
 #include <bits/range_access.h>
 
+#if __cplusplus >= 201402L && ! defined _GLIBCXX_DEBUG // PR libstdc++/70303
+# define __cpp_lib_null_iterators 201304L
+#endif
+
 #endif /* _GLIBCXX_ITERATOR */
diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
index f49a45940f9..36d291dcf93 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -42,6 +42,10 @@
 # define __cpp_lib_uncaught_exceptions 201411L
 #endif
 
+#if __cpp_impl_destroying_delete
+# define __cpp_lib_destroying_delete 201806L
+#endif
+
 #if __cplusplus >= 201103L
 // c++11
 #define __cpp_lib_allocator_is_always_equal 201411
@@ -71,6 +75,9 @@
 #define __cpp_lib_is_final 201402L
 #define __cpp_lib_make_reverse_iterator 201402
 #define __cpp_lib_make_unique 201304
+#ifndef _GLIBCXX_DEBUG // PR libstdc++/70303
+# define __cpp_lib_null_iterators 201304L
+#endif
 #define __cpp_lib_quoted_string_io 201304
 #define __cpp_lib_robust_nonmodifying_seq_ops 201304
 #ifdef _GLIBCXX_HAS_GTHREADS
Jonathan Wakely Jan. 15, 2019, 1:13 p.m. UTC | #2
On 15/01/19 12:59 +0000, Jonathan Wakely wrote:
>On 15/01/19 12:01 +0000, Jonathan Wakely wrote:
>>	* doc/xml/manual/status_cxx2017.xml: Document P0032R3 and P0307R2
>>	status.
>>	* include/bits/stl_uninitialized.h (__cpp_lib_raw_memory_algorithms):
>>	Define.
>>	* include/std/any (__cpp_lib_any): Define as 201606L, because P0032R3
>>	changes are supported.
>>	* include/std/optional (__cpp_lib_optional): Likewise.
>>	* include/std/variant (__cpp_lib_variant): Likewise.
>>	* include/std/version [!__STRICT_ANSI__]
>>	(__cpp_lib_uncaught_exceptions): Define as long integer.
>>	[__cplusplus >= 201703L] (__cpp_lib_any)
>>	(__cpp_lib_raw_memory_algorithms, __cpp_lib_uncaught_exceptions)
>>	(__cpp_lib_variant): Define for C++17.
>>	[__cplusplus >= 201703L] (__cpp_lib_optional): Update value and define
>>	as long integer.
>>	* libsupc++/exception (__cpp_lib_uncaught_exceptions): Define as long
>>	integer.
>
>Some more found by Jakub. Everything in <version> should be consistent
>with the rest of the library headers now, for all -std modes.

And one more, where we defined it consistently, but not to the right
value.

Tested powerpc64le-linux, committed to trunk.
commit 172b1fa26185715e39ee7234c86b58e895ecc4b6
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Jan 15 13:03:06 2019 +0000

    Update value of __cpp_lib_shared_ptr_arrays macro
    
            * include/bits/shared_ptr_base.h (__cpp_lib_shared_ptr_arrays): Define
            as 201611L, because P0497R0 changes are supported.
            * include/std/version (__cpp_lib_shared_ptr_arrays): Likewise.

diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
index cacc7d689ea..b45cbf73667 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -890,7 +890,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	  _M_pi = nullptr;
     }
 
-#define __cpp_lib_shared_ptr_arrays 201603
+#define __cpp_lib_shared_ptr_arrays 201611L
 
   // Helper traits for shared_ptr of array:
 
diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
index 36d291dcf93..38277b9ecf2 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -52,7 +52,7 @@
 #define __cpp_lib_allocator_traits_is_always_equal 201411
 #define __cpp_lib_is_null_pointer 201309
 #define __cpp_lib_result_of_sfinae 201210
-#define __cpp_lib_shared_ptr_arrays 201603
+#define __cpp_lib_shared_ptr_arrays 201611L
 
 #if !defined(__STRICT_ANSI__)
 // gnu++11
diff mbox series

Patch

diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml
index 0af8a02b00f..c9913a9e3a7 100644
--- a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml
+++ b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml
@@ -787,6 +787,31 @@  Feature-testing recommendations for C++</link>.
              <code> __cpp_lib_to_chars >= 201611 </code></entry>
     </row>
 
+    <row>
+      <entry> Homogeneous interface for variant, any and optional </entry>
+      <entry>
+	<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0032r3.pdf">
+	P0032R3
+	</link>
+      </entry>
+      <entry align="center"> 7.1  </entry>
+      <entry>
+             <code> __cpp_lib_any >= 201606 </code>,
+             <code> __cpp_lib_optional >= 201606 </code>,
+             <code> __cpp_lib_variant >= 201606 </code>
+      </entry>
+    </row>
+
+    <row>
+      <entry> Making Optional Greater Equal Again </entry>
+      <entry>
+	<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0307r2.pdf">
+	P0307R2
+	</link>
+      </entry>
+      <entry align="center"> 7.1  </entry>
+      <entry> <code> __cpp_lib_optional >= 201606 </code> </entry>
+    </row>
 
   </tbody>
 </tgroup>
diff --git a/libstdc++-v3/include/bits/stl_uninitialized.h b/libstdc++-v3/include/bits/stl_uninitialized.h
index a0c574dfc44..664e4ad8f00 100644
--- a/libstdc++-v3/include/bits/stl_uninitialized.h
+++ b/libstdc++-v3/include/bits/stl_uninitialized.h
@@ -826,7 +826,9 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #endif
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
+# define __cpp_lib_raw_memory_algorithms 201606L
+
   template <typename _ForwardIterator>
     inline void
     uninitialized_default_construct(_ForwardIterator __first,
@@ -877,7 +879,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	 __count, __result);
       return {__res.first.base(), __res.second};
     }
-#endif
+#endif // C++17
 
 #if __cplusplus >= 201103L
   template<typename _Tp, typename _Up, typename _Allocator>
diff --git a/libstdc++-v3/include/std/any b/libstdc++-v3/include/std/any
index 59d207181cf..385a99ce744 100644
--- a/libstdc++-v3/include/std/any
+++ b/libstdc++-v3/include/std/any
@@ -66,7 +66,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
   }
 
-#define __cpp_lib_any 201603
+#define __cpp_lib_any 201606L
 
   /**
    *  @brief A type-safe container of any type.
diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional
index c5e66bdd140..d243930fed4 100644
--- a/libstdc++-v3/include/std/optional
+++ b/libstdc++-v3/include/std/optional
@@ -51,7 +51,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *  @{
    */
 
-#define __cpp_lib_optional 201603
+#define __cpp_lib_optional 201606L
 
   template<typename _Tp>
     class optional;
diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index 83cf99e9ae0..89deb143097 100644
--- a/libstdc++-v3/include/std/variant
+++ b/libstdc++-v3/include/std/variant
@@ -68,7 +68,7 @@  namespace __variant
 } // namespace __variant
 } // namespace __detail
 
-#define __cpp_lib_variant 201603
+#define __cpp_lib_variant 201606L
 
   template<typename... _Types> class tuple;
   template<typename... _Types> class variant;
diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
index e9a1f1251af..f49a45940f9 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -39,7 +39,7 @@ 
 
 #if !defined(__STRICT_ANSI__)
 // gnu++03
-# define __cpp_lib_uncaught_exceptions 201411
+# define __cpp_lib_uncaught_exceptions 201411L
 #endif
 
 #if __cplusplus >= 201103L
@@ -85,6 +85,7 @@ 
 #if __cplusplus >= 201703L
 // c++17
 #define __cpp_lib_addressof_constexpr 201603
+#define __cpp_lib_any 201606L
 #define __cpp_lib_apply 201603
 #define __cpp_lib_array_constexpr 201603
 #define __cpp_lib_as_const 201510
@@ -126,7 +127,8 @@ 
 #define __cpp_lib_node_extract 201606
 #define __cpp_lib_nonmember_container_access 201411
 #define __cpp_lib_not_fn 201603
-#define __cpp_lib_optional 201603
+#define __cpp_lib_optional 201606L
+#define __cpp_lib_raw_memory_algorithms 201606L
 #define __cpp_lib_sample 201603
 #ifdef _GLIBCXX_HAS_GTHREADS
 # define __cpp_lib_scoped_lock 201703
@@ -135,8 +137,10 @@ 
 #define __cpp_lib_shared_ptr_weak_type 201606
 #define __cpp_lib_string_view 201603
 #define __cpp_lib_type_trait_variable_templates 201510L
+#define __cpp_lib_uncaught_exceptions 201411L
 #define __cpp_lib_unordered_map_insertion 201411
 #define __cpp_lib_unordered_map_try_emplace 201411
+#define __cpp_lib_variant 201606L
 #define __cpp_lib_void_t 201411
 
 #if __cplusplus > 201703L
diff --git a/libstdc++-v3/libsupc++/exception b/libstdc++-v3/libsupc++/exception
index a90d38ee8e9..073bfdda42d 100644
--- a/libstdc++-v3/libsupc++/exception
+++ b/libstdc++-v3/libsupc++/exception
@@ -101,8 +101,8 @@  namespace std
   _GLIBCXX17_DEPRECATED
   bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
 
-#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++17 or gnu++98
-#define __cpp_lib_uncaught_exceptions 201411
+#if __cplusplus >= 201703L || !defined(__STRICT_ANSI__) // c++17 or gnu++98
+#define __cpp_lib_uncaught_exceptions 201411L
   /// The number of uncaught exceptions.
   int uncaught_exceptions() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
 #endif