From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2136) id E999E3948829; Wed, 17 Jun 2020 20:50:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E999E3948829 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592427058; bh=p/iKiMnJ7LzglxFSSZD6PoUoaqSaP6u0XcMx7nv7GHQ=; h=From:To:Subject:Date:From; b=KtrMNaV8Ton8vhomndt5cOLUL5FLfj/6Hiy7KITGCqsRv9B4jZxJBPWoXkowlMQeQ zq10qFhrdy3KAiE15m75nBNwc0ZoDAW0uvMCoHKr+Vdc5LJeQfwhxnGWysz1e+T83h I+AdeWa8RGSHiws0hef7ir2vbExKBK2ASIQdINQs= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Aldy Hernandez To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc/devel/ranger] libstdc++: Fixes for feature test macros (PR 91480) X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/devel/ranger X-Git-Oldrev: 162c40a4c127cc55d701bb8760e17708d0ca2fe0 X-Git-Newrev: d0330a03606d06dc4084e9c8734a549d22676463 Message-Id: <20200617205058.E999E3948829@sourceware.org> Date: Wed, 17 Jun 2020 20:50:58 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2020 20:50:59 -0000 https://gcc.gnu.org/g:d0330a03606d06dc4084e9c8734a549d22676463 commit d0330a03606d06dc4084e9c8734a549d22676463 Author: Jonathan Wakely Date: Tue Apr 28 23:31:04 2020 +0100 libstdc++: Fixes for feature test macros (PR 91480) 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. Diff: --- libstdc++-v3/ChangeLog | 18 ++++++++++++++++++ libstdc++-v3/include/bits/allocator.h | 3 --- libstdc++-v3/include/bits/stl_iterator.h | 1 + libstdc++-v3/include/bits/stl_pair.h | 1 + libstdc++-v3/include/std/string_view | 5 ++++- libstdc++-v3/include/std/tuple | 1 + libstdc++-v3/include/std/version | 7 +++++-- .../20_util/function_objects/constexpr_searcher.cc | 7 +++++++ .../20_util/tuple/cons/constexpr_allocator_arg_t.cc | 9 ++++++++- .../operations/copy/char/constexpr.cc | 6 ++++++ .../24_iterators/insert_iterator/constexpr.cc | 6 ++++++ 11 files changed, 57 insertions(+), 7 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index a5b6769ce88..f8cf71e057f 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,23 @@ 2020-04-28 Jonathan Wakely + 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 diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h index ee564791dfa..dcca769938c 100644 --- a/libstdc++-v3/include/bits/allocator.h +++ b/libstdc++-v3/include/bits/allocator.h @@ -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) { diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index cc0b3e0a766..fdb1121f823 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -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 diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h index 505bcc32e67..491c599076e 100644 --- a/libstdc++-v3/include/bits/stl_pair.h +++ b/libstdc++-v3/include/bits/stl_pair.h @@ -63,6 +63,7 @@ #endif #if __cplusplus > 201703L # include +# define __cpp_lib_constexpr_utility 201811L #endif namespace std _GLIBCXX_VISIBILITY(default) diff --git a/libstdc++-v3/include/std/string_view b/libstdc++-v3/include/std/string_view index 289d4743548..7c7c1b3b5dd 100644 --- a/libstdc++-v3/include/std/string_view +++ b/libstdc++-v3/include/std/string_view @@ -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 diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index 808947781ae..db4872d3a52 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -41,6 +41,7 @@ #include #if __cplusplus > 201703L # include +# define __cpp_lib_constexpr_tuple 201811L #endif namespace std _GLIBCXX_VISIBILITY(default) diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version index fa505f25e98..c3a5bd26e63 100644 --- a/libstdc++-v3/include/std/version +++ b/libstdc++-v3/include/std/version @@ -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 @@ -157,7 +156,7 @@ # 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 @@ -201,8 +200,12 @@ #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 diff --git a/libstdc++-v3/testsuite/20_util/function_objects/constexpr_searcher.cc b/libstdc++-v3/testsuite/20_util/function_objects/constexpr_searcher.cc index 642d0a388fb..f9ecbb365a4 100644 --- a/libstdc++-v3/testsuite/20_util/function_objects/constexpr_searcher.cc +++ b/libstdc++-v3/testsuite/20_util/function_objects/constexpr_searcher.cc @@ -19,6 +19,13 @@ // { dg-do compile { target c++2a } } #include + +#ifndef __cpp_lib_constexpr_functional +# error "Feature test macro for constexpr searcher is missing in " +#elif __cpp_lib_constexpr_functional < 201811L +# error "Feature test macro for constexpr searcher has wrong value in " +#endif + #include const std::string_view diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/constexpr_allocator_arg_t.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/constexpr_allocator_arg_t.cc index e8423b48cdb..8821932ca97 100644 --- a/libstdc++-v3/testsuite/20_util/tuple/cons/constexpr_allocator_arg_t.cc +++ b/libstdc++-v3/testsuite/20_util/tuple/cons/constexpr_allocator_arg_t.cc @@ -18,9 +18,16 @@ // with this library; see the file COPYING3. If not see // . -#include #include +#ifndef __cpp_lib_constexpr_tuple +# error "Feature test macro for constexpr allocator constructors is missing in " +#elif __cpp_lib_constexpr_tuple < 201811L +# error "Feature test macro for constexpr allocator constructors has wrong value in " +#endif + +#include + const std::allocator alloc{}; constexpr bool diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/copy/char/constexpr.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/copy/char/constexpr.cc index 86a78108696..64a0766281d 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/copy/char/constexpr.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/copy/char/constexpr.cc @@ -20,6 +20,12 @@ #include +#ifndef __cpp_lib_constexpr_string_view +# error "Feature test macro for constexpr copy is missing in " +#elif __cpp_lib_constexpr_iterator < 201811L +# error "Feature test macro for constexpr copy has wrong value in " +#endif + constexpr bool test01() { diff --git a/libstdc++-v3/testsuite/24_iterators/insert_iterator/constexpr.cc b/libstdc++-v3/testsuite/24_iterators/insert_iterator/constexpr.cc index b4fc1b5e4e7..b061bc96848 100644 --- a/libstdc++-v3/testsuite/24_iterators/insert_iterator/constexpr.cc +++ b/libstdc++-v3/testsuite/24_iterators/insert_iterator/constexpr.cc @@ -20,6 +20,12 @@ #include +#ifndef __cpp_lib_constexpr_iterator +# error "Feature test macro for constexpr insert iterators is missing in " +#elif __cpp_lib_constexpr_iterator < 201811L +# error "Feature test macro for constexpr insert iterators has wrong value in " +#endif + struct container { using value_type = int;