public inbox for libstdc++-cvs@sourceware.org help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/gcov-all-zeros)] libstdc++: Update value of __cpp_lib_constexpr_char_traits for C++20 Date: Tue, 16 Jun 2020 08:24:12 +0000 (GMT) [thread overview] Message-ID: <20200616082412.05257388A831@sourceware.org> (raw) https://gcc.gnu.org/g:b6ab9ecd550227684643b41e9e33a4d3466724d8 commit b6ab9ecd550227684643b41e9e33a4d3466724d8 Author: Jonathan Wakely <jwakely@redhat.com> Date: Mon Jun 15 14:31:26 2020 +0100 libstdc++: Update value of __cpp_lib_constexpr_char_traits for C++20 Although not required by SD-6 or the C++20 draft, we define the macro __cpp_lib_constexpr_char_traits to indicate support for P0432R1. This updates the value in C++20 mode for the P1032R1 changes to char_traits. * include/bits/char_traits.h (__cpp_lib_constexpr_char_traits): Update value for C++20. * include/std/version (__cpp_lib_constexpr_char_traits): Likewise. * testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc: Update expected value. * testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc: Likewise. Diff: --- libstdc++-v3/include/bits/char_traits.h | 9 ++++++++- libstdc++-v3/include/std/version | 6 ++++-- .../char_traits/requirements/constexpr_functions_c++17.cc | 4 +++- .../char_traits/requirements/constexpr_functions_c++20.cc | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/libstdc++-v3/include/bits/char_traits.h b/libstdc++-v3/include/bits/char_traits.h index c623a6713f6..84c2d1b7ff2 100644 --- a/libstdc++-v3/include/bits/char_traits.h +++ b/libstdc++-v3/include/bits/char_traits.h @@ -236,7 +236,14 @@ namespace std _GLIBCXX_VISIBILITY(default) _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus >= 201703L -#define __cpp_lib_constexpr_char_traits 201611 + +#if __cplusplus == 201703L +// Unofficial macro indicating P0426R1 support +# define __cpp_lib_constexpr_char_traits 201611L +#else +// Also support P1032R1 in C++20 +# define __cpp_lib_constexpr_char_traits 201811L +#endif /** * @brief Determine whether the characters of a NULL-terminated diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version index c6bde2cfbda..f64aff4f520 100644 --- a/libstdc++-v3/include/std/version +++ b/libstdc++-v3/include/std/version @@ -127,7 +127,7 @@ #define __cpp_lib_boyer_moore_searcher 201603 #define __cpp_lib_chrono 201611 #define __cpp_lib_clamp 201603 -#define __cpp_lib_constexpr_char_traits 201611 +#define __cpp_lib_constexpr_char_traits 201611L #define __cpp_lib_enable_shared_from_this 201603 #define __cpp_lib_execution 201902L // FIXME: should be 201603L #define __cpp_lib_filesystem 201703 @@ -192,16 +192,18 @@ #if _GLIBCXX_HOSTED #undef __cpp_lib_array_constexpr +#undef __cpp_lib_constexpr_char_traits #define __cpp_lib_array_constexpr 201811L #define __cpp_lib_assume_aligned 201811L #define __cpp_lib_bind_front 201907L // FIXME: #define __cpp_lib_execution 201902L #define __cpp_lib_integer_comparison_functions 202002L #define __cpp_lib_constexpr_algorithms 201806L +#define __cpp_lib_constexpr_char_traits 201811L #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_iterator 201811L #define __cpp_lib_constexpr_memory 201811L #define __cpp_lib_constexpr_numeric 201911L #define __cpp_lib_constexpr_string_view 201811L diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc index 7cb950b89f5..55dcba48db6 100644 --- a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc +++ b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc @@ -75,8 +75,10 @@ template<typename CT> #ifndef __cpp_lib_constexpr_char_traits # error Feature-test macro for constexpr char_traits is missing -#elif __cpp_lib_constexpr_char_traits != 201611 +#elif __cpp_lib_constexpr_char_traits < 201611 # error Feature-test macro for constexpr char_traits has the wrong value +#elif __cpp_lib_constexpr_char_traits > 201611 && __cplusplus == 201703 +# error Feature-test macro for constexpr char_traits has wrong value for C++17 #endif static_assert( test_assign<std::char_traits<char>>() ); diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc index 6358640c1cb..63c7c9cbb57 100644 --- a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc +++ b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc @@ -32,7 +32,7 @@ template<typename CT> #ifndef __cpp_lib_constexpr_char_traits # error Feature-test macro for constexpr char_traits is missing -#elif __cpp_lib_constexpr_char_traits != 201611 +#elif __cpp_lib_constexpr_char_traits != 201811 # error Feature-test macro for constexpr char_traits has the wrong value #endif
reply other threads:[~2020-06-16 8:24 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200616082412.05257388A831@sourceware.org \ --to=marxin@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).