From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id C7255386FC0A for ; Fri, 30 Apr 2021 21:27:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C7255386FC0A Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-143-25x85RkhMCSoO6jPeUTnGw-1; Fri, 30 Apr 2021 17:27:48 -0400 X-MC-Unique: 25x85RkhMCSoO6jPeUTnGw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 738401898296; Fri, 30 Apr 2021 21:27:47 +0000 (UTC) Received: from localhost (unknown [10.33.36.164]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A3705D9CC; Fri, 30 Apr 2021 21:27:46 +0000 (UTC) Date: Fri, 30 Apr 2021 22:27:46 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [committed] libstdc++: Define __cpp_lib_constexpr_string macro Message-ID: <20210430212746.GD3008@redhat.com> References: MIME-Version: 1.0 In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="5LBS9LiS8wIv0ZHM" Content-Disposition: inline X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Apr 2021 21:27:53 -0000 --5LBS9LiS8wIv0ZHM Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline On 28/04/21 16:14 +0100, Jonathan Wakely wrote: >As noted in r11-1339-gb6ab9ecd550227684643b41e9e33a4d3466724d8 we define >a non-standard __cpp_lib_constexpr_char_traits feature test macro to >indicate support for P0426R1 and P1032R1. At some point last year the >__cpp_lib_constexpr_string macro was retconned to indicate support for >those papers. This adds the new macro (which we didn't previously >define, because it referred to P0980R1 "Making std::string constexpr" >which we don't support). > >libstdc++-v3/ChangeLog: > > * include/bits/basic_string.h (__cpp_lib_constexpr_string): Define. > * include/std/version (__cpp_lib_constexpr_string): Define. > * testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc: > Check for __cpp_lib_constexpr_string. > * testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc: > Likewise. > * testsuite/21_strings/char_traits/requirements/version.cc: New test. I messed up the __cpp_lib_constexpr_string macro by copy&pasting from the __cpp_lib_constexpr_char_traits one, which is defined inside a #ifdef __cplusplus >= 201702 block. But for __cpp_lib_constexpr_string it isn't so the #else means that we define it to 201811L for everything newer *or* older than C++17. I also noticed that __cpp_lib_semaphore wasn't defined consistently, as it's failing on AIX. Fixed on trunk by this patch. Tested x86_64-linux and powerpc-aix. I'll backport this to the relevant branches too. --5LBS9LiS8wIv0ZHM Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" commit 3215d4f5b3d08e0087a88df9e155c779927ace1a Author: Jonathan Wakely Date: Fri Apr 30 20:32:05 2021 libstdc++: Fix inconsistent feature test macros The __cpp_lib_constexpr_string and __cpp_lib_semaphore feature test macros are not defined consistently in and the relevant header for the feature. libstdc++-v3/ChangeLog: * include/bits/basic_string.h (__cpp_lib_constexpr_string): Only define for C++17 and later. * include/std/version (__cpp_lib_semaphore): Fix condition to match the one in . diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 41d781c698e..fba7c6f3354 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -55,7 +55,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus == 201703L // Support P0426R1 changes to char_traits in C++17. # define __cpp_lib_constexpr_string 201611L -#else +#elif __cplusplus > 201703L // Also support P1032R1 in C++20 (but not P0980R1 yet). # define __cpp_lib_constexpr_string 201811L #endif diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version index 09e67a40d0c..ea0e18a3f9d 100644 --- a/libstdc++-v3/include/std/version +++ b/libstdc++-v3/include/std/version @@ -241,7 +241,7 @@ #if __cpp_lib_concepts # define __cpp_lib_ranges 201911L #endif -#if __cpp_lib_atomic_wait +#if __cpp_lib_atomic_wait || _GLIBCXX_HAVE_POSIX_SEMAPHORE # define __cpp_lib_semaphore 201907L #endif #define __cpp_lib_shift 201806L --5LBS9LiS8wIv0ZHM--