]> gcc.gnu.org Git - gcc.git/commitdiff
libstdc++: Fixes for feature test macros (PR 91480)
authorJonathan Wakely <jwakely@redhat.com>
Tue, 28 Apr 2020 22:31:04 +0000 (23:31 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 28 Apr 2020 22:40:18 +0000 (23:40 +0100)
Remove the non-standard __cpp_lib_allocator_is_always_equal macro and
add the missing macros for P1032R1.

PR libstdc++/91480
* include/bits/allocator.h (__cpp_lib_allocator_is_always_equal):
Remove non-standard macro.
* include/bits/stl_iterator.h (__cpp_lib_constexpr_iterator): Define
to indicate P1032R1 support.
* include/bits/stl_pair.h (__cpp_lib_constexpr_utility): Likewise.
* include/std/string_view (__cpp_lib_constexpr_string_view): Likewise.
* include/std/tuple (__cpp_lib_constexpr_tuple): Likewise.
* include/std/version (__cpp_lib_allocator_is_always_equal): Remove.
(__cpp_lib_constexpr_iterator, __cpp_lib_constexpr_string_view)
(__cpp_lib_constexpr_tuple, __cpp_lib_constexpr_utility): Define.
* testsuite/20_util/function_objects/constexpr_searcher.cc: Check
feature test macro.
* testsuite/20_util/tuple/cons/constexpr_allocator_arg_t.cc: Likewise.
* testsuite/21_strings/basic_string_view/operations/copy/char/
constexpr.cc: Likewise.
* testsuite/24_iterators/insert_iterator/constexpr.cc: Likewise.

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/allocator.h
libstdc++-v3/include/bits/stl_iterator.h
libstdc++-v3/include/bits/stl_pair.h
libstdc++-v3/include/std/string_view
libstdc++-v3/include/std/tuple
libstdc++-v3/include/std/version
libstdc++-v3/testsuite/20_util/function_objects/constexpr_searcher.cc
libstdc++-v3/testsuite/20_util/tuple/cons/constexpr_allocator_arg_t.cc
libstdc++-v3/testsuite/21_strings/basic_string_view/operations/copy/char/constexpr.cc
libstdc++-v3/testsuite/24_iterators/insert_iterator/constexpr.cc

index a5b6769ce887560b1ddbc7f8e038673bcd28b563..f8cf71e057f19043958063a090b114fd4d971779 100644 (file)
@@ -1,5 +1,23 @@
 2020-04-28  Jonathan Wakely  <jwakely@redhat.com>
 
+       PR libstdc++/91480
+       * include/bits/allocator.h (__cpp_lib_allocator_is_always_equal):
+       Remove non-standard macro.
+       * include/bits/stl_iterator.h (__cpp_lib_constexpr_iterator): Define
+       to indicate P1032R1 support.
+       * include/bits/stl_pair.h (__cpp_lib_constexpr_utility): Likewise.
+       * include/std/string_view (__cpp_lib_constexpr_string_view): Likewise.
+       * include/std/tuple (__cpp_lib_constexpr_tuple): Likewise.
+       * include/std/version (__cpp_lib_allocator_is_always_equal): Remove.
+       (__cpp_lib_constexpr_iterator, __cpp_lib_constexpr_string_view)
+       (__cpp_lib_constexpr_tuple, __cpp_lib_constexpr_utility): Define.
+       * testsuite/20_util/function_objects/constexpr_searcher.cc: Check
+       feature test macro.
+       * testsuite/20_util/tuple/cons/constexpr_allocator_arg_t.cc: Likewise.
+       * testsuite/21_strings/basic_string_view/operations/copy/char/
+       constexpr.cc: Likewise.
+       * testsuite/24_iterators/insert_iterator/constexpr.cc: Likewise.
+
        PR libstdc++/94831
        * include/bits/alloc_traits.h (_S_construct): Restore placement
        new-expression for C++11/14/17 and call std::construct_at directly
index ee564791dfaeb0376648f27729ab1e895549bbfb..dcca769938c40ee83dfae8dc92372329e34c55b6 100644 (file)
@@ -50,9 +50,6 @@
 #endif
 
 #define __cpp_lib_incomplete_container_elements 201505
-#if __cplusplus >= 201103L
-# define __cpp_lib_allocator_is_always_equal 201411
-#endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
index cc0b3e0a7668996e2dc8ab60b01211b979358ca9..fdb1121f8235e764dd76e88e9d90cca6b6551b43 100644 (file)
@@ -71,6 +71,7 @@
 
 #if __cplusplus > 201703L
 # define __cpp_lib_array_constexpr 201811L
+# define __cpp_lib_constexpr_iterator 201811L
 #elif __cplusplus == 201703L
 # define __cpp_lib_array_constexpr 201803L
 #endif
index 505bcc32e67d584004064d4252a971fb6081b1d2..491c599076e75ebe163cead9bf1a0aad8596a18e 100644 (file)
@@ -63,6 +63,7 @@
 #endif
 #if __cplusplus > 201703L
 # include <compare>
+# define __cpp_lib_constexpr_utility 201811L
 #endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
index 289d47435486d105681fcc8286c2a8952e3c1637..7c7c1b3b5dd7e9a6d4cb26e978619511f413bead 100644 (file)
@@ -48,7 +48,10 @@ namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#define __cpp_lib_string_view 201803
+# define __cpp_lib_string_view 201803L
+#if __cplusplus > 201703L
+# define __cpp_lib_constexpr_string_view 201811L
+#endif
 
   // Helper for basic_string and basic_string_view members.
   constexpr size_t
index 808947781aed4f56090127fb7fb0e99a086664a6..db4872d3a527dcd4836d471b57fb8f74f82216c0 100644 (file)
@@ -41,6 +41,7 @@
 #include <bits/invoke.h>
 #if __cplusplus > 201703L
 # include <compare>
+# define __cpp_lib_constexpr_tuple 201811L
 #endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
index fa505f25e981d5daaf51a212e9c6cc81ea454e5e..c3a5bd26e636b1fb12aacc3a7334ba6ac3d245cc 100644 (file)
@@ -50,7 +50,6 @@
 #define __cpp_lib_result_of_sfinae 201210
 
 #if _GLIBCXX_HOSTED
-# define __cpp_lib_allocator_is_always_equal 201411
 # define __cpp_lib_allocator_traits_is_always_equal 201411
 # define __cpp_lib_shared_ptr_arrays 201611L
 #endif
 # define __cpp_lib_shared_mutex 201505
 #endif
 #define __cpp_lib_shared_ptr_weak_type 201606
-#define __cpp_lib_string_view 201803
+#define __cpp_lib_string_view 201803L
 // #define __cpp_lib_to_chars 201611L
 #define __cpp_lib_unordered_map_try_emplace 201411
 #define __cpp_lib_variant 201606L
 #define __cpp_lib_constexpr_complex 201711L
 #define __cpp_lib_constexpr_dynamic_alloc 201907L
 #define __cpp_lib_constexpr_functional 201907L
+# define __cpp_lib_constexpr_iterator 201811L
 #define __cpp_lib_constexpr_memory 201811L
 #define __cpp_lib_constexpr_numeric 201911L
+#define __cpp_lib_constexpr_string_view 201811L
+#define __cpp_lib_constexpr_tuple 201811L
+#define __cpp_lib_constexpr_utility 201811L
 #define __cpp_lib_erase_if 202002L
 #define __cpp_lib_interpolate 201902L
 #ifdef _GLIBCXX_HAS_GTHREADS
index 642d0a388fb80aa5bb3173986a240132f38927a8..f9ecbb365a44968773f10fe1e4e12708e4c71c5b 100644 (file)
 // { dg-do compile { target c++2a } }
 
 #include <functional>
+
+#ifndef __cpp_lib_constexpr_functional
+# error "Feature test macro for constexpr searcher is missing in <functional>"
+#elif __cpp_lib_constexpr_functional < 201811L
+# error "Feature test macro for constexpr searcher has wrong value in <functional>"
+#endif
+
 #include <string_view>
 
 const std::string_view
index e8423b48cdb3a58ccdebf5199e7485187214ab63..8821932ca97dd0978199d17c7185adb9030c4486 100644 (file)
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-#include <memory>
 #include <tuple>
 
+#ifndef __cpp_lib_constexpr_tuple
+# error "Feature test macro for constexpr allocator constructors is missing in <tuple>"
+#elif __cpp_lib_constexpr_tuple < 201811L
+# error "Feature test macro for constexpr allocator constructors has wrong value in <tuple>"
+#endif
+
+#include <memory>
+
 const std::allocator<int> alloc{};
 
 constexpr bool
index 86a78108696b759aca2f5ea0621c3ef2fd6c072d..64a0766281dad699aec02f508dfb46fecbc96bc6 100644 (file)
 
 #include <string_view>
 
+#ifndef __cpp_lib_constexpr_string_view
+# error "Feature test macro for constexpr copy is missing in <string_view>"
+#elif __cpp_lib_constexpr_iterator < 201811L
+# error "Feature test macro for constexpr copy has wrong value in <string_view>"
+#endif
+
 constexpr bool
 test01()
 {
index b4fc1b5e4e730ce7f961d433ffeea46169da22af..b061bc968487b5e9159c0565ecb6ac2f2ffdb512 100644 (file)
 
 #include <iterator>
 
+#ifndef __cpp_lib_constexpr_iterator
+# error "Feature test macro for constexpr insert iterators is missing in <iterator>"
+#elif __cpp_lib_constexpr_iterator < 201811L
+# error "Feature test macro for constexpr insert iterators has wrong value in <iterator>"
+#endif
+
 struct container
 {
   using value_type = int;
This page took 0.076293 seconds and 5 git commands to generate.